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
Name | Description | Required | Default |
---|---|---|---|
url | Connection string for the PostgreSQL database. Example: postgres://username:[email protected]:5432/database | Yes |
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:
- Create a unique role and user for the platform. You may replace
conduit_user
andconduit_role
with whatever you prefer.
CREATE USER conduit_user ENCRYPTED PASSWORD 'very-secure-password';
CREATE ROLE conduit_role;
- Grant the
CREATE
privilege to the role and grant the role to the user. Replacemy_database
andmy_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
Name | Description | Required | Default |
---|---|---|---|
table | The 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" }} |