laughingman7743 / PyAthena

PyAthena is a Python DB API 2.0 (PEP 249) client for Amazon Athena.
MIT License
464 stars 105 forks source link

Add LIMIT as argument for execute #467

Closed nicor88 closed 1 year ago

nicor88 commented 1 year ago

With the introduction of dbt-core 1.6.0 we need to be able to pass a limit parameter to athena cursor, therefore will be nice to have that in place directly in pyathena.

I didn't find that possible, but happy to close this one if it's already implemented.

laughingman7743 commented 1 year ago

I don't know what your requirements are, but I don't see why this library would need to be implemented specifically for dbt.

nicor88 commented 1 year ago

I was just giving you a context of the spefic use case. It's possible to "add" "limit" to AthenaCurson.execute - potentially uses cases is not only dbt BUT a broader users pool.

e.g. AthenaCurson.execute(sql, limit=100)

laughingman7743 commented 1 year ago

The cursor's execute method is an interface to execute a user-specified query. A query is not only a SELECT statement. It is not possible to support such parameters. If you want to embed parameters in your query, you can use named placeholders. https://github.com/laughingman7743/PyAthena#query-with-parameter