Skip to main content

PostgreSQL

The Conduit Platform by default supports PostgreSQL as a source and a destination.

The PostgreSQL destination can connect to and produce records to one or more tables.

Required Configurations

NameDescriptionRequiredDefault
urlConnection string for the PostgreSQL database. Example: postgres://username:[email protected]:5432/databaseYes

Looking for something else? See advanced configurations.

Upsert Behavior

The destination connector takes a record.Record and parses it into a valid SQL query and is designed to handle different payloads and keys. Because of this, each record is individually parsed and upserted.

If the target table already contains a record with the same key, the Destination will upsert with its current received values. Because Keys must be unique, this can overwrite and thus potentially lose data, so keys should be assigned correctly from the Source.

If there is no key, the record will be simply appended.

User privileges

The PostgreSQL user you provide to the Conduit Platform must have privileges to CREATE to generate tables in the database. To do this, you may use psql in Terminal to connect to the database and run the following queries:

  1. Create a unique role and user for the platform. You may replace conduit_user and conduit_role with whatever you prefer.
CREATE USER conduit_user ENCRYPTED PASSWORD 'very-secure-password';
CREATE ROLE conduit_role;
  1. Grant the CREATE privilege to the role and grant the role to the user. Replace my_database and my_table with your respective database and table names.
GRANT CREATE ON DATABASE my_database TO conduit_role;
GRANT conduit_role TO conduit_user;

Advanced Configurations

NameDescriptionRequiredDefault
tableThe table the destination connector should write to, by default. Example: orders This value can include a Go template, which will be executed for each record to determine the table. By default, the table is set to the value of the opencdc.collection metadata field.No{{ index .Metadata "opencdc.collection" }}