The following steps will help you setup connection to your Athena Instance. Please ensure that you have an Amazon IAM account, and an S3 bucket.
You can follow the video below for a walkthrough of the steps, or skip ahead to follow the instructions below.
Step 1: Create a Holistics User in Amazon IAM Console
Add a user with 'Programmatic Access' in Amazon IAM Console.
Allow this user full access to Athena API: AmazonAthenaFullAccess.
Or a custom policy with full access to Athena, and List, Read, Write to the source S3 bucket.
Holistics requires below actions to be allowed for all operations working properly:
Step 2: Add AWS Athena Data Source
Create an Athena database using AWS Athena Console.
Visit (https://secure.holistics.io/data_sources) and add a new data source. Select AWS Athena data source type, then fill in the form:
- Region: AWS region hosting Athena database, source file S3 buckets, and query result S3 bucket.
- Access Key ID and Secret Access Key are from the Amazon account you created in Step 1.
- Result Bucket: all Athena query results are stored in this bucket. The current Amazon account should be able to access this bucket. Please see AWS Athena docs for more details.
- Storage Bucket URL: This is the bucket to store your imported data and files.
Step 3: Setup your Athena Instance for Querying
First, you need to create Athena table to be used as schema-on-read during query execution (Please refer to AWS Athena docs for more details). Remember to enable Non-select Queries.
Then you can build report, view results, and make charts.
Note: In AWS Athena Schema and Data source are the same thing (https://docs.aws.amazon.com/athena/latest/ug/create-database.html). If you don't specify the schema in your query, the query will be executed on the default schema.
Sometimes you'll receive this error with pattern like this:
ATHENA_NAME_ERROR: HIVE_METASTORE_ERROR: com.facebook.presto.spi.PrestoException: Error: name expected at the position ... of ... but 'special character' is found.
There is a reason for that:
- Special characters other than underscore (_) are not supported for Table, Database and columns names.
- Although you may succeed in creating table, view, database, or column names that contain special characters other than underscore by enclosing them in backtick (`) characters, subsequent DDL or DML queries that reference them can fail.
- For more details please refer to the official docs of AWS Athena here