Skip to main content
PostgreSQL is a powerful, open-source relational database system with over 35 years of active development. Cargo’s native integration with PostgreSQL allows you to connect your database, create data models, and execute SQL operations directly in your workflows.
Supabase compatible — This integration works with Supabase, Neon, Railway, and any PostgreSQL-compatible database.

How to set up PostgreSQL

Prerequisites

Before connecting PostgreSQL to Cargo, ensure you have:
  • An active PostgreSQL server (version 9.6 or higher)
  • Network connectivity between Cargo and your PostgreSQL server
  • A database user with appropriate permissions
  • SSL enabled for secure connections (recommended)

Connection details

To set up the connection, provide the following details when creating the connector:
FieldDescription
HostYour PostgreSQL server hostname or IP address
PortDefault is 5432
DatabaseYour database name
UsernameThe Cargo service user (e.g., cargo_user)
PasswordThe user’s password
SSLEnable SSL/TLS encryption (recommended)
Use your PostgreSQL server’s hostname and credentials directly.
Host: db.example.com
Port: 5432
Database: myapp
Username: cargo_user
Password: ********
SSL: true

PostgreSQL actions

Once connected, you can use PostgreSQL in your workflows with the following actions:

Insert

Insert new records into a PostgreSQL table. Configuration
FieldDescription
SchemaThe PostgreSQL schema containing the target table
TableThe table to insert data into
MappingsMap columns to values using expressions
Use cases
  • Lead capture – Insert new leads from form submissions or enrichment workflows
  • Event logging – Record workflow events and outcomes
  • Data aggregation – Store computed results for reporting

Update

Update existing records in a PostgreSQL table based on a matching column. Configuration
FieldDescription
SchemaThe PostgreSQL schema containing the target table
TableThe table to update
Matching ColumnThe column to match records against
Matching ValueThe value to match (supports expressions)
MappingsMap columns to new values using expressions
Use cases
  • Data enrichment – Update records with enriched data from external sources
  • Status updates – Mark records as processed or update stages
  • Sync external changes – Keep PostgreSQL in sync with CRM or other systems

Upsert

Create new records or update existing ones based on a matching column. Uses PostgreSQL’s native ON CONFLICT clause for optimal performance. Configuration
FieldDescription
SchemaThe PostgreSQL schema containing the target table
TableThe table to upsert into
Matching ColumnThe column to match records against
Matching ValueThe value to match (supports expressions)
MappingsMap columns to values using expressions
Use cases
  • Data sync – Keep your database updated regardless of whether records exist
  • Idempotent operations – Safely retry operations without creating duplicates
  • Master data management – Maintain a single source of truth
The upsert action requires a unique constraint or primary key on the matching column.

Delete

Delete records from a PostgreSQL table based on a matching column. Configuration
FieldDescription
SchemaThe PostgreSQL schema containing the target table
TableThe table to delete from
Matching ColumnThe column to match records against
Matching ValueThe value to match (supports expressions)
Use cases
  • Data cleanup – Remove outdated or invalid records
  • GDPR compliance – Delete personal data on request
  • Workflow automation – Remove processed records from staging tables

PostgreSQL data models

Cargo allows you to create data models on top of your PostgreSQL data that can be used to trigger Plays and power workflows.

Creating PostgreSQL data models

To create a PostgreSQL data model:
  1. Navigate to Data Models in Cargo
  2. Click Create data model
  3. Select PostgreSQL as the source
  4. Configure the following fields:
FieldDescription
NameChoose a descriptive name for your model
SlugSet a unique identifier that cannot be changed once created
SchemaSelect the PostgreSQL schema containing your data
TableSelect the table or view to model
ID ColumnThe column containing unique record identifiers
Title ColumnThe column to display as the record title
Cursor Column(Optional) Column for incremental syncing (date or number)

Using PostgreSQL data models

Once created, your PostgreSQL data model can be used to:
  • Trigger Plays – Start automated workflows when data changes
  • Power enrichment – Use PostgreSQL data to enrich records in workflows
  • Create segments – Filter and target specific records from your data

Database user setup

For best security practices, create a dedicated user with only the necessary permissions:
-- Create a dedicated user
CREATE USER cargo_user WITH PASSWORD 'your_secure_password';

-- Grant connect privilege
GRANT CONNECT ON DATABASE your_database TO cargo_user;

-- Grant usage on schema
GRANT USAGE ON SCHEMA public TO cargo_user;

-- Grant permissions on specific tables
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE your_table TO cargo_user;

-- Or grant on all tables in a schema
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO cargo_user;

-- For future tables created in the schema
ALTER DEFAULT PRIVILEGES IN SCHEMA public
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO cargo_user;

Network configuration

If you restrict access to your PostgreSQL server, add these Cargo IP addresses to your firewall or security group:
  • 3.251.34.134
  • 54.220.135.99
  • 79.125.105.52
In Supabase, network restrictions are configured in Project Settings → Database → Network restrictions.

Security

  • All PostgreSQL connections can be encrypted using SSL/TLS
  • Credentials are securely stored and encrypted at rest
  • Cargo uses dedicated user credentials with minimal required permissions
  • We recommend enabling SSL and using strong passwords