0

I'm running the following code through AWS wrangler

import awswrangler as wr

my_query = wr.athena.read_sql_query(
    sql="""select "$path" as path from table""",
    database='db', workgroup='workgroup'
)

But I don't wish to use static methods such as Aws Cli or configurations file to store my creds.

How do I add the creds directly in the above code?

gseph
  • 41
  • 6

1 Answers1

1

I had to create a boto3 session and pass it as a parameter value

my_session = boto3.Session(region_name="REGION", \  
aws_access_key_id="YOUR_ACCESS_KEY", aws_secret_access_key="YOUR_SECRET_ACCESS_KEY")

my_query = wr.athena.read_sql_query(
    sql="""select "$path" as path from table""",
    database='db', workgroup='workgroup',
    boto3_session= my_session
)
gseph
  • 41
  • 6