-
Notifications
You must be signed in to change notification settings - Fork 148
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
Add support for pyformat paramstyle #192
Comments
Currently the parameters are interpolated using the Using pyformat would mean doing the interpolation on the clientside and would result in just one in the HTTP body. The relevant code is here: trino-python-client/trino/dbapi.py Lines 452 to 480 in 951ad82
@quickcoffee: Are you willing to do a PR to implement this? |
Client side interpolation doesn't seem a good idea because then the client will end up playing catch up with what the server supports. While the end goal is useful (more readable Python code with complex queries) the solution has a cost. I'd argue that people should use something higher level like SQLAlchemy if they need more choice. |
@mdesmet I could create a PR, if you are willing to use client side interpolation, which we should figure out first. Regarding the comment from @hashhar: I understand that there is a cost. Maybe the python client is then not the right place to support |
Currently the trino python client does not support the pyformat parameter style.
Support for this paramstyle would allow to specify the parameters via a dict and use parameters in more complex queries where multiple parameters are defined, while maintaining a high code readability.
See the PyHive implementation: dropbox/PyHive@d6e7140
The text was updated successfully, but these errors were encountered: