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.

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:

  1. Log in to your Postgres account.
  2. Configure the correction network and security settings for your Postgres database.
  3. 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";
    
  4. Make sure the user has correct access permissions to the database.
  5. 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.

This page was last modified: 07 Nov 2023



Get started with Segment

Segment is the easiest way to integrate your websites & mobile apps data to over 300 analytics and growth tools.
or
Create free account