Instructions for configuring PyCharm Professional's Database tool to query AWS Athena
(screenshots included under /setup)
- Download Pycharm Professional (the database tool is not available in the community version)
- Install the AWS cli; version 2 is the most up to date at the time of writing these instructions.
- The authentication config here assumes you have temporary credentials in your
~/.aws/credentials
file - In Pycharm, click on the Database button to expand it (should on be on the collapsed right hand side pane)
- Click on the "+" button
- Click on "Driver" (This should open a new window with
User Driver
selected in the left sidebar)- Name the driver "AWS Athena"
- Add the driver, selecting
AthenaJDBC42_2.0.25.1001.jar
in theSimbaAthenaJDBC-2.0.25.1001
folder in this repo- After selecting the driver, from the Class dropdown select the
com.simba.athena.jdbc.Driver
- Below, add a url template with name
default
and valuejdbc:awsathena://athena.[{host::eu-west-2}].amazonaws.com[:{port::443}][\?<;,{:identifier}={:param}>]
- After selecting the driver, from the Class dropdown select the
- In the Options tab, choose "Redshift" as the SQL dialect
- Apply -> OK
- Click on "Driver" (This should open a new window with
- Click on the "+" button
- Data Source -> "AWS Athena" (the one you just configured)
- Enter "eu-west-2" in
host
(if not already populated) - Click on the Advanced tab and set the following key-value properties:
AwsCredentialsProviderArguments = <name of profile in your ~/.aws/credentials file> AwsCredentialsProviderClass = com.simba.athena.amazonaws.auth.profile.ProfileCredentialsProvider S3OutputLocation = s3://<s3 bucket where Athena outputs query results> Workgroup = <your Athena workgroup>
- Click on the "+" button
Some context:
- The
ProfileCredentialsProvider
class we chose will look for AWS credentials in~/.aws/credentials
on your local machine. - The
AwsCredentialsProviderArguments
defines which AWS Profile in~/.aws/credentials
to use.