Skip to content

PostgreSQL (Destination)

Loads data into PostgreSQL tables.

Configuration

yaml
warehouse:
  kind: postgres
  database: analytics
  schema: raw
FieldDefaultDescription
database(required)PostgreSQL database name
schemapublicTarget schema

CLI

bash
skippr connect warehouse postgres \
  --database analytics \
  --schema public

Or run without flags to be prompted interactively.

FlagDescription
--databasePostgreSQL database name
--schemaTarget schema (default: public)

Config output

Running connect warehouse postgres writes the following to skippr.yaml:

yaml
warehouse:
  kind: postgres
  database: analytics
  schema: public

Authentication

Authentication uses environment variables. Credentials are never stored in the config file.

VariableDefaultDescription
POSTGRES_HOSTlocalhostPostgreSQL host
POSTGRES_PORT5432PostgreSQL port
POSTGRES_USERDatabase user
POSTGRES_PASSWORDDatabase password
POSTGRES_DATABASEDatabase name (overrides config file)
POSTGRES_SCHEMApublicTarget schema (overrides config file)
POSTGRES_SSLMODESSL mode (e.g. disable, require, prefer)

Example

bash
export POSTGRES_HOST="localhost"
export POSTGRES_USER="myuser"
export POSTGRES_PASSWORD="mypassword"

Required permissions

The database user needs:

  • CREATE on the target database (for silver/gold schema creation)
  • USAGE and CREATE on the target schema (for loading data)
  • Ability to create tables and insert data

Troubleshooting

SymptomFix
connection refusedCheck POSTGRES_HOST and POSTGRES_PORT are correct and the server is running
password authentication failedVerify POSTGRES_USER and POSTGRES_PASSWORD
database "..." does not existCreate the database first, or check the database field in config
SSL errorsSet POSTGRES_SSLMODE=disable for local development

CDC

PostgreSQL destination supports CDC with staging-table MERGE semantics. Skippr automatically creates _skippr_order_token columns and tombstone tables.

See CDC Destinations -- PostgreSQL for details.