-
Notifications
You must be signed in to change notification settings - Fork 26
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
Missing Support for Parameterized Queries in databend-driver #583
Comments
Yes, we would like this too. I believe already raised here #374 This would also help to pass binary values through from SQLAlchemy driver, I would hope. |
@rad-pat Okay Cool! That package is for python. Wanted paramterized support for the npm |
We may need to resolve it on But I will try to have a quick implementation on bendsql side. Yet now we can use variable
|
Please also consider adding a method for returning a query string once the parameters have been bound, equivalent of |
@sundy-li Please add support for both For Example query: Bindings should be: [2, 5] The output would be: In nodejs script should be like for example function in databend-driver
PostgreSQL supports multiple binding styles, including $, ?. It would be great if this feature could be added to support all these formats for better flexibility. |
@Shanmugavel-J Because we already support to fetch fields from csv stage select $1, $2 from @unload(file_format => 'csv_gzip');
----
1 2
3 4
5 6
we plan to support these in driver
two kinds of parameters |
This would be beneficial, specifically when using positional bindings like Here, the values for the parameters :1, :2, :3, and :4 appear in a different order than they are referenced in the query. This approach allows for greater flexibility when the positions of the values in the bindings do not necessarily follow the same order. |
Ok, I choose to support $1 , $2 |
@sundy-li Thanks for understanding !! If there is a function which would return the SQL query to execute That will be good as well. ex:-
|
Connection has a format_sql method now
|
Currently, the databend-driver does not support the ability to pass parameters during query execution. This limitation can significantly impact usability and developer experience, especially when working with dynamic or user-supplied values.
Example:
Consider the following query:
SELECT * FROM TEST WHERE id = :1
In this case, the Bindings would be: [10]
It would be highly beneficial to support both
:
and?
as parameter placeholders in queries.It would be beneficial to have the ability to bind parameters to queries like this, similar to other database drivers. This would allow for safer, more efficient queries, and help avoid SQL injection vulnerabilities.
Implementing this feature would enhance both performance and developer experience. Thanks!
Note: Wanted for nodejs. That is npm
databend-driver
The text was updated successfully, but these errors were encountered: