Skip to main content
Version: 1.8.0

Db2CdcTrigger

class Db2CdcTrigger(
conn: Db2CdcConn,
tables: QualifiedTablesSpec,
start_from: Db2CdcStartFromSpec,
cdc_format: CdcFormat = CdcFormat(values_format='columns', flatten_values=True),
buffer_max_rows: int = 10000,
buffer_max_bytes: int | None = None,
buffer_max_secs: int = 60,
trigger_max_rows: int | None = None,
trigger_max_bytes: int | None = None,
trigger_max_secs: int = 60,
poll_interval_seconds: int = 1,
blocking_timeout_seconds: int = 1,
start: datetime | None = None,
end: datetime | None = None,
)

Bases: CdcTrigger

Categories: trigger

A CdcTrigger that captures changes from a Db2 database using SQL Replication.

This trigger connects to a Db2 server, reads change data capture events (inserts, updates, deletes) on specified tables via SQL Replication, and stages them.

Initialize a Db2CdcTrigger instance.

Parameters

parameter
conn

The Db2 CDC connection configuration.

parameter
tables

Qualified table names to track for changes.

parameter
start_from

The position to start reading changes from (commit sequence, per-table commit sequences, timestamp, or relative position).

parameter
cdc_format

The output format specification for CDC data.

parameter
buffer_max_rows

Maximum rows in memory before flushing to the working directory.

parameter
buffer_max_bytes

Maximum bytes in memory before flushing to the working directory.

parameter
buffer_max_secs

Maximum seconds before flushing memory data to the working directory.

parameter
trigger_max_rows

Maximum total rows before staging from working directory to the stage location.

parameter
trigger_max_bytes

Maximum total bytes before staging from working directory to the stage location.

parameter
trigger_max_secs

Maximum seconds before staging from working directory to the stage location.

parameter
poll_interval_seconds

Interval in seconds between polling for new changes.

parameter
blocking_timeout_seconds

Timeout in seconds for blocking reads from the replication stream.

parameter
start

Optional datetime for the trigger to start working.

parameter
end

Optional datetime for the trigger to stop working.

Properties

property
blocking_timeout_secondsint

Timeout in seconds for blocking reads from the replication stream.

property
buffer_max_bytesint | None

Maximum bytes in memory before flushing to the working directory.

property
buffer_max_rowsint

Maximum rows in memory before flushing to the working directory.

property
buffer_max_secsint

Maximum seconds before flushing memory data to the working directory.

property
cdc_formatCdcFormat

Output format specification for CDC data.

property
connConn

CDC connection configuration.

property
enddatetime | None

property
outdict[int, str] | None

Mapping of table indices to qualified table names.

property
poll_interval_secondsint

Interval in seconds between polling for new changes.

property
startdatetime | None

property
start_fromDb2CdcStartFromSpec | None

Position to start reading changes from.

property
tableslist[str] | None

Qualified table names being tracked for changes.

property
trigger_max_bytesint | None

Maximum total bytes before staging from working directory to the stage location.

property
trigger_max_rowsint | None

Maximum total rows before staging from working directory to the stage location.

property
trigger_max_secsint

Maximum seconds before staging from working directory to the stage location.

Methods

collect_tables
def collect_tables(
session: Any,
cdc_format: CdcFormat = CdcFormat(values_format='columns', flatten_values=True),
) -> dict[str, TrackedTable]