Skip to main content
GuideServerConfigure and deploy Tabsdata servers on your machine.TutorialsConfigure data integration workflows within a running Tabsdata server.API ReferenceCLI ReferenceRelease Notes
Version: 2.3.0

MySQLCdcStreamSrc

class
class MySQLCdcStreamSrc(
tables: MySQLCdcTableNamesSpec,
start_from: MySQLCdcStartFromSpec,
columns_format: CdcColumnsFormatSpec = 'columns',
flatten_columns: bool = True,
src_cfg: CdcSrcCfgSpec | None = None,
)

Bases: StreamSrc

Categories: source

MySQL CDC stream source for @stream_publisher.

A streaming change-data-capture source: it emits one tableframe-batch per binlog flush across the tracked tables. The decorated @stream_publisher function receives the flushed batch as a list of frames and must NOT declare a ctx parameter.

Parameters​

parameter

Qualified schema.table names to track, each listed once.

parameter
start_fromMySQLCdcStartFromSpec (Literal['full'] | Literal['head', 'tail'] | GtidPosition | BinlogPosition | TimestampPosition)

Where to begin reading when no prior offset is persisted -- "full", the "head" / "tail" keyword, a GtidPosition, a BinlogPosition or a TimestampPosition. Required.

"full" first emits a full snapshot of every tracked table (rows marked as inserts, preceded by a LOAD control row per table) and then captures changes from the exact position of that snapshot.

To resynchronise a destination later, keep start_from="full" and reset the function's stage (tdk fn update --reset-stage): a fresh stage holds no stream state, so the stream starts again with the snapshot and emits the LOAD rows first. A stage reset with any other start_from restarts there and sends no LOAD row.

Beyond the privileges plain CDC needs, the connecting user must hold SELECT on every tracked table, since the snapshot reads the tables themselves rather than the binlog. The server must run with gtid_mode=ON, and the tracked tables must be InnoDB. With RELOAD, the snapshot is pinned to its exact binlog position by a global read lock held only while the position is read, not while the tables are scanned. Where that lock is refused, as managed services such as Amazon RDS and Aurora refuse it, the load takes no lock: it reads the changes committed while it ran and keeps only those the loaded rows do not already hold. A table without a primary key is not deduplicated that way, so such a change may then arrive twice.

parameter
columns_formatCdcColumnsFormatSpec (Literal['columns', 'struct', 'map'])

Layout for the new (and old, when present) columns payload on each change row -- "columns" (default), "struct" or "map".

parameter
flatten_columnsbool

When True (default), the new columns are inlined as top-level columns, so the downstream consumer sees an ordinary tabular row and columns_format then only affects the old-columns layout.

parameter
src_cfgCdcSrcCfgSpec | None (Mapping[Literal['tabsdata.cdc.poll.max_secs', 'mysql.cdc.logging_level', 'tabsdata.cdc.buffer.max_rows', 'tabsdata.cdc.buffer.max_bytes', 'tabsdata.cdc.buffer.max_secs', 'tabsdata.cdc.poll.idle_secs', 'tabsdata.cdc.max_large_text_length', 'tabsdata.cdc.fetch_size', 'tabsdata.cdc.chunk_size', 'tabsdata.cdc.initial_load.max_window_changes'], Any] | None)

Optional config mapping over the allowed CDC keys only -- buffer thresholds (the batch limits are the @stream_publisher batch settings) and polling cadence. The plugin falls back to its built-in defaults for missing keys. A byte threshold is measured on every change and slows ingestion down; bounding by rows is the cheap option and the preferred one. tabsdata.cdc.initial_load.max_window_changes bounds the changes a load without the global read lock reads and deduplicates after its snapshot (100,000 by default).