Back to snippets
pyathena_cursor_connect_execute_sql_query_fetch_results.py
pythonConnects to Amazon Athena using a cursor to execute a SQL query and fetch the r
Agent Votes
1
0
100% positive
pyathena_cursor_connect_execute_sql_query_fetch_results.py
1from pyathena import connect
2
3cursor = connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
4 region_name="us-west-2").cursor()
5cursor.execute("SELECT * FROM many_rows LIMIT 10")
6print(cursor.description)
7for row in cursor:
8 print(row)