
PostgreSQL
Connect a PostgreSQL database to WasteNot to pull customer and transaction data directly from your database. Write custom SQL queries to define exactly what data feeds into your audiences.
Prerequisites
- A PostgreSQL database accessible over the internet
- A database user with read-only access to the tables you want to query
- The database host, port, name, and credentials
Your database must be reachable from the internet. SSH tunneling is not currently supported. If your database is behind a firewall, you will need to allowlist WasteNot's IP addresses — contact support@wastenot.io for the current list.
Connecting PostgreSQL
-
Add a new PostgreSQL data source
in WasteNot - Enter a Name
- Enter your connection details:
- Host — The hostname or IP address of your PostgreSQL server
- Port — The port PostgreSQL is listening on (default:
5432) - Database — The name of the database to connect to
- Username — A read-only database user
- Password — The password for the database user
We strongly recommend creating a dedicated read-only user for WasteNot rather than using an admin account. This limits access to only the data you want to sync.
- Click Connect
WasteNot will verify the connection.
Custom streams
Once connected, you can create streams to define what data WasteNot pulls from your database. Each stream is a SQL query that returns rows matching WasteNot's expected format.
See the Writing Custom Queries guide for full details on required columns and event types.
- Go to your PostgreSQL data source detail page
- Click New Stream
- Give the stream a name, select an event type, and enter your SQL query
- Check Enabled and click Save
WasteNot will run enabled streams on a schedule and sync the results automatically.
Frequently asked questions
The user needs SELECT privileges on the tables or views referenced in your stream queries.
Yes. Connecting to a read replica is a great way to avoid any performance impact on your primary database.
Common causes:
- The database is not reachable from the internet
- Credentials are incorrect or the user has been disabled
- A firewall is blocking the connection
- SSL configuration issues
Check with your data team, or reach out to support@wastenot.io for help.