Oracle#

Oracle does not provide a dedicated Python library for Change Data Capture equivalent to MySQL binary log replication or MongoDB Change Streams. CDC on Oracle must be implemented using a combination of Oracle built-in features and a Python connector such as cx_Oracle (legacy) or oracledb (current).

Implementing with IProcessor#

To integrate Oracle CDC with this library, subclass IProcessor and implement the three abstract methods:

from core_cdc.processors.base import IProcessor
from core_cdc.base import EventType, Record

class OracleLogMinerProcessor(IProcessor):

    def get_events(self):
        # Query LogMiner or your audit table for new rows
        ...

    def get_event_type(self, event) -> EventType:
        operation = event["operation"]
        mapping = {"INSERT": EventType.INSERT,
                   "UPDATE": EventType.UPDATE,
                   "DELETE": EventType.DELETE}
        return mapping.get(operation, EventType.GLOBAL)

    def process_dml_event(self, event, **kwargs):
        return [Record(
            event_type=self.get_event_type(event),
            record=event["row_data"],
            ...
        )]

Further reading#