

# 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](duckdb-migration-agent.md).
+ Use the engine version value exactly as `ListEngineVersions` returns it, for example `DuckDB` or `Athena engine version 3`. Values are case-sensitive, and `AUTO` is 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 `AWSServiceRoleForAmazonAthena` with your credentials. Your principal needs permission for `iam:CreateServiceLinkedRole`, or an administrator can create the role first with `aws iam create-service-linked-role --aws-service-name ops.athena.amazonaws.com`. For more information, see [Athena service-linked role](duckdb-permissions.md#athena-duckdb-permissions-service-linked-role).
+ Some workgroup and query settings prevent an override. For the list, see [Engine override restrictions and errors](#athena-duckdb-engine-override-restrictions).

## Run a query on DuckDB in the console
<a name="athena-duckdb-engine-override-console"></a>

**To run a query on DuckDB from an engine version 3 workgroup**

1. In the query editor, for **Workgroup**, choose an Athena engine version 3 workgroup.

1. Enter a query that uses DuckDB syntax.

1. Choose **Run on DuckDB**.

## Run a query on DuckDB with the AWS CLI
<a name="athena-duckdb-engine-override-cli"></a>

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.

```bash
aws athena start-query-execution \
  --query-string "SELECT 1" \
  --work-group {{your-engine-v3-workgroup}} \
  --engine-version DuckDB \
  --region {{your-region}}
```

To confirm which engine ran the query, run the following command. Replace {{query-execution-id}} with the ID that `start-query-execution` returned.

```bash
aws athena get-query-execution \
  --query-execution-id {{query-execution-id}} \
  --query QueryExecution.EngineVersion \
  --region {{your-region}}
```

The output shows the engine that ran the query in `EffectiveEngineVersion`:

```json
{
    "SelectedEngineVersion": "DuckDB",
    "EffectiveEngineVersion": "DuckDB"
}
```

## Engine override restrictions and errors
<a name="athena-duckdb-engine-override-restrictions"></a>

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.


**Engine override errors**  

| 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](duckdb-permissions.md#athena-duckdb-permissions-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.