Athena Adapter

Generate Athena SQL from your model. Athena is the usual cold tier: history in S3 behind a hotter warehouse.

What the adapter emits

  • Identifiers in "double quotes"; bare column names in expressions are lowercased.
  • Date literals as DATE '2026-01-01'; grain truncation as DATE_TRUNC('month', x); parts with YEAR(x), DAY_OF_WEEK(x), DAY_OF_YEAR(x).
  • CTEs for the per-fact subqueries and a FULL OUTER JOIN when a query blends measures from two facts.

Configuration

athena_data:
  adapter: athena
  name: AWS Athena
  tier: cold
  region: us-east-1
  database: analytics
  catalog: awsdatacatalog
  workgroup: primary
  # access_key_id / secret_access_key: never here; your application holds them

Connection fields

The server never connects to Athena: it has no database driver in it, and the only keys the deployed model keeps are adapter, tier and the name. Your application runs the statement it gets back, with its own credentials.

zsql on this machine does connect, read-only, for zsql catalog, zsql sample and zsql run. It signs its own SigV4 requests with access_key_id and secret_access_key (and session_token), the AWS_* variables, or a named profile; region, database, catalog, workgroup and output_location say where. Secrets go in .zsql or ZSQL_DS_<KEY>_<FIELD>, never in datasources.yml; zsql deploy strips access_key_id and secret_access_key from the file if present. See Connecting to a warehouse.

Notes

  • Expressions are Athena SQL. approx_distinct, arbitrary, array_agg and date_diff are fine in expression.sql.
  • Pair with a hot tier. Give the Athena tables a date partition covering the history they hold and a higher cost, so the planner routes recent-data queries to the hot tier and only history to Athena. See Semantic Routing.

Next Steps