Skip to content

how to get QueryExecutionId from cursor when using sqlalchemy + pyathena  #339

Open
@mdeshmu

Description

@mdeshmu

I am using sqlalchemy + pyathena

Here is an example code:

from urllib.parse import quote_plus
from sqlalchemy import create_engine, inspect
conn_str = "awsathena+rest://@athena.{region_name}.amazonaws.com:443/{schema_name}?s3_staging_dir={s3_staging_dir}"
engine = create_engine(conn_str.format(region_name="us-east-1", schema_name="default", s3_staging_dir=quote_plus("s3://aws-athena-query-results-bucket/")))
conn = engine.raw_connection()
cursor = conn.cursor()
cursor.execute("""SELECT * FROM "database"."table""")

for sqlalchemy + pyathena setup, I want to know if there is a way to get QueryExecutionId of a running query from its cursor so that it can be later used to cancel the query using cancel method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions