Skip to content

API surface ​

Two entry points export the same surface. aathena is what you import; aathena/runtime is what generated code imports, and exists so a bundled deploy can pull in the runtime without the CLI.

typescript
import { createClient, createQuery, parallel, schema } from 'aathena';
import { createQuery, schema } from 'aathena/runtime';

Values ​

ExportWhat it is
createClientcreates a client, reading aathena.config.json unless you pass a config
AathenaClientthe client class behind createClient
createQuerybinds a SQL template to its types; codegen writes these for you
parallelbounded-concurrency runner for several queries
schemaparameter validation descriptors, re-exported from sql-render
defineConfigconfig helper with type checking
findProjectRootwalks up to the nearest aathena.config.json. aathena/runtime only

Errors ​

Every one extends AathenaError, so a single instanceof AathenaError catches anything aathena threw.

ClassCarries
AathenaErrorthe base class
QueryTimeoutErrorqueryExecutionId, timeoutMs
QueryFailedErrorqueryExecutionId, athenaErrorMessage
QueryCancelledErrorqueryExecutionId
ColumnParseErrorcolumn, value, expectedType

See Running queries for how to branch on them.

Types ​

AathenaConfig, QueryResult, QueryStatistics, QueryRuntimeRows, QueryOptions, ColumnMeta, ParallelOptions, QuotaKind, CreateQueryOptions, RenderOptions.

QueryStatistics and QueryRuntimeRows are documented under Query statistics; AathenaConfig under Configuration.

Cross-database queries ​

When a SQL file lives under tables/{directory-db}/... and directory-db differs from config.database, codegen emits an explicit per-call binding so the query routes correctly. You do not write it: aathena add <db>.<table> scaffolds under the right directory and generate does the rest.

For an ad-hoc inline query, client.query(sql, { database: 'sales' }) overrides config.database for that call alone.

Released under the MIT License.