-
Notifications
You must be signed in to change notification settings - Fork 215
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
Alternative query parameters formats #1479
Comments
Thanks for the suggestion @linux-china . I think we could quite easily support both To confirm, is the bracketed approach better because then you can have multiple words? Are there SQL dialects which support multiple words though? What would the SQL look like for |
@max-sixty yes, it's my thinking.
|
OK, I'm fine with that. I adjusted the title, hope that's OK. To set expectations: my guess is that this would need to come from a contribution. I'm not sure how confident you are in Rust, but it could be a good early PR! (I know you've done lots on the JetBrains extension, so no pressure...) FWIW I don't have it clear in my mind how the But to the extent it's a templating language which we would compile to, that would be more complex. I'm not ruling anything out at all — but it's probably worth thinking about how you'd envision that working / whether there's an approach that would be compatible with as much of the existing PRQL codebase as possible. Thank you @linux-china ! |
I like the |
Wait, how does that compile to SQL? SELECT * FROM employees WHERE age > ${age} AND status == ${status} Many dialects don't support this, only numbered params. |
@aljazerzen yes, this feature is useful for some database/sql frameworks, and not for database directly. |
I see. From our standpoint, this is an SQL dialect (or flavor of a dialect?). And plan of action is:
|
This might come in handy for dbt integrations. I have to look at the dbt side again before commenting more but putting a pin here to circle back to. |
Update: I've looked into current state and my plan of action above. At the moment, we allow parameters of format If we want different parameter formats (
This works right now:
|
Agree that s-strings are a good temporary way forward, and then if alternatives become popular we could look at something more integrated... |
Now PRQL uses
$1
,$2
as parameters, and it's good for parameters with index. For some cases,named parameters are required when transpiled to SQL, For example, in Java, Spring JDBC and Hibernate use
:age
style for named parameter, and MyBatis uses#{email}
style. How about named parameter${name}
and${person.age}
support in PRQL and to make SQL transpile easy.The text was updated successfully, but these errors were encountered: