Messages
Reference for Sequin’s CDC message formats.
Message shapes
Sequin converts Postgres changes and rows into JSON messages that are delivered to your sinks.
When you setup a sink, you can choose whether the sink should receive change messages or row messages.
Change messages
A change message has this shape:
Change message fields
The current state of the row. Contains all column values.
For update operations, contains the previous values of changed fields. For insert and delete operations, this field is null.
The type of change that occurred. One of:
insert
: A new row was createdupdate
: An existing row was modifieddelete
: A row was deletedread
: A row was read during a backfill
Additional context about the change.
The Postgres schema containing the table (e.g., “public”).
The name of the table that was changed.
ISO 8601 timestamp when the change was committed to the database.
User-provided context about the transaction. Contains arbitrary JSON data set via pg_logical_emit_message
. See Transaction annotations for details.
Information about the sink receiving this message.
Unique identifier for the sink.
Name of the sink.
For update operations, record
contains the new values and changes
contains the previous values of only the fields that changed. For all other operations, changes
is null.
Row messages
A row message has this shape:
Row message fields
The current state of the row. Contains all column values.
Additional context about the row.
The Postgres schema containing the table (e.g., “public”).
The name of the table.
Information about the sink receiving this message.
Unique identifier for the sink.
Name of the sink.
For example:
At the moment, row messages only support insert
and update
operations. Soon, we’ll support delete
operations by adding a deleted
boolean column to the message.
Which message shape should you use?
Change messages are the best fit for most use cases. They contain more information about discrete changes to a row and include delete
operations.
If you only need the latest version of a row, and either don’t need deletes or soft-delete rows, consider using row messages. The nice part about row messages is that every message is the same shape, whether it’s an insert, update, or backfill (“read”) message.