apache / datafusion-sqlparser-rs

Extensible SQL Lexer and Parser for Rust
Apache License 2.0
2.74k stars 525 forks source link

help wanted: extend cli example for batch processing #271

Open aisbergde opened 4 years ago

aisbergde commented 4 years ago

it looks like the sqlparser-rs can do what I need

if it is to complicated to read the sql source from mssqlserver and to store the json result into mssqlserver it would be also possible:

Maybe the example cli.rs could be extended to export the json into a file? And maybe it could also be extended to parse a directory containing sql-files, and to use an optional parameter for the folder for generated json files?

I never before used Rust. I could try to learn the basics of rust to implement this. But maybe it is much more easy to do for developers experienced in rust then for me, which I am a database specialist, but not a rust developer?

nickolay commented 4 years ago

Maybe the example cli.rs could be extended to export the json into a file? And maybe it could also be extended to parse a directory containing sql-files, and to use an optional parameter for the folder for generated json files?

I use "Git for Windows" to get the basic unix tools on Windows. Using those you can do:

parse-sql foo.sql > my.json

...to write the result to a file (parse-sql is cli.rs with a few trivial changes to remove logging), and xargs to process a directory.

nickolay commented 4 years ago

Also: note that we're likely to change the JSON format in the future.

aisbergde commented 4 years ago

...to write the result to a file (parse-sql is cli.rs with a few trivial changes to remove logging), and xargs to process a directory.

this was the request: to extend the cli.rs a little bit to do so.

But if it could happen that the json format will change then I should not spent to much energy to transform the json in something I need.