docs
docs copied to clipboard
add more samples using 3rd party tools for Athena
It might be helpful to add more samples. pyathena, awswrangler, sqlalchemy
Pyathena
from pyathena import connect
conn = connect(
s3_staging_dir="s3://s3-results-bucket/output/",
region_name="us-east-1",
endpoint_url="http://localhost:4566",
)
cursor = conn.cursor()
cursor.execute("CREATE DATABASE IF NOT EXISTS testdb")
cursor.execute(
"CREATE TABLE IF NOT EXISTS testdb.testtable (col1 int,col2 int,col3 int)"
)
cursor.execute(
"INSERT INTO testdb.testtable (col1,col2,col3) VALUES (1,2,3),(4,5,6),(7,8,9)"
)
cursor.execute("SELECT * from testdb.testtable")
print(cursor.fetchall())