Crate sql_insight
source ·Expand description
§sql-insight
sql-insight
is a toolkit designed for SQL query analysis, formatting, and transformation.
§Main Functionalities
- SQL Formatting: Format SQL queries into a standardized format. See the
formatter
module for more information. - SQL Normalization: Normalize SQL queries by abstracting literals. See the
normalizer
module for more information. - Table Extraction: Extract tables within SQL queries. See the
table_extractor
module for more information. - CRUD Table Extraction: Extract CRUD tables from SQL queries. See the
crud_table_extractor
module for more information.
§Quick Start
Here’s a quick example to get you started with SQL formatting:
use sql_insight::sqlparser::dialect::GenericDialect;
let dialect = GenericDialect {};
let normalized_sql = sql_insight::format(&dialect, "SELECT * \n from users WHERE id = 1").unwrap();
assert_eq!(normalized_sql, ["SELECT * FROM users WHERE id = 1"]);
For more comprehensive examples and usage, refer to crates.io or the documentation of each module.
Re-exports§
pub use sqlparser;
pub use extractor::*;
pub use formatter::*;
pub use normalizer::*;
Modules§
- A Formatter that formats SQL into a standardized format.
- A Normalizer that converts SQL queries to a canonical form.