# Redshift Reverse ETL Setup

Set up Redshift as your Reverse ETL source.

> \[!NOTE]
>
> If you already use dbt with a Git repository, you can use [Segment's dbt extension](/docs/segment/segment-app/extensions/dbt/) to centralize model management and versioning, reduce redundancies, and run CI checks that prevent breaking changes.

To set up Redshift with Reverse ETL:

1. Log in to [Amazon Redshift](https://aws.amazon.com/pm/redshift/) and choose the Redshift cluster you want to connect to Reverse ETL.
2. Follow the [networking instructions](/docs/segment/connections/storage/catalog/redshift/#networking) to configure the required network and security settings.
3. Run the following SQL commands to create a user named `segment`.

   ```sql
   -- Create a user named "segment" that Segment will use when connecting to your Redshift cluster.
   CREATE USER segment PASSWORD '<enter password here>';

   -- Allows the `segment` user to create new schemas on the specified database. (this is the name you chose when provisioning your cluster).
   GRANT CREATE ON DATABASE "<enter database name here>" TO "segment";

   -- Create Segment schema.
   CREATE SCHEMA __segment_reverse_etl;

   -- Allow user to use the Segment schema.
   GRANT USAGE ON SCHEMA __segment_reverse_etl TO segment;

   -- Grant all privileges on all current tables in the Segment schema.
   GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA __segment_reverse_etl TO segment;
   ```
4. Follow the steps in [Add a source](/docs/segment/connections/reverse-etl/setup#step-1-add-a-source) to finish adding Redshift as your source.

## Extra permissions

Give the `segment` user:

* Read permissions for any resources (databases, schemas, and tables) the query needs to access.
* Write permissions for the Segment managed schema (`__segment_reverse_etl`), which keeps track of changes to the query results.

## Troubleshooting

### Extraction failures: relation doesn't exist

If the query runs successfully in the Query Builder, but the sync fails with a `relation does not exist` error, confirm that the schema name is included before the database table name, and check that the schema name is correct:

```ts
SELECT id FROM <schema_name>.<table_name>
```

After you've successfully added your Redshift source, [add a model](/docs/segment/connections/reverse-etl/setup/#step-2-add-a-model) and follow the remaining steps in the Reverse ETL setup guide.
