laughingman7743 / PyAthena

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

Cannot specify Athena workgroup when using sqlalchemy #466

Closed milescrawford closed 1 year ago

milescrawford commented 1 year ago

When using the library directly, you can provide a work_group argument to the call to connect.

However, I do not see any way to specify which work group is to be used when using pyathena with sqlalchemy - there doesn't appear to be a way to include a workgroup in the connection string.

Is there a way to work around this, or should some explicit means of setting workgroup for sqlalchemy be added?

Thank you!

laughingman7743 commented 1 year ago

In SQLAlchemy, you should be able to specify the workgroup name as a parameter in the connection string as follows.

awsathena+rest://athena.region_name.amazonaws.com:443/schema_name?s3_staging_dir=s3_staging_dir&work_group=work_group_name
milescrawford commented 1 year ago

Oh of course. Sorry, I somehow saw the list of dialect options below and thought that was the available set for the connection string. But of course all the parameters to the connect method are supported. Thank you!