PostgreSQL reverse ETL source

Send data from PostgreSQL to your entire stack.

PostgreSQL is an enterprise-grade, open source database management system. Many companies use PostgreSQL as a low-cost data warehousing solution to deliver efficient analytics and user insights.

RudderStack supports PostgreSQL as a source from which you can ingest data and route it to your desired downstream destinations.

Granting permissions

RudderStack requires you to grant certain user permissions on your PostgreSQL warehouse to successfully access data from it.

Run the SQL queries listed in the following sections in the exact order to grant these permissions:

Step 1: Creating the user

  • Create a new user RUDDER with a password <strong_unique_password> in PostgreSQL:
CREATE USER RUDDER WITH PASSWORD '<strong_unique_password>';

Step 2: Creating the RudderStack schema and granting permissions

  1. Create a dedicated schema _rudderstack.
CREATE SCHEMA "_rudderstack";
warning
The _rudderstack schema is used by RudderStack for storing the state of each data sync. This name should not be changed.
  1. Grant full access to the schema _rudderstack for the user RUDDER.
GRANT ALL ON SCHEMA "_rudderstack" TO RUDDER;
  1. Grant full access to all objects in the schema _rudderstack for the user RUDDER.
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA "_rudderstack" TO RUDDER;

Step 3: Granting permissions on your schema and table

  1. To let the user RUDDER look up objects within the schema <YOUR_SCHEMA>, run the command below.
GRANT USAGE ON SCHEMA "<YOUR_SCHEMA>" TO RUDDER;
  1. Grant access to the user RUDDER to read data from the required table/view:
GRANT SELECT ON TABLE "<YOUR_SCHEMA>"."<YOUR_TABLE>" TO RUDDER;

Replace <YOUR_SCHEMA> and <YOUR_TABLE> with the exact names of your PostgreSQL schema and table, respectively.

Optional commands

warning
Run the following commands only if you’re okay with RudderStack being able to access the data in all current or future tables residing within your specified schema.
  • To allow the user RUDDER read the data from all the tables in the schema <YOUR_SCHEMA>:
GRANT SELECT ON ALL TABLES IN SCHEMA "<YOUR_SCHEMA>" TO RUDDER;
  • To allow the user RUDDER to read data from all future tables created by the user creator in your schema:
ALTER DEFAULT PRIVILEGES for user creator IN SCHEMA "<YOUR_SCHEMA>" GRANT SELECT ON TABLES TO RUDDER;

Replace <YOUR_SCHEMA> with the exact name of your PostgreSQL schema.

Setting up the PostgreSQL source in RudderStack

To set up PostgreSQL as a source in RudderStack, follow these steps:

Naming the source

  1. Log into your RudderStack dashboard.
  2. From the left navigation bar, go to Source > New Source > Reverse ETL. Then, select PostgreSQL:
Select Reverse ETL source in RudderStack
  1. Assign a name to your source.

Configuring the connection credentials

  1. Choose the relevant option from Table or Model to use the source to sync data from either a warehouse table or a model.
Add destination in RudderStack
info
If you have already configured a destination in RudderStack, choose the Use Existing Destinations option which will take you to the Schema tab in the source settings. To add a new destination from scratch, select the Create New Destination option which will take you to the destination configuration page.

Specifying the data to import

While connecting a destination to your Reverse ETL source, you can use the default JSON mapping or the Visual Data Mapping feature.

info

Based on the option(Table/Model) you chose while setting up the Reverse ETL source, follow the relevant guide for detailed steps:

IPs to be allowlisted

info
This section is applicable if you’re setting up your PostgreSQL source on a VPN or VPC and you want to enable network access to RudderStack.

To enable network access to RudderStack, allowlist the following RudderStack IPs depending on your region and RudderStack Cloud plan:

Plan
Region
US
EU
Free, Starter, and Growth
  • 23.20.96.9
  • 18.214.35.254
  • 52.38.160.231
  • 34.211.241.254
  • 18.198.90.215
  • 18.196.167.201
Enterprise
  • 34.198.90.241
  • 54.147.40.62
  • 3.216.35.97
  • 100.20.239.77
  • 44.236.60.231
  • 3.66.99.198
  • 3.64.201.167
info
All the outbound traffic is routed through these RudderStack IPs.

FAQ

What are the SSL mode options when setting up the PostgreSQL source in RudderStack?

When setting up a PostgreSQL source, RudderStack provides the following two SSL options:

  • disable: SSL mode is disabled when you select this option. Use it in cases where security is not an issue and you don’t want any encryption overhead.
  • require: When you select this option, your data is encrypted and sent to RudderStack. Use it in cases where security is important and you can deal with the resulting encryption overhead.

What do the three validations under Verifying Credentials imply?

When setting up a Reverse ETL source, once you proceed after entering the connection credentials, you will see the following three validations under the Verifying Credentials option:

Validations

These options are explained below:

  • Verifying Connection: This option indicates that RudderStack is trying to connect to the warehouse with the information specified in the connection credentials.
warning
If this option gives an error, it means that one or more fields specified in the connection credentials are incorrect. Verify your credentials in this case.
  • Able to List Schema: This option checks if RudderStack is able to fetch all schema details using the provided credentials.
  • Able to Access RudderStack Schema: This option implies that RudderStack is able to access the _rudderstack schema you have created by successfully running all commands in the User Permissions section.
warning
If this option gives an error, verify if you have successfully created the _rudderstack schema and given RudderStack the required permissions to access it. For more information, refer to the User Permissions sections.

Is SSH tunneling supported for PostgreSQL when using it as a reverse ETL source?

Currently, RudderStack does not support SSH tunneling for PostgreSQL as a reverse ETL source.



Questions? Contact us by email or on Slack