| Crates.io | sql-insight-cli |
| lib.rs | sql-insight-cli |
| version | 0.2.0 |
| created_at | 2024-02-12 11:20:48.327332+00 |
| updated_at | 2024-07-04 15:11:50.169581+00 |
| description | A CLI utility for SQL query analysis, formatting, and transformation. |
| homepage | https://github.com/takaebato/sql-insight |
| repository | https://github.com/takaebato/sql-insight |
| max_upload_size | |
| id | 1136762 |
| size | 38,845 |
A command-line interface built on top of the sql-insight. It provides a set of commands that sql-insight supports.
Additional Features:
Install sql-insight-cli using Cargo:
cargo install sql-insight-cli
sql-insight-cli supports the following commands. Commands can process input directly from the command line, from a file using the --file option, or interactively.
--file <path>: Read SQL queries from the specified file instead of command line arguments.exit, quit or press Ctrl + C.Format SQL queries to a standardized style:
sql-insight format "SELECT * \n FROM users WHERE id = 1;"
This outputs:
SELECT * FROM users WHERE id = 1
Normalize SQL queries, abstracting values to placeholders:
sql-insight normalize "SELECT * \n FROM users WHERE id = 1;"
This outputs:
SELECT * FROM users WHERE id = ?
Identify tables involved in SQL queries:
sql-insight extract-tables "SELECT * FROM catalog.schema.users as users_alias"
This outputs:
catalog.schema.users AS users_alias
Extract and identify CRUD operations and involved tables:
sql-insight extract-crud "INSERT INTO users (name) SELECT name FROM employees"
This outputs:
Create: [users], Read: [employees], Update: [], Delete: []
sql-insight-cli leverages sqlparser-rs for parsing, supporting a wide range of SQL dialects. For a detailed list, please refer to the sqlparser-rs documentation.
Contributions to sql-insight-cli are welcome! Whether it's adding new features, fixing bugs, or improving documentation, feel free to fork the repository and submit a pull request.
sql-insight-cli is licensed under the MIT License.