Postgres Reverse ETL Setup
Set up Postgres as your Reverse ETL source.
At a high level, when you set up Postgres for Reverse ETL, the configured user/role needs read permissions for any resources (databases, schemas, tables) the query needs to access. Segment keeps track of changes to your query results with a managed schema (__SEGMENT_REVERSE_ETL
), which requires the configured user to allow write permissions for that schema.
Postgres Reverse ETL sources support Segment's dbt extension
If you have an existing dbt account with a Git repository, you can use Segment’s dbt extension to centralize model management and versioning, reduce redundancies, and run CI checks to prevent breaking changes.
Segment supports the following Postgres database providers:
- Heroku
- RDS
Segment only supports these Postgres database providers. Postgres databases from other providers aren’t guaranteed to work. For questions or concerns about Segment-supported Postgres providers, contact Segment Support.
Set up guide
To set up Postgres with Reverse ETL:
- Log in to your Postgres account.
- Configure the correction network and security settings for your Postgres database.
- If you’re using RDS Postgres, follow this guide.
- Make sure the following IP addresses can access the database.
-
Run the SQL commands below to create a user named
segment
.-- create a user named "segment" that Segment will use when connecting to your Postgres 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";
- Make sure the user has correct access permissions to the database.
- Follow the steps listed in the Add a source section to finish adding Postgres as a source.
Extra permissions
-
Give the
segment
user read permissions for any resources (databases, schemas, tables) the query needs to access. -
Give the
segment
user write permissions for the Segment managed schema (__SEGMENT_REVERSE_ETL
), which keeps track of changes to the query results.
After you’ve successfully added your Postgres source, add a model and follow the rest of the steps in the Reverse ETL setup guide.
This page was last modified: 10 Jun 2024
Need support?
Questions? Problems? Need more info? Contact Segment Support for assistance!