This repository has been archived by the owner on Sep 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
_build_driver_args() should delegate to DefaultAWSCredentialsProviderChain by default #108
Comments
The processing of that code is implemented to use the Boto3 credentials. |
I don't follow. What's the difference between "Boto3 credentials" and "JDBC credentials"? From my understanding, they both have the same behavior and use the same credentials provider chain: Boto3, Java SDK To put my point differently, what exactly would break if we made def _build_driver_args(self):
props = jpype.java.util.Properties()
if user_provided_credentials_directly_to_connect_function:
props.setProperty("UID", self.access_key)
props.setProperty("PWD", self.secret_key)
else:
props.setProperty(
"AwsCredentialsProviderClass",
"com.simba.athena.amazonaws.auth.DefaultAWSCredentialsProviderChain",
) |
Oh, Boto3 and JDBC are no different at all. 🧐 |
laughingman7743
added a commit
that referenced
this issue
Jul 18, 2020
… same name as the JDBC driver's Driver Configuration Options. Changed the default authentication delegate to use DefaultAWSCredentialsProviderChain. (close: #108) Remove botocore dependencies.
laughingman7743
added a commit
that referenced
this issue
Jul 23, 2020
Change the connect method and Connection object arguments to have the same name as the JDBC driver's Driver Configuration Options.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I think the code here needs to be restructured:
PyAthenaJDBC/pyathenajdbc/connection.py
Lines 151 to 174 in e06196b
DefaultAWSCredentialsProviderChain
covers access via credentials file, profile name, or token, so it should be the default option. I don't think we need all these code branches checking for each case and setting a different provider. The default provider takes care of all of that automatically.If the PyAthenaJDBC API requires it, perhaps the only branch we need is to check if the user explicitly passed in credentials to
connect()
. And if not, it should just defer toDefaultAWSCredentialsProviderChain
. Does that make sense?Another thing that seems off in this block of code is that it doesn't seem to respect the user-provided
AwsCredentialsProviderClass
. If I specify that in the URL parameters, it gets overridden by this code.So, for example, I am connecting to Athena via PyAthenaJDBC and SQLAlchemy. I tried manually setting
AwsCredentialsProviderClass
in the URL as follows:But because I've also set
AWS_PROFILE
, something gets messed up and I get this error:If I just delete that entire block of code from
_build_driver_args()
, everything works. Specifically, I can query Athena using the temporary credentials associated with the configured AWS profile.If this all makes sense, I'd be happy to submit a PR to fix this behavior, including the appropriate tests.
The text was updated successfully, but these errors were encountered: