Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic API? #2

Open
jackfirth opened this issue Jul 15, 2017 · 1 comment
Open

Dynamic API? #2

jackfirth opened this issue Jul 15, 2017 · 1 comment

Comments

@jackfirth
Copy link

jackfirth commented Jul 15, 2017

This package seems to provide two main pieces:

  1. A SQL-engine-agnostic AST and the ability to execute statements written in this AST
  2. A fancy and user-friendly macro-powered S-expression notation for constructing this AST

The second piece is nice when performing operations on a known table structure, but when trying to write libraries that abstract over bits of SQL the first piece is more important. It doesn't seem like dynamic constructors for the AST are stable or well documented. Based on the project TODOs, I'm guessing more support for the dynamic API is expected in the future. What do you imagine it looking like?

For reference, I'm trying to write a function that basically pairs an insert statement with a delete statement in a single value to automatically construct and destruct a row in a database for integration tests.

@rmculpepper
Copy link
Owner

Yes, the dynamic representation is private, and it will probably stay that way.

The priority for the dynamic API would be to enable abstraction where it currently isn't possible. Greg's request in #1, for dynamic selection of ORDER BY columns and directions, is a good example.

Probably the most power would come from adding functions for the various non-terminals to parse run-time s-expressions (or syntax objects) into ASTs. I think I'd rather do that than try to make a general make-select-stmt function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants