Interfaces#
Base classes and types for CDC (Change Data Capture) operations. This module defines the core EventType enum and Record class used across all CDC processors to represent database change events.
- class core_cdc.base.EventType(*values)[source]#
Bases:
StrEnumEnumeration of CDC event types.
- GLOBAL = 'GLOBAL'#
- DDL_STATEMENT = 'QUERY'#
- INSERT = 'INSERT'#
- UPDATE = 'UPDATE'#
- DELETE = 'DELETE'#
- static _generate_next_value_(name, start, count, last_values)#
Return the lower-cased version of the member name.
- class core_cdc.base.Record(event_type: EventType, record: Dict, service: str, schema_name: str, table_name: str, primary_key: Tuple[Any, ...] | str, global_id: str | None = None, transaction_id: str | None = None, event_timestamp: int | None = None, source: str | None = None, position: int | None = None)[source]#
Bases:
objectIt provides a wrapper or common object useful for integration across services that needs to handle data replication via Change Data Capture producers and consumers…
- Parameters:
event_type – It specifies the operation that generated the event.
record – The record (like a record/row in a database).
service – The service from where the record came.
schema_name – Schema from where the record was retrieved.
table_name – Table from where the record was retrieved.
primary_key – Attributes to use to identify a record as unique.
global_id – Unique identifier (e.g. Global Transaction Identifier in MySQL).
transaction_id – Identifier for the transaction (e.g. xid in MySQL).
event_timestamp – Timestamp when the record was generated.
source – The source from where the record was retrieved (e.g. binlog file name).
position – Record position in the source.
- to_json() Dict[source]#
It returns the JSON version of the record required to be streamed…
- Returns:
A dictionary that follows the below structure:
Example:
{ "global_id": "", "transaction_id": "", "event_timestamp": 1653685384, "event_type": "INSERT | UPDATE | DELETE", "service": "service-name", "source": "binlog.000001 | FileName | Something", "position": 8077, "primary_key": "(str | tuple)", "schema_name": "schema_name", "table_name": "table_name", "record": { ... // This is an example... "id": "000-1", "category": "Marketing", "price": 100.0, ... } }