Add CLI
It would be good to have a CLI which can take PRQL and do things like:
- Produce SQL, using
writer.rs(most important, it'd be fine if this is all it does tbh) - Produce an AST, using
parser.rs - Produce a parse tree, using
ast.rs
This will provide the basis of the tool for producing SQL, and provide a simple entry point for people to see intermediate data.
If anyone wants to take this on, please feel free to start with a very small PR.
There probably should be a --flavour flag which allows you to specify which DBMS (Postgress, MariaDB, etc) you're targeting. This would supercede the flavour value given in a PRQL file.
Something to consider is wether we want to be able to automatically query a DBMS. This means there would be two ways to interact with PRQL
prql --flavour psql --host localhost --user user --password strongpass query.prqlprql -o query.sql query.prql
Where the second workflow is specifying a file to output the generated SQL file to.
Another option may be to print the generated SQL to stdout if no -o or --host is set.
This would be the easiest route for v1 if the other options were put on the roadmap as this would allow piping into the sql program.
I'm not sure "flavour" is the right name for the flag and I'm open to suggestions.
Yes, I think we can start with something fairly basic that gives an interface to what's currently available — fine to use stdin / stdout, with the option of supplying file names too.
I agree we could add dialects / flavors (and even direct querying) later.
Let me know if you want to take a swing at this @danjones1618
I think direct querying could be a game changer! That might just be the killer app for PRQL.