PyAthenaJDBC icon indicating copy to clipboard operation
PyAthenaJDBC copied to clipboard

how to use custom credential provider jar with sqlalchemy

Open knadigatla opened this issue 3 years ago • 3 comments

Hello,

We built a custom credential provider jar for custom authentication to athena. as per the aws documentation mentioned below.

https://aws.amazon.com/blogs/big-data/connect-to-amazon-athena-with-federated-identities-using-temporary-credentials/

but I have passed the extra jar(credential jar) in driver_path along with the athenajdbc jar. like driver_path="<path_to_driver_jar>;<path_to_custom_credentials_jar>" But it is failing and not recognizing the custom class. Should I use a different approach to pass the extra jar?

If I pass only jdbc jar then it is throwing the credential class missing, if I pass both the jars ; separated then it is throwing TypeError: Class com.simba.athena.jdbc.Driver is not found

knadigatla avatar Jul 31 '21 09:07 knadigatla

It doesn't support loading multiple Jar files, I think it would be better to create a shaded jar(fat jar) file that contains the JDBC driver and custom credential classes and specify them in the driver class path. Alternatively, consider using a library that does not depend on JDBC. https://github.com/laughingman7743/PyAthena

laughingman7743 avatar Jul 31 '21 09:07 laughingman7743

It doesn't support loading multiple Jar files, I think it would be better to create a shaded jar(fat jar) file that contains the JDBC driver and custom credential classes and specify them in the driver class path. Alternatively, consider using a library that does not depend on JDBC. https://github.com/laughingman7743/PyAthena

Thanks @laughingman7743 does PyAthena supports custom authentication?(writing our own credential generator class)

knadigatla avatar Jul 31 '21 09:07 knadigatla

It doesn't support the Java credential provider that you have created on your own. If so, I think you need to use the JDBC version.

laughingman7743 avatar Jul 31 '21 10:07 laughingman7743