View a markdown version of this page

Requirements and behavior by workgroup engine - Amazon Athena

Requirements and behavior by workgroup engine

ODBC 4.x supports workgroups that use Athena engine version 3 or DuckDB. The driver resolves the connection engine and result storage from the workgroup configuration when it configures a connection. The following comparisons describe behavior within the 4.x driver.

When EnableConnectionCaching is enabled, the driver can reuse the workgroup configuration for five minutes.

For changes from the previous driver generation, see Migrate from ODBC 2.x. For installation instructions, see Get started with ODBC 4.x.

Check requirements before connecting

Allow athena:GetWorkGroup for the credentials used by the driver. This lookup is also used when you supply EngineVersion. An engine override does not remove the workgroup lookup.

For engine version 3 streaming, allow athena:GetQueryResultsStream. For DuckDB data access requirements, see IAM permissions.

RequirementEngine version 3DuckDB
Workgroup lookupathena:GetWorkGroupathena:GetWorkGroup
EngineVersion valueAthena engine version 3DuckDB
Streaming permissionathena:GetQueryResultsStream for the legacy streamSee IAM permissions for DuckDB data access requirements.
Stream endpointThe legacy stream uses port 444 by default.The Arrow stream uses the Athena API endpoint configuration.

Leave EngineVersion unset to select the engine reported by the workgroup. An unrecognized engine is a connection error unless a supported override is supplied.

Choose result fetching for your workgroup

Result storage affects the fetcher selected by ResultFetcher=auto. Managed query results and results in a customer-owned Amazon S3 bucket use different routes.

Result storageEngine version 3: autoDuckDB: auto
Managed query resultsGetQueryResultsStreamGetQueryResultStream with Apache Arrow.
Customer-owned Amazon S3 bucketS3; uses GetQueryResultsStream for CSE_KMS encryption or when opening S3 results reports AccessDenied or a missing result object or bucket.S3; uses GetQueryResults for CSE_KMS encryption or when opening the S3 result fetcher reports an AccessDenied error.

Use the following table when you explicitly set ResultFetcher. Combinations marked "Not available" are rejected during connection setup.

Explicit ResultFetcherEngine version 3DuckDB: managed resultsDuckDB: customer bucket
GetQueryResultsAcceptedAcceptedAccepted
GetQueryResultsStreamAcceptedNot availableNot available
GetQueryResultStreamNot availableAcceptedNot available
S3Accepted; see the restriction below.Not availableAccepted

On engine version 3, S3 is accepted as a connection option, but reading results with this fetcher requires an Amazon S3 result location. Use auto for Athena-managed results.

For DuckDB, UseResultsetStreaming and EnableS3Fetcher must be absent, empty, or the literal string 0. Remove those legacy toggles and select a supported ResultFetcher.

Review SQL and result metadata

The driver selects the SQL escape processor, parameter literal renderer, and result type system for the connection engine. Use the SQL syntax and result types for that engine.

BehaviorEngine version 3DuckDB
Identifier quote reported by the driver""
Date and time escape literalsDATE, TIME, TIMESTAMPDATE, TIME, TIMESTAMP

Use SQLGetInfo to read capabilities for the connected engine. The driver supplies engine-specific numeric, string, date/time, and system function masks. The following table shows two engine-specific metadata values.

SQLGetInfo selectorEngine version 3DuckDB
SQL_DBMS_VER03.00.000004.00.0000
SQL_SPECIAL_CHARACTERSEmpty string$

The following example compares the SQL emitted for an ODBC escape sequence.

ODBC escapeEngine version 3 SQLDuckDB
{fn TRUNCATE(123.45, 1)}ROUND(123.45, 1)TRUNC(123.45, 1)

For ODBC bound parameters, the driver formats values with the selected engine literal renderer and sends them as execution parameters with StartQueryExecution.

For DuckDB mappings and conversions, see Data types and result conversion. For connection failures, see Troubleshoot the ODBC 4.x driver.