Redshift Reverse ETL Setup
Set up Redshift as your Reverse ETL source.
Redshift Reverse ETL sources support Segment's dbt extension
If you already use dbt with a Git repository, you can use Segment's dbt extension to centralize model management and versioning, reduce redundancies, and run CI checks that prevent breaking changes.
To set up Redshift with Reverse ETL:
-
Log in to Amazon Redshift and choose the Redshift cluster you want to connect to Reverse ETL.
-
Follow the networking instructions to configure the required network and security settings.
-
Run the following SQL commands to create a user named
segment.1-- Create a user named "segment" that Segment will use when connecting to your Redshift cluster.2CREATE USER segment PASSWORD '<enter password here>';34-- Allows the `segment` user to create new schemas on the specified database. (this is the name you chose when provisioning your cluster).5GRANT CREATE ON DATABASE "<enter database name here>" TO "segment";67-- Create Segment schema.8CREATE SCHEMA __segment_reverse_etl;910-- Allow user to use the Segment schema.11GRANT USAGE ON SCHEMA __segment_reverse_etl TO segment;1213-- Grant all privileges on all current tables in the Segment schema.14GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA __segment_reverse_etl TO segment; -
Follow the steps in Add a source to finish adding Redshift as your source.
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.
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:
SELECT id FROM <schema_name>.<table_name>
After you've successfully added your Redshift source, add a model and follow the remaining steps in the Reverse ETL setup guide.