Query Amazon Athena

To query Amazon Athena with Flux:

  1. Import the sql package.

  2. Use sql.from() and provide the following parameters:

    • driverName: awsathena
    • dataSourceName: See data source name
    • query: SQL query to execute
import "sql"

    driverName: "awsathena",
    query: "GO SELECT * FROM Example.Table",

Amazon Athena data source name

The awsathena driver uses the following data source name (DSN) syntaxes (also known as a connection string):


Use the following query parameters in your Athena S3 DSN:

* Required
  • * region - AWS region
  • * accessID - AWS IAM access ID
  • * secretAccessKey - AWS IAM secret key
  • db - database name
  • WGRemoteCreation - controls workgroup and tag creation
  • missingAsDefault - replace missing data with default values
  • missingAsEmptyString - replace missing data with empty strings

Athena to Flux data type conversion

sql.from() converts Athena data types to Flux data types.

Athena data typeFlux data type
tinyint, smallint, int, integer, bigintint
float, double, realfloat
timestamp with time zonetime

All other Athena data types (including timestamp, date and time) are converted to strings.

Was this page helpful?

Thank you for your feedback!

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.