Managed Ingestion and Change Data Capture
Use connectors (Airbyte, Fivetran, dlt) to load SaaS and database sources, and capture database changes with log-based CDC tools like Debezium.
Intermediate · about 5 hours · difficulty 3/5
Learn first: ETL vs ELT and Load Patterns, Transactional Databases as Sources
Writing a custom extractor for every source does not scale. Most teams use ingestion tools for common sources and save custom code for the unusual ones.
Managed and open source connectors
- Fivetran, Airbyte, Stitch and similar tools provide hundreds of connectors (Postgres, MySQL, Salesforce, Google Ads, Shopify) that land data in your warehouse with schema handling and incremental syncs.
- dlt (data load tool) is a Python library for writing your own pipelines with schema inference and incremental loading built in.
- Trade-offs: speed of setup vs cost (often per row synced) vs control.
Change data capture
Log-based CDC reads the database's transaction log and emits every insert, update and delete as an event.
- Debezium connects to PostgreSQL, MySQL, MongoDB and others and publishes changes to Kafka.
- Benefits: captures deletes, low load on the source, near real-time, ordered history.
- Downstream, you apply changes to the target with MERGE, or keep the full change history.
CDC event anatomy
Each event has the operation (create, update, delete), the before and after row images, the source position (LSN or binlog offset) and a timestamp. Ordering per key matters.
Operational concerns
- Initial snapshot followed by streaming changes.
- Replication slots on PostgreSQL can fill the source disk if the consumer stops; monitor them.
- Schema changes on the source need handling.
Pitfalls
- Adopting an expensive managed tool for one small source.
- A stalled CDC consumer silently growing the source database's WAL.
You are ready to move on when you can run Debezium against a Postgres container, see insert, update and delete events, and explain how you would apply them to a warehouse table.
Key concepts
- Connector-based ingestion
- Airbyte and Fivetran
- dlt for Python pipelines
- Log-based CDC
- Debezium
- Before and after images
- Replication slots and monitoring
Mini project
With Docker Compose, run PostgreSQL and Airbyte (or dlt) to sync a table into DuckDB or BigQuery. Then add a hard delete in the source and check whether your sync captured it; document the setting needed.
Check yourself
Why does log-based CDC capture deletes when a query on updated_at cannot?
Free resources
- Debezium documentation (Debezium)
- Airbyte documentation (Airbyte)
- dlt documentation (dltHub)