> 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.

# Redshift

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>database</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">Database</td>
<td><code>required</code></td>
</tr>
<tr>
<td><code>hostname</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">Hostname</td>
<td><code>required</code></td>
</tr>
<tr>
<td><code>password</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">Password</td>
<td><code>required</code></td>
</tr>
<tr>
<td><code>port</code></td>
<td><code>integer</code></td>
<td style="vertical-align: top;">Port</td>
<td><code>required</code></td>
</tr>
<tr>
<td><code>s3_bucket_name</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">S3 bucket name (destinations only)<br/><br/>Name of bucket used for staging data load files</td>
<td><code>optional</code></td>
</tr>
<tr>
<td><code>s3_bucket_region</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">S3 bucket region (destinations only)<br/><br/>Region of bucket. Note: must match region of redshift server</td>
<td><code>optional</code></td>
</tr>
<tr>
<td><code>ssh</code></td>
<td><code>boolean</code></td>
<td style="vertical-align: top;">Connect over SSH tunnel <a href="#ssh-true">↓</a></td>
<td><code>optional</code></td>
</tr>
<tr>
<td><code>use_bulk_sync_staging_schema</code></td>
<td><code>boolean</code></td>
<td style="vertical-align: top;">Use custom bulk sync staging schema <a href="#use-bulk-sync-staging-schema-true">↓</a></td>
<td><code>optional</code></td>
</tr>
<tr>
<td><code>username</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">Username</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>aws_access_key_id</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">AWS access key ID (destinations only)<br/><br/>Access Key ID with read/write access to a bucket. More info: https://docs.polytomic.com/docs/redshift</td>
<td><code>optional</code></td>
</tr>
<tr>
<td><code>aws_secret_access_key</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">AWS secret access key (destinations only)</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": "Redshift connection",
  "type": "redshift",
  "configuration": {
    "auth_mode": "access_key_and_secret",
    "aws_access_key_id": "AKIAIOSFODNN7EXAMPLE",
    "aws_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
    "database": "mydb",
    "hostname": "mycluster.us-west-2.redshift.amazonaws.com",
    "password": "password",
    "port": 5439,
    "s3_bucket_name": "my-bucket",
    "s3_bucket_region": "us-west-2",
    "ssh": false,
    "use_bulk_sync_staging_schema": false,
    "username": "redshift_user"
  }
}
```

<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>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>
</tbody>
</table>

<table>
<thead>
<tr>
<th>Read-only property</th><th>Type</th><th>Description</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>
</tr>
</tbody>
</table>

```json
{
  "name": "Redshift connection",
  "type": "redshift",
  "configuration": {
    "auth_mode": "iam_role",
    "database": "mydb",
    "hostname": "mycluster.us-west-2.redshift.amazonaws.com",
    "iam_role_arn": "",
    "password": "password",
    "port": 5439,
    "s3_bucket_name": "my-bucket",
    "s3_bucket_region": "us-west-2",
    "ssh": false,
    "use_bulk_sync_staging_schema": false,
    "username": "redshift_user"
  }
}
```

<a id="ssh-true"></a>

#### `ssh`

When `ssh` is `true`:

<table>
<thead>
<tr>
<th>Name</th><th>Type</th><th>Description</th><th>Required</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>ssh_host</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">SSH host</td>
<td><code>required</code></td>
</tr>
<tr>
<td><code>ssh_port</code></td>
<td><code>integer</code></td>
<td style="vertical-align: top;">SSH port</td>
<td><code>required</code></td>
</tr>
<tr>
<td><code>ssh_private_key</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">Private key</td>
<td><code>required</code></td>
</tr>
<tr>
<td><code>ssh_user</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">SSH user</td>
<td><code>required</code></td>
</tr>
</tbody>
</table>

```json
{
  "name": "Redshift connection",
  "type": "redshift",
  "configuration": {
    "auth_mode": "access_key_and_secret",
    "aws_access_key_id": "AKIAIOSFODNN7EXAMPLE",
    "aws_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
    "database": "mydb",
    "hostname": "mycluster.us-west-2.redshift.amazonaws.com",
    "password": "password",
    "port": 5439,
    "s3_bucket_name": "my-bucket",
    "s3_bucket_region": "us-west-2",
    "ssh": true,
    "ssh_host": "bastion.example.com",
    "ssh_port": 22,
    "ssh_private_key": "",
    "ssh_user": "root",
    "use_bulk_sync_staging_schema": false,
    "username": "redshift_user"
  }
}
```

<a id="use-bulk-sync-staging-schema-true"></a>

#### `use_bulk_sync_staging_schema`

When `use_bulk_sync_staging_schema` is `true`:

<table>
<thead>
<tr>
<th>Name</th><th>Type</th><th>Description</th><th>Required</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>bulk_sync_staging_schema</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">Staging schema name</td>
<td><code>required</code></td>
</tr>
</tbody>
</table>

```json
{
  "name": "Redshift connection",
  "type": "redshift",
  "configuration": {
    "auth_mode": "access_key_and_secret",
    "aws_access_key_id": "AKIAIOSFODNN7EXAMPLE",
    "aws_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
    "bulk_sync_staging_schema": "",
    "database": "mydb",
    "hostname": "mycluster.us-west-2.redshift.amazonaws.com",
    "password": "password",
    "port": 5439,
    "s3_bucket_name": "my-bucket",
    "s3_bucket_region": "us-west-2",
    "ssh": false,
    "use_bulk_sync_staging_schema": true,
    "username": "redshift_user"
  }
}
```



## 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>query</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;"></td>
<td><code>optional</code></td>
</tr>
<tr>
<td><code>schema</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">Schema</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>
<tr>
<td><code>view</code></td>
<td><code>string</code></td>
<td style="vertical-align: top;">View</td>
<td><code>optional</code></td>
</tr>
</tbody>
</table>


#### Example
```json
{
  ...
  "configuration": {
    "query": "SELECT * FROM sampledata.users",
    "schema": "sampledata",
    "table": "users",
    "view": "active_users"
  }
}
```


### Target
Redshift 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

Redshift 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
Redshift 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;">Mirror schemas</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</td>
<td><code>optional</code></td>
</tr>
</tbody>
</table>


#### Example
```json
{
  ...
  "destination_configuration": {
    "advanced": {
        "empty_strings_null": true,
        "hard_deletes": false,
        "initial_execution": "rebuild",
        "table_prefix": "",
        "truncate_existing": false
    },
    "mirror_schemas": false,
    "schema": "schema"
  }
}
```



## Type handling
### Destination types
|       POLYTOMIC TYPE        |       REDSHIFT TYPE        |
|-----------------------------|----------------------------|
| `array<>`                   | `SUPER`                    |
| `bigint`                    | `BIGINT`                   |
| `boolean`                   | `BOOL`                     |
| `date`                      | `DATE`                     |
| `datetime`                  | `TIMESTAMP`                |
| `decimal(precision, scale)` | `NUMERIC(precision,scale)` |
| `double`                    | `FLOAT8`                   |
| `int`                       | `INTEGER`                  |
| `json`                      | `SUPER`                    |
| `jsonarray`                 | `SUPER`                    |
| `number`                    | `NUMERIC(38,18)`           |
| `object{}`                  | `SUPER`                    |
| `single`                    | `FLOAT4`                   |
| `smallint`                  | `SMALLINT`                 |
| `string`                    | `VARCHAR(MAX)`             |
| `time`                      | `VARCHAR(255)`             |


### Source types
|         REDSHIFT TYPE         |       POLYTOMIC TYPE        |
|-------------------------------|-----------------------------|
| `4000`                        | `json`                      |
| `BIGINT`                      | `bigint`                    |
| `BOOL`                        | `boolean`                   |
| `BOOLEAN`                     | `boolean`                   |
| `BPCHAR`                      | `string`                    |
| `CHAR`                        | `string`                    |
| `CHARACTER`                   | `string`                    |
| `CHARACTER VARYING`           | `string`                    |
| `DATE`                        | `date`                      |
| `DECIMAL`                     | `number`                    |
| `DECIMAL(precision, scale)`   | `decimal(precision, scale)` |
| `DOUBLE PRECISION`            | `double`                    |
| `FLOAT`                       | `double`                    |
| `FLOAT4`                      | `single`                    |
| `FLOAT8`                      | `double`                    |
| `INT`                         | `int`                       |
| `INT2`                        | `smallint`                  |
| `INT4`                        | `int`                       |
| `INT8`                        | `bigint`                    |
| `INTEGER`                     | `int`                       |
| `NCHAR`                       | `string`                    |
| `NUMERIC`                     | `number`                    |
| `NUMERIC(precision, scale)`   | `decimal(precision, scale)` |
| `NVARCHAR`                    | `string`                    |
| `REAL`                        | `single`                    |
| `SMALLINT`                    | `smallint`                  |
| `STRING`                      | `string`                    |
| `TEXT`                        | `string`                    |
| `TIME`                        | `time`                      |
| `TIME WITH TIME ZONE`         | `time`                      |
| `TIME WITHOUT TIME ZONE`      | `time`                      |
| `TIMESTAMP`                   | `datetime`                  |
| `TIMESTAMP WITH TIME ZONE`    | `datetime_tz`               |
| `TIMESTAMP WITHOUT TIME ZONE` | `datetime`                  |
| `TIMESTAMPTZ`                 | `datetime_tz`               |
| `TIMETZ`                      | `time`                      |
| `VARCHAR`                     | `string`                    |