I need to connect to Athena using Python.
The code used is as follows:
import pyathena
import pandas as pd
athena_conn = pyathena.connect(access_key,
secret_key,
s3_staging_dir,
region_name)
df = pd.read_sql("SELECT * FROM db.tableLIMIT 10", athena_conn)
df.head(5)
I, personally don't have access to Athena with my AWS, hence I'm borrowing the access_key
and secret_access_key
from my colleague, who has access to Athena.
I get the following error while running the code :
An error occurred (AccessDeniedException) when calling the StartQueryExecution operation:
User: arn:aws:iam::xxxxx:user/xxxx is not authorized to perform: athena:StartQueryExecution on resource:
arn:aws:athena:us-east-1:xxxx:workgroup/primary because no identity-based policy allows the
athena:StartQueryExecution action
unable to rollback
Is it because my account doesn't have access to Athena?