mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-04 06:18:17 +00:00

This requires Rust 1.31 (from last year) to build, but is otherwise compatible with the 2015-edition code.
15 lines
383 B
Rust
15 lines
383 B
Rust
use sqlparser::dialect::GenericSqlDialect;
|
|
use sqlparser::sqlparser::*;
|
|
|
|
fn main() {
|
|
let sql = "SELECT a, b, 123, myfunc(b) \
|
|
FROM table_1 \
|
|
WHERE a > b AND b < 100 \
|
|
ORDER BY a DESC, b";
|
|
|
|
let dialect = GenericSqlDialect {};
|
|
|
|
let ast = Parser::parse_sql(&dialect, sql.to_string()).unwrap();
|
|
|
|
println!("AST: {:?}", ast);
|
|
}
|