> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://apidocs.polytomic.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://apidocs.polytomic.com/_mcp/server.

# AWS Athena

Supports:
* ✅ Models
* ✅ Model sync destination
* ✅ Bulk sync source
* ✅ Bulk sync destination


## Connection

### Configuration
<table>
<thead>
<tr>
<th>Name</th><th>Type</th><th>Description</th><th>Required</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>auth_mode</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">Authentication method<br/><br/>How to authenticate with AWS. Defaults to Access Key and Secret. Accepted values: `access_key_and_secret` <a href="#auth-mode-access-key-and-secret">↓</a>, `iam_role` <a href="#auth-mode-iam-role">↓</a></td>
<td><code>required</code></td>
</tr>
<tr>
<td><code>outputbucket</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">AWS S3 output bucket<br/><br/>A pre-existing bucket (folder optional) that AWS can use to store query results. ex: s3://polytomic-athena-results/customer-dataset</td>
<td><code>required</code></td>
</tr>
<tr>
<td><code>region</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">AWS region</td>
<td><code>required</code></td>
</tr>
</tbody>
</table>

<a id="auth-mode-access-key-and-secret"></a>

#### `auth_mode`

When `auth_mode` is `access_key_and_secret`:

<table>
<thead>
<tr>
<th>Name</th><th>Type</th><th>Description</th><th>Required</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>access_id</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">AWS access ID</td>
<td><code>optional</code></td>
</tr>
<tr>
<td><code>secret_access_key</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">AWS secret access key</td>
<td><code>optional</code></td>
</tr>
</tbody>
</table>

<table>
<thead>
<tr>
<th>Read-only property</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>aws_user</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">User ARN</td>
</tr>
</tbody>
</table>

```json
{
  "name": "AWS Athena connection",
  "type": "awsathena",
  "configuration": {
    "access_id": "AKIAIOSFODNN7EXAMPLE",
    "auth_mode": "access_key_and_secret",
    "outputbucket": "s3://polytomic-athena-results/customer-dataset",
    "region": "us-east-1",
    "secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
  }
}
```

<a id="auth-mode-iam-role"></a>

When `auth_mode` is `iam_role`:

<table>
<thead>
<tr>
<th>Name</th><th>Type</th><th>Description</th><th>Required</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>external_id</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">External ID for the IAM role</td>
<td><code>optional</code></td>
</tr>
<tr>
<td><code>iam_role_arn</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">IAM role ARN</td>
<td><code>required</code></td>
</tr>
<tr>
<td><code>tags</code></td>
<td><code>object</code></td>
<td style="vertical-align: top;">Tags<br/><br/>Additional tags to apply during role assumption</td>
<td><code>optional</code></td>
</tr>
</tbody>
</table>

```json
{
  "name": "AWS Athena connection",
  "type": "awsathena",
  "configuration": {
    "auth_mode": "iam_role",
    "external_id": "",
    "iam_role_arn": "",
    "outputbucket": "s3://polytomic-athena-results/customer-dataset",
    "region": "us-east-1",
    "tags": {}
  }
}
```



## Model Sync
### Source
#### Configuration
<table>
<thead>
<tr>
<th>Name</th><th>Type</th><th>Description</th><th>Required</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>catalog</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">Catalog</td>
<td><code>optional</code></td>
</tr>
<tr>
<td><code>database</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">Database</td>
<td><code>optional</code></td>
</tr>
<tr>
<td><code>query</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;"></td>
<td><code>optional</code></td>
</tr>
<tr>
<td><code>table</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">Table</td>
<td><code>optional</code></td>
</tr>
</tbody>
</table>


#### Example
```json
{
  ...
  "configuration": {
    "catalog": "awsdatacatalog",
    "database": "default",
    "query": "SELECT * FROM \"webdata\".\"impressions\"",
    "table": "users"
  }
}
```


### Target
AWS Athena connections may be used as the destination in a model sync.
#### All targets

##### Configuration
<table>
<thead>
<tr>
<th>Name</th><th>Type</th><th>Description</th><th>Required</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>created_column</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">'Created at' timestamp column</td>
<td><code>optional</code></td>
</tr>
<tr>
<td><code>preserve_table_on_resync</code></td>
<td><code>boolean</code></td>
<td style="vertical-align: top;">Preserve destination table when resyncing</td>
<td><code>optional</code></td>
</tr>
<tr>
<td><code>updated_column</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">'Updated at' timestamp column</td>
<td><code>optional</code></td>
</tr>
<tr>
<td><code>write_record_timestamps</code></td>
<td><code>boolean</code></td>
<td style="vertical-align: top;">Write row timestamp metadata</td>
<td><code>optional</code></td>
</tr>
</tbody>
</table>


##### Example
```json
{
  ...
  "target": {
      "configuration": {
        "created_column": "",
        "preserve_table_on_resync": false,
        "updated_column": "",
        "write_record_timestamps": false
    }
  }
}
```






### Target creation

AWS Athena connections may be used to create a new target for a model sync. The
following parameters are required to create a new target:

<table>
<thead>
<tr>
  <th>NAME</th>
  <th>DESCRIPTION</th>
  <th>ENUM</th>
</tr></thead>
<tbody>
<tr>
  <td>name</td>
  <td>Table name</td>
  <td>false</td>
</tr>

</tbody>
</table>




## Bulk Sync
### Source
AWS Athena connections may be used as a bulk sync source. No additional configuration options are required.

### Destination
#### Configuration
<table>
<thead>
<tr>
<th>Name</th><th>Type</th><th>Description</th><th>Required</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>advanced</code></td>
<td><code>object</code></td>
<td style="vertical-align: top;"></td>
<td><code>optional</code></td>
</tr>
<tr>
<td><code>mirror_schemas</code></td>
<td><code>boolean</code></td>
<td style="vertical-align: top;">Indicates whether schemas should be mirrored</td>
<td><code>optional</code></td>
</tr>
<tr>
<td><code>schema</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">Output schema to write to</td>
<td><code>optional</code></td>
</tr>
</tbody>
</table>


#### Example
```json
{
  ...
  "destination_configuration": {
    "advanced": {
        "table_prefix": "",
        "truncate_existing": false
    },
    "mirror_schemas": false,
    "schema": "public"
  }
}
```



## Type handling
### Destination types
|       POLYTOMIC TYPE        | AWS ATHENA TYPE |
|-----------------------------|-----------------|
| `array<>`                   | `string`        |
| `bigint`                    | `string`        |
| `boolean`                   | `boolean`       |
| `date`                      | `timestamp`     |
| `datetime`                  | `timestamp`     |
| `decimal(precision, scale)` | `string`        |
| `double`                    | `string`        |
| `int`                       | `string`        |
| `json`                      | `string`        |
| `jsonarray`                 | `string`        |
| `number`                    | `string`        |
| `object{}`                  | `string`        |
| `single`                    | `string`        |
| `smallint`                  | `string`        |
| `string`                    | `string`        |
| `time`                      | `timestamp`     |


### Source types
|       AWS ATHENA TYPE       |       POLYTOMIC TYPE        |
|-----------------------------|-----------------------------|
| `ARRAY`                     | `jsonarray`                 |
| `BIGINT`                    | `bigint`                    |
| `BINARY`                    | `string`                    |
| `CHAR`                      | `string`                    |
| `DATE`                      | `date`                      |
| `DECIMAL`                   | `number`                    |
| `DECIMAL(precision, scale)` | `decimal(precision, scale)` |
| `DOUBLE`                    | `number`                    |
| `FLOAT`                     | `number`                    |
| `INT`                       | `int`                       |
| `INTEGER`                   | `int`                       |
| `INTERVAL DAY TO SECOND`    | `string`                    |
| `INTERVAL YEAR TO MONTH`    | `string`                    |
| `IPADDRESS`                 | `string`                    |
| `JSON`                      | `json`                      |
| `MAP`                       | `json`                      |
| `REAL`                      | `number`                    |
| `SMALLINT`                  | `smallint`                  |
| `STRING`                    | `string`                    |
| `TIME`                      | `time`                      |
| `TIME WITH TIME ZONE`       | `time`                      |
| `TIMESTAMP`                 | `datetime`                  |
| `TIMESTAMP WITH TIME ZONE`  | `datetime`                  |
| `TINYINT`                   | `smallint`                  |
| `VARBINARY`                 | `string`                    |
| `VARCHAR`                   | `string`                    |