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

Feature request: support for positional parameter substitution #545

Open
paulgrow-octane opened this issue May 15, 2024 · 1 comment
Open
Assignees

Comments

@paulgrow-octane
Copy link

paulgrow-octane commented May 15, 2024

Thank you for a wonderful library and for your work maintaining it!

One feature I hope can be considered for future development is implementing ? style param support. Athena supports parameterized queries using the ? character for positional substitution.

For use cases where queries are run both using pyathena and by analysts directly, having PyFormat-style params is not ideal as it requires analysts to modify queries to execute them directly in their SQL clients or in the Athena console. Supporting ? for query parameterization would decouple the query from any specific execution context, making it more portable.

Thanks for your time and consideration.

@laughingman7743
Copy link
Owner

laughingman7743 commented May 19, 2024

https://github.com/laughingman7743/PyAthena/blob/master/pyathena/__init__.py#L19
https://github.com/laughingman7743/PyAthena/blob/master/pyathena/common.py#L557-L566
If the paramstyle is set to qmark, I think it can be handled by simply stopping the expansion of the query parameters and passing the parameters to the start_query_execution request.
I think this could be easily implemented without major changes. I will probably address this eventually when I have time.

@laughingman7743 laughingman7743 self-assigned this May 19, 2024
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