| Crates.io | sql_parser_project |
| lib.rs | sql_parser_project |
| version | 0.1.0 |
| created_at | 2024-11-14 02:49:34.947879+00 |
| updated_at | 2024-11-14 02:49:34.947879+00 |
| description | This is a simple project to parse SQL queries using pest crate. Currently parser supports simple select queries whith where conditions. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1447361 |
| size | 190,395 |
This is a simple project to parse SQL queries using pest crate.
Currently parser supports simple select queries whith where conditions.
The SQL Query Parser extracts from a basic SQL query:
Created parser processes PSQL-like select statements with multiple columns selections and where statements.
Column and table names have to be encased in double quotes, while string values have to be encased in single quotes.
Reserved keywords have to
There are main grammar rules used:
query: Matches the full SQL SELECT statement.columns: Parses a comma-separated list of columns.from_clause: Parses the FROM TABLE part of statement.where_clause: Parses the WHERE CONDITION part of statement.identifier: Parses the name of a column or table.
cargo run test-query.txt
SELECT "column1" FROM "table" WHERE "column1" = 5 AND "column2" = 'value';
Selected table: "table"
Selected columns: "column1"
Conditions:
Column: "column1", Operator: =, Value: 5
AND
Column: "column2", Operator: =, Value: 'value'