Reference for Sequin’s transforms. Use transforms to modify the structure of your messages before they are sent to sinks.
record
, changes
, action
, or metadata
.
You can optionally add additional keys to traverse the message structure. For example, record.id
will extract the id
field from the record
object.
Some examples:
Path | Description | Example Value |
---|---|---|
record | The full record object | {"id": 123, "address": {"city": "Anytown"}} |
record.id | A specific field from the record | 123 |
record.address.city | A nested field from the record | "Anytown" |
record.address.city
will extract the city
field from the address
JSONB column in the record
object.
transform/4
function:
transform/4
function receives each key from the message object as an argument:
record
: The full record objectchanges
: The changes objectaction
: The action type (insert, update, delete)metadata
: The metadata objecttransform/4
function and may not define any
other functions.record
and changes
use string keys for access (ie. record["id"]
).In contrast, the metadata
object uses atom keys (ie. metadata.table_schema
).This is because the record
and changes
objects are dynamically typed––they depend on the schema of the connected Postgres table. Metadata, on the other hand, is statically typed and will always have the same keys.See the Elixir Map docs for more information on the difference between string and atom keys.