Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use pyarrow with sql academy with dynamic credentials #373

Open
suuhaasa opened this issue Oct 12, 2022 · 2 comments
Open

Unable to use pyarrow with sql academy with dynamic credentials #373

suuhaasa opened this issue Oct 12, 2022 · 2 comments

Comments

@suuhaasa
Copy link

conn_str = "awsathena+arrow://:@athena.{region_name}.amazonaws.com:443/"
"{schema_name}?s3_staging_dir={s3_staging_dir}"
Using this conn_str doesn't pass dynamic credentials to pyarrow s3 filesystem. Getting an error:
sqlalchemy.exc.OperationalError: (pyathena.error.OperationalError) When reading information for key ... AWS Error [code 15]: No response body.
But this works conn_str = "awsathena+rest://:@athena.{region_name}.amazonaws.com:443/"
"{schema_name}?s3_staging_dir={s3_staging_dir}"

@suuhaasa
Copy link
Author

suuhaasa commented Oct 12, 2022

used this temporary solution in pyathena/arrow/result_set.py which works

 else:
            b3_session = connection.session._session
            aws_access_key_id = b3_session.get_credentials().access_key
            aws_secret_access_key = b3_session.get_credentials().secret_key
            aws_session_token = b3_session.get_credentials().token
            fs = fs.S3FileSystem(
                access_key=aws_access_key_id,
                secret_key=aws_secret_access_key,
                session_token=aws_session_token,
                region=connection.region_name,
            )

@laughingman7743
Copy link
Owner

Should I change the implementation to a temporary solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants