Override the engine for a single query
You can run a single query on a different engine without changing the workgroup. From an Athena engine version 3 workgroup, you can run a query on DuckDB. From a DuckDB workgroup, you can run a query on Athena engine version 3. The override applies only to that query.
Keep these points in mind:
-
Athena does not translate SQL between engines. A query that you override to DuckDB must use DuckDB's SQL dialect. To translate an existing query, use the migration agent. For more information, see Migrate from Athena engine version 3 to DuckDB.
-
Use the engine version value exactly as
ListEngineVersionsreturns it, for exampleDuckDBorAthena engine version 3. Values are case-sensitive, andAUTOis not accepted. -
The first time that you run a query on DuckDB from an engine version 3 workgroup in an account, Athena creates the service-linked role
AWSServiceRoleForAmazonAthenawith your credentials. Your principal needs permission foriam:CreateServiceLinkedRole, or an administrator can create the role first withaws iam create-service-linked-role --aws-service-name ops.athena.amazonaws.com. For more information, see Athena service-linked role. -
Some workgroup and query settings prevent an override. For the list, see Engine override restrictions and errors.
Run a query on DuckDB in the console
To run a query on DuckDB from an engine version 3 workgroup
-
In the query editor, for Workgroup, choose an Athena engine version 3 workgroup.
-
Enter a query that uses DuckDB syntax.
-
Choose Run on DuckDB.
Run a query on DuckDB with the AWS CLI
AWS CLI versions released before December 1, 2026 don't include --engine-version. In the following command, replace your-engine-v3-workgroup with the name of your engine version 3 workgroup and your-region with your AWS Region.
aws athena start-query-execution \ --query-string "SELECT 1" \ --work-groupyour-engine-v3-workgroup\ --engine-version DuckDB \ --regionyour-region
To confirm which engine ran the query, run the following command. Replace query-execution-id with the ID that start-query-execution returned.
aws athena get-query-execution \ --query-execution-idquery-execution-id\ --query QueryExecution.EngineVersion \ --regionyour-region
The output shows the engine that ran the query in EffectiveEngineVersion:
{ "SelectedEngineVersion": "DuckDB", "EffectiveEngineVersion": "DuckDB" }
Engine override restrictions and errors
In the console and the API, an engine override fails with InvalidRequestException in the following cases. Where a message includes an engine name, it is the engine that you requested.
| Cause of the failure | Error message that Athena returns |
|---|---|
| The workgroup enforces its settings (Override client-side settings is turned on). To override the engine, edit the workgroup and clear Override client-side settings. | EngineVersion 'DuckDB' is not supported for workgroups that enforce workgroup configuration. |
| The workgroup uses IAM Identity Center. | EngineVersion 'DuckDB' is not supported for workgroups with IdentityCenterConfiguration. |
| The workgroup uses S3 Access Grants for query results. | EngineVersion 'DuckDB' is not supported for workgroups with QueryResultsS3AccessGrantsConfiguration. |
| The workgroup uses customer content encryption. | EngineVersion 'DuckDB' is not supported for workgroups with CustomerContentEncryptionConfiguration. |
| The workgroup is assigned to a Capacity Reservation. | EngineVersion 'DuckDB' is not supported for workgroups with a capacity reservation assignment. |
The workgroup's EngineConfiguration has a classification other than athena-execution-properties, for example athena-query-engine-properties. |
EngineVersion 'DuckDB' is not supported with a classification other than 'athena-execution-properties' in the workgroup EngineConfiguration. |
The request's EngineConfiguration sets CoordinatorDpuSize, MaxConcurrentDpus, DefaultExecutorDpuSize, SparkProperties, or AdditionalConfigs. |
EngineVersion 'DuckDB' is not supported with SparkProperties in the query EngineConfiguration. (The message names the setting.) |
The request overrides the engine to engine version 3 and includes an EngineConfiguration. |
EngineVersion 'Athena engine version 3' is not supported with settings in the query EngineConfiguration. |
| The request turns on query result reuse. DuckDB doesn't support query result reuse. | Query Result Reuse is not supported for DuckDB. |
| The workgroup uses Apache Spark. | EngineVersion is not supported for this workgroup. |
EngineVersion is AUTO, or names an engine that doesn't exist or isn't available to your account. |
The selected engine version is not valid. |
EngineVersion names an engine other than Athena engine version 3 or DuckDB. |
EngineVersion '...' is not supported for StartQueryExecution. |
| DuckDB isn't available in the Region. | EngineVersion is not supported for StartQueryExecution. |
| The Athena service-linked role doesn't exist and your principal can't create it. | Error code SLR_CREATION_ACCESS_DENIED. See Athena service-linked role. |
If a workgroup has the subquery result cache turned on, a query that you run on DuckDB from that workgroup runs without the cache.