Skip to main content

Claude/ChatGPT Prompt to Design a Postgres-to-Warehouse CDC Pipeline

Change data capture from Postgres to a warehouse via Debezium and Kafka: replication setup, schema evolution, backfill, dead-letter queue, and lag monitoring.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt frames the model as a data engineer who has run change data capture in production and asks for real configs and a clear flow, not a high-level overview. You supply [warehouse], [tables], and [lag_tolerance], and it returns Postgres replication setup, a Debezium connector config, schema-evolution handling, a backfill strategy, a dead-letter queue, and lag monitoring.

The structure works because CDC fails at its boundaries, and the prompt names them. [tables] scopes the publication and the connector's table filter so you only capture what matters. [lag_tolerance] drives the monitoring thresholds -- alerts fire against your stated SLA, not an arbitrary number. The backfill deliverable specifically reconciles history without double-counting live changes, and the dead-letter queue catches poison events instead of stalling the stream. By making slot hygiene and lag alerts first-class deliverables, the prompt addresses the failures that quietly fill disks or break connectors instead of treating them as afterthoughts.

When to use it

  • You're replicating Postgres into a warehouse and want CDC done with production-grade configs.
  • You need wal_level, a replication slot, and a publication set up correctly for specific tables.
  • A schema change broke a connector before and you want evolution handling written in.
  • You need a backfill that reconciles history without double-counting live rows.
  • You want a dead-letter queue for un-deserializable or poison events.
  • You need lag and connector-failure alerts tied to a concrete tolerance, not a guess.
  • You need the initial snapshot mode chosen so a large backfill doesn't block live capture.

Example output

You get the Postgres configuration (wal_level, slot, publication), the Debezium connector config with snapshot mode and table filter, the schema-evolution and backfill notes, the dead-letter-queue setup, and an ASCII flow diagram of the whole pipeline. It reads like a runbook with real config blocks you can paste and adjust, not a conceptual diagram you still have to translate into working connectors.

Pro tips

  • List exactly the [tables] in scope (orders, payments, refunds) so the publication and connector filter stay tight.
  • Set [lag_tolerance] to your real SLA (under 60 seconds) so the monitoring thresholds match what downstream actually needs.
  • Make [warehouse] specific (e.g. Snowflake via Snowpipe) because the load and merge mechanics differ by destination.
  • Watch the replication slot size for a week before trusting it unattended -- an un-cleaned slot can fill the disk silently.
  • Ask the model to detail what happens when a column is added, dropped, or retyped so a schema change can't break the connector unnoticed.
  • Confirm the backfill plan reconciles against live changes; double-counting is the classic CDC backfill bug.
  • Pick a snapshot mode in the Debezium config that fits your [tables] size so the initial snapshot doesn't stall live capture.

Frequently Asked Questions

Does this prompt produce real Postgres and Debezium configs?
Yes. It is instructed to return real configs and a clear flow, not a high-level overview, including wal_level, the replication slot, the publication, and the Debezium connector config with snapshot mode and table filter, plus an ASCII pipeline diagram.
How does it avoid double-counting during backfill?
The backfill deliverable specifically asks for a strategy that reconciles history without double-counting live changes. This is the classic CDC pitfall, so verify the generated plan handles the overlap between the historical snapshot and the live change stream before you run it.
Will it handle schema changes on the source tables?
It includes schema-evolution handling for when a column is added, dropped, or retyped. A silent connector break on a schema change is a common CDC failure, so the prompt makes the model spell out how each change type is absorbed rather than leaving it implicit.
How is replication lag monitored?
Monitoring is tied to your `[lag_tolerance]`, so alerts fire against your stated SLA rather than an arbitrary threshold. It also covers connector failures. Watch the replication slot size over the first week, since an un-cleaned slot can fill the disk before lag alerts even trigger.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Data Engineering & ETL Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support