Skip to main content

PostgreSQL (Source) Connector

Prerequisites

  • A PostgreSQL database (12+)
  • A user with SELECT privileges 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

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:

  1. Cloud-hosted databases (RDS, Cloud SQL, Azure): Add Landed's static IPs to the security group or authorized networks
  2. Self-hosted databases: Update pg_hba.conf to allow connections from Landed's IPs and ensure your firewall allows inbound connections on your PostgreSQL port
  3. VPN/Private network: Set up a VPN tunnel or SSH bastion (contact Landed support)

Configuration in Landed

FieldValue
HostHostname or IP of your PostgreSQL server (e.g., db.example.com)
PortPostgreSQL port (default: 5432)
DatabaseDatabase name to connect to
UsernamePostgreSQL username (e.g., landed_reader)
PasswordPassword 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

SymptomCauseFix
could not connect to serverNetwork connectivity issueVerify the host, port, and firewall rules. Add Landed's IPs to your security group.
password authentication failedWrong credentialsVerify username and password
permission denied for tableUser lacks SELECT privilegeRun GRANT SELECT ON ALL TABLES IN SCHEMA public TO landed_reader;
No tables discoveredUser lacks USAGE on schemaRun GRANT USAGE ON SCHEMA public TO landed_reader;
database does not existDatabase name incorrectVerify the database name exists on the server
Slow syncLarge tables without cursor fieldConfigure 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 PRIVILEGES to auto-grant SELECT on future tables