How to sync data from PostgreSQL into Knock
Sync PostgreSQL models to Knock users, tenants, objects, audiences, and subscriptions.
Knock connects to PostgreSQL with a database user and password. Every environment in your account can sync from the warehouse once it's connected.
Add the warehouse
#To add or edit a warehouse, you need the owner or admin role, or a custom permission group that's allowed to manage integrations.
- Go to Platform > Sources.
- Under Connect a new source, click PostgreSQL.
- Enter a Name and a Key. The key can't be changed later.
- Click Add warehouse. Knock opens the warehouse's Details tab.
Connect PostgreSQL
#-
Create a read-only database user for Knock and grant it read access to the tables you'll sync:
-
On the warehouse's Details tab, fill in the connection and click Save connection:
-
Click Test connection.
Knock doesn't show the password after you save it. To change the connection later, enter the password again. If your database isn't reachable from the internet, connect through an SSH tunnel.
Once the connection works, create a sync to start syncing data into Knock. Knock reads a TIMESTAMP column mapped to a user's created_at as UTC. If the values are stored in another timezone, see timestamps for how to convert them in your query.