/marketing-growth:connect-cdc-postgresfrom marketing-growth
Streams change data capture from PostgreSQL to Redpanda or Kafka using Redpanda Connect's postgres_cdc input. Covers WAL configuration, logical replication slots, publications, initial snapshot, and Redpanda Enterprise features.
Ships in marketing-growth. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
The postgres_cdc input in Redpanda Connect streams change data capture (CDC) from a PostgreSQL database into Redpanda or any Kafka-compatible topic. It uses PostgreSQL's logical replication protocol (pgoutput plugin), reads the Write-Ahead Log (WAL), and optionally snapshots all existing rows before switching to live replication. Introduced in version 4.39.0. The legacy name pg_stream is deprecated.
This is an Enterprise feature — a Redpanda Enterprise license is required. The connector creates and manages a logical replication slot and a publication automatically, but both can be pre-created manually.
-- 1. Verify or set wal_level (requires server restart if changed)
ALTER SYSTEM SET wal_level = logical;
-- Check current value:
SHOW wal_level; -- must return 'logical'
-- 2. Create a dedicated replication user
CREATE USER cdc_user WITH REPLICATION LOGIN PASSWORD 'secret';
GRANT CONNECT ON DATABASE mydb TO cdc_user;
GRANT SELECT ON TABLE public.orders, public.customers TO cdc_user;
-- 3. (Optional) Pre-create the publication to avoid needing CREATE PUBLICATION privilege
-- Connector uses the pattern: pglog_stream_<slot_name>
CREATE PUBLICATION pglog_stream_my_slot FOR TABLE public.orders, public.customers;
-- 4. (Optional) Pre-create the replication slot
SELECT pg_create_logical_replication_slot('my_slot', 'pgoutput');
# postgres-cdc-pipeline.yaml
input:
label: "pg_cdc"
postgres_cdc:
dsn: postgres://cdc_user:secret@localhost:5432/mydb?sslmode=disable
schema: public
tables:
- orders
- customers
slot_name: my_slot
stream_snapshot: true # back-fill existing rows first
snapshot_batch_size: 5000 # rows per query during snapshot
max_parallel_snapshot_tables: 2 # snapshot both tables simultaneously
checkpoint_limit: 1024
heartbeat_interval: 1h # prevents slot lag on quiet tables
include_transaction_markers: false
batching:
count: 100
period: 1s
pipeline:
processors:
# Route each event to a topic named after the source table
- mapping: |
meta topic = "pg.cdc." + metadata("table")
output:
kafka_franz:
seed_brokers:
- localhost:9092
topic: ${! metadata("topic") }
key: ${! json("id").string() }
Tip: When writing to Redpanda, the native
redpandaoutput is the idiomatic choice — it handles seed broker discovery and authentication more ergonomically thankafka_franz.kafka_franzis fully valid for both Redpanda and generic Kafka targets.
# Self-managed Redpanda Connect binary
redpanda-connect run postgres-cdc-pipeline.yaml
# Via rpk (if installed)
rpk connect run postgres-cdc-pipeline.yaml
# Docker
docker run --rm \
-v $(pwd)/postgres-cdc-pipeline.yaml:/pipeline.yaml \
docker.redpanda.com/redpandadata/connect:latest \
run /pipeline.yaml
Every message has these metadata fields (set via metadata() in Bloblang):
| Metadata key | Value |
|---|---|
table | Table name (unquoted), e.g. orders |
operation | read, insert, update, delete, begin, commit |
lsn | WAL log sequence number string; not set (absent) for snapshot read rows |
commit_ts_ms | Transaction commit timestamp (Unix milliseconds); set on insert/update/delete. Not set for snapshot read rows (since 4.98.0) |
before | Pre-change row state for update and delete, in Benthos common schema format. For updates the contents depend on the table's REPLICA IDENTITY: the default identity carries only key columns, REPLICA IDENTITY FULL carries all columns (since 4.99.0) |
schema | Column schema in Benthos common format; set on read, insert, update, delete messages. Use with parquet_encode: { schema_metadata: schema } |
Example payload for an insert into orders:
{
"id": 42,
"customer_id": 7,
"amount": 99.99,
"status": "pending"
}
When stream_snapshot: true the connector:
EXPORT_SNAPSHOT)operation: read (no lsn — LSN is nil for snapshot rows)slot_name slotTables being snapshot must have a primary key — the connector uses the primary key to parallelize and paginate the scan.
pg_replication_slots.confirmed_flush_lsn and pg_current_wal_lsn() - confirmed_flush_lsn.heartbeat_interval (default 1h) writes a logical message periodically via pg_logical_emit_message to keep the LSN moving. Set to 0s to disable.UPDATE/DELETE where REPLICA IDENTITY is not FULL, unchanged TOAST columns are not included in the WAL. Set unchanged_toast_value to a sentinel string to distinguish "unchanged" from "null".pg_replication_slots.confirmed_flush_lsn and resumes from that LSN. Snapshot is skipped if the slot already exists.slot_name must match [A-Za-z0-9_]+ — alphanumeric and underscores only.pglog_stream_<slot_name>. Pre-create it with exactly that name to avoid needing CREATE PUBLICATION privilege.Set signal_table_name to have the connector watch a dedicated signal table for control signals. Rows inserted into that table are both acted on as signals and forwarded downstream as ordinary CDC messages. This gives you an in-band, transactionally-ordered channel to send instructions to a running pipeline by writing a row to PostgreSQL.
The signal table must live in the schema set by schema, and it must not also appear in tables — the connector implicitly adds it to the publication and excludes it from snapshot scans, so listing it in both places is rejected at startup. It needs three columns (startup validation checks the column names only; a wrong column type is caught later, at runtime on the first signal row):
id — any type representable as a string (SERIAL, BIGSERIAL, UUID, VARCHAR, …)type — a string type; the signal type (see below)data — TEXT; a JSON object carrying the signal's parametersCREATE TABLE <schema>.<signal_table_name> (
id SERIAL PRIMARY KEY,
type VARCHAR(32),
data TEXT
);
input:
postgres_cdc:
dsn: postgres://cdc_user:secret@localhost:5432/mydb?sslmode=disable
schema: public
tables:
- orders
slot_name: my_slot
signal_table_name: rpcn_signal_table
Signal rows are published like any other insert (operation: insert, table: <signal_table_name>). To keep them out of downstream processing, filter on the table metadata field:
pipeline:
processors:
- mapping: |
root = if @table == "rpcn_signal_table" { deleted() } else { this }
Supported signal types are recognized from the row's type column; an unrecognized type is forwarded downstream but only logged as a warning. The log signal is currently recognized — its data must be a JSON object with a message key, whose value is written to the connector's log output. The recognized set may grow across releases; confirm it against the generated postgres_cdc reference (or rpk connect create postgres_cdc) rather than assuming this list is exhaustive.
INSERT INTO <schema>.<signal_table_name> (type, data)
VALUES ('log', '{"message": "Signal message"}');
postgres_cdc is itself a Redpanda Connect Enterprise connector (blocked after the 30-day trial without a license). Beyond the connector, the Redpanda topics that receive CDC events unlock additional Enterprise differentiators — each requires a valid license on the cluster:
iceberg_enabled=true plus per-topic redpanda.iceberg.mode (key_value, value_schema_id_prefix, value_schema_latest, disabled), and tune redpanda.iceberg.target.lag.ms, redpanda.iceberg.partition.spec, redpanda.iceberg.delete, redpanda.iceberg.invalid.record.action (drop/dlq_table). Tiered Storage is a prerequisite.redpanda.remote.write/redpanda.remote.read (cluster master switch cloud_storage_enabled) and retention.local.target.ms/.bytes.enable_schema_id_validation (none/redpanda/compat) and per-topic redpanda.value.schema.id.validation + redpanda.value.subject.name.strategy (applies when events are serialized in the Schema Registry wire format).See enterprise-sink-features.md for every nested config key, default, and license-expiration behavior.
postgres_cdc config field — type, default, required status, and description grounded in source.wal_level, server parameters, replication user, publications, slots, RDS/Aurora, and IAM auth.redpanda.iceberg.*, iceberg_*, redpanda.remote.*, enable_schema_id_validation, redpanda.value.schema.id.validation), defaults, and license-expiration behavior. All require a Redpanda Enterprise license.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
cdc, postgresql-replication, redpanda-connect, kafka, wal, logical-replication
npx claudepluginhub skillmds/skillmd --plugin marketing-growth30 skills in this plugin
/adsOperate professional paid advertising across Google, Meta, YouTube, LinkedIn, TikTok, Microsoft, Apple, Amazon, Reddit, Pinterest, Snapchat, and X. Use for account intake, source-grounded audits, strategy, budget and measurement planning, creative production, experiments, reporting, monitoring, and explicitly approved campaign changes. Also trigger on PPC, paid social, retail media, attribution, tracking, landing pages, cross-platform conversion totals, negative keywords or search terms, beta-feature scoring, stale platform claims, API-token or credential setup, campaign deletion, and safe Claude Ads installation or uninstall./ads-appleAudit Apple Ads measurement, AdServices and AdAttributionKit, campaign and keyword structure, Search Match, App Store placements, custom product pages, bidding, budgets, MMP reconciliation, and policy. Use for Apple Ads, Apple Search Ads, App Store ads, Search Match, custom product pages, AdServices, or Apple app-install campaigns./ads-metaAudit Meta Ads measurement, Pixel and Conversions API, attribution, Facebook and Instagram creative, audiences, placements, automation, budgets, account structure, and policy. Use for Meta Ads, Facebook Ads, Instagram Ads, Advantage+, Pixel, CAPI, Events Manager, creative fatigue, or Meta campaign optimization./ads-xAudit X Ads measurement, X Pixel and Conversions API, campaign objectives, keyword and conversation targeting, creative, budgets, brand safety, app measurement, and reporting. Use for X Ads, Twitter Ads, promoted posts, X Pixel, X Conversions API, conversation targeting, or paid campaigns on X./apexApex - Senior Product Marketing Manager & CSO specializing in B2B/B2C IT Products & SaaS. Use for Go-To-Market strategies, product positioning, growth funnels, IT product copywriting, SEO content strategy, or marketing analytics. Also responds to 'Apex' or /apex command./brandBrand voice, visual identity, messaging frameworks, asset management, brand consistency. Activate for branded content, tone of voice, marketing assets, brand compliance, style guides.Other plugins' skills for the same job