MeltanoLabs / target-athena

Singer.io Target for AWS Athena.
Other
5 stars 16 forks source link

Support using AWS Session token #46

Open Avinash-1394 opened 9 months ago

Avinash-1394 commented 9 months ago

Description

Even though the session token is derived from the config/env, it is not utilized when connecting so I am running into a DatabaseError when the cursor executes

Expected output

The query should be executed with no issues

Actual output

DatabaseError: An error occurred (UnrecognizedClientException) when calling the StartQueryExecution operation: The security token included in the request is invalid.

Suggestion

Connection to Athena here - https://github.com/MeltanoLabs/target-athena/blob/main/target_athena/athena.py#L40 should be updated to

cursor = connect(
            aws_access_key_id=aws_access_key_id,
            aws_secret_access_key=aws_secret_access_key,
            aws_session_token=aws_session_token,
            region_name=aws_region,
            s3_staging_dir=s3_staging_dir,
            work_group=athena_workgroup,
        ).cursor()