PostgreSQL (Source) Connector
Prerequisites
- A PostgreSQL database (12+)
- A user with
SELECTprivileges on the tables you want to sync - Network connectivity from Landed to your PostgreSQL server
Note: This guide is for the PostgreSQL source connector (reading data from PostgreSQL). For the PostgreSQL destination (writing data to PostgreSQL), see the PostgreSQL Destination guide.
Getting Your Credentials
Step 1: Create a Read-Only User (Recommended)
Connect to your PostgreSQL server and create a dedicated user for Landed:
CREATE USER landed_reader WITH PASSWORD 'your-secure-password';
GRANT CONNECT ON DATABASE mydb TO landed_reader;
GRANT USAGE ON SCHEMA public TO landed_reader;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO landed_reader;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO landed_reader;
The last command ensures the user automatically gets SELECT access on new tables created in the future.
Step 2: Allow Network Access
Ensure your PostgreSQL server accepts connections from Landed's IP addresses:
- Cloud-hosted databases (RDS, Cloud SQL, Azure): Add Landed's static IPs to the security group or authorized networks
- Self-hosted databases: Update
pg_hba.confto allow connections from Landed's IPs and ensure your firewall allows inbound connections on your PostgreSQL port - VPN/Private network: Set up a VPN tunnel or SSH bastion (contact Landed support)
Configuration in Landed
| Field | Value |
|---|---|
| Host | Hostname or IP of your PostgreSQL server (e.g., db.example.com) |
| Port | PostgreSQL port (default: 5432) |
| Database | Database name to connect to |
| Username | PostgreSQL username (e.g., landed_reader) |
| Password | Password for the PostgreSQL user |
| Tables to sync (optional) | Specific tables as schema.table (e.g., public.users). Leave empty to discover all accessible tables. |
Available Streams
The PostgreSQL connector dynamically discovers all tables in the public schema that the configured user can access. Each table becomes a stream.
Sync modes:
- Tables with a cursor field (e.g.,
updated_at,modified_at) sync incrementally - Tables without a cursor field sync via full refresh
You can configure per-table cursor fields in the connector settings to enable incremental sync for specific tables.
Common Issues
| Symptom | Cause | Fix |
|---|---|---|
could not connect to server | Network connectivity issue | Verify the host, port, and firewall rules. Add Landed's IPs to your security group. |
password authentication failed | Wrong credentials | Verify username and password |
permission denied for table | User lacks SELECT privilege | Run GRANT SELECT ON ALL TABLES IN SCHEMA public TO landed_reader; |
| No tables discovered | User lacks USAGE on schema | Run GRANT USAGE ON SCHEMA public TO landed_reader; |
database does not exist | Database name incorrect | Verify the database name exists on the server |
| Slow sync | Large tables without cursor field | Configure a cursor field (e.g., updated_at) for incremental sync |
Static IPs for Allowlisting
Add these IPs to your database security group or firewall:
- Production:
34.170.185.84,35.192.90.94 - Staging:
34.171.93.34
Security Recommendations
- Use a dedicated read-only user with minimal privileges
- Enable SSL/TLS for the database connection (
sslmode=require) - Restrict the user to SELECT on only the schemas/tables you need synced
- Use strong passwords and rotate them periodically
- Consider using
ALTER DEFAULT PRIVILEGESto auto-grant SELECT on future tables