Skip to main content

CDC pipeline configuration generator for Redpanda Connect

Project description

CDC Pipeline Generator

Generate Redpanda Connect pipeline configurations for Change Data Capture (CDC) workflows.

This library provides tools to generate CDC pipeline configurations from templates and service definitions, supporting both db-per-tenant (one database per customer) and db-shared (single database, multi-tenant) patterns.

Features

  • 🔄 Multi-tenant CDC patterns: Support for both db-per-tenant and db-shared architectures
  • 📝 Template-based generation: Jinja2 templates for flexible pipeline configuration
  • Validation: Schema validation for service configurations
  • 🛠️ CLI tools: Commands for managing services, server groups, and pipeline generation
  • 🐍 Python library: Use as a library in your own projects

Installation

Development (Local)

# Clone the repository
git clone https://github.com/carasent/cdc-pipeline-generator.git
cd cdc-pipeline-generator

# Install in editable mode
pip install -e .

Production (From GitHub)

pip install git+https://github.com/carasent/cdc-pipeline-generator.git@v1.0.0

Quick Start

⚠️ CLI-First Philosophy: All configuration is managed through cdc commands. Do not create or edit YAML files manually. The CLI is the sole entry point for managing configuration files.

1. Create Service

# Create a new service configuration
cdc manage-service --create adopus --server-group adopus

# Add tables to the service
cdc manage-service --service adopus --add-table Actor --primary-key actno
cdc manage-service --service adopus --add-table Fraver --primary-key fraverid

2. Configure Server Group

# Add server group (interactive prompts for server_group_type, server details, etc.)
cdc manage-server-group --add-group adopus

# Or update server group configuration from database inspection
cdc manage-server-group --update

3. Generate Pipelines

# Generate CDC pipelines for a service
cdc generate --service adopus --environment local

Architecture Patterns

db-per-tenant (One database per customer)

Use case: Each customer has a dedicated source database.

Example: AdOpus system with 26 customer databases.

Pipeline generation: Creates one source + sink pipeline per customer.

See: examples/db-per-tenant/

db-shared (Single database, multi-tenant)

Use case: All customers share one database, differentiated by customer_id.

Example: ASMA directory service with customer isolation via schema/column.

Pipeline generation: Creates one source + sink pipeline for all customers.

See: examples/db-shared/

Project Structure

cdc-pipeline-generator/
├── cdc_generator/           # Core library
│   ├── core/               # Pipeline generation logic
│   ├── helpers/            # Utility functions
│   ├── validators/         # Configuration validation
│   └── cli/                # Command-line interface
└── examples/               # Reference implementations
    ├── db-per-tenant/     # Multi-database pattern
    └── db-shared/         # Single-database pattern

Usage in Your Project

Option 1: Mounted Development

Best for: Active development, testing changes immediately.

# docker-compose.yml
services:
  dev:
    volumes:
      - .:/workspace
      - ../cdc-pipeline-generator:/generator:rw
    environment:
      PYTHONPATH: /generator:/workspace
# requirements-dev.txt
-e /generator

Option 2: Pinned Version

Best for: Production, stable deployments.

# requirements.txt
cdc-pipeline-generator @ git+https://github.com/carasent/cdc-pipeline-generator.git@v1.2.0

CLI Commands

All configuration is managed through cdc commands:

Service Management

# Create new service
cdc manage-service --create <service-name> --server-group <group-name>

# Add tables to service
cdc manage-service --service <name> --add-table <TableName> --primary-key <column>

# Inspect source database schema
cdc manage-service --service <name> --inspect --schema dbo

# Remove table from service
cdc manage-service --service <name> --remove-table <TableName>

Server Group Management

# Add new server group (interactive)
cdc manage-server-group --add-group <name>

# Update server group from database inspection
cdc manage-server-group --update

# Refresh database/table metadata
cdc manage-server-group --refresh

Pipeline Generation

# Generate CDC pipelines for service
cdc generate --service <name> --environment <env>

# Generate for all services
cdc generate --all --environment <env>

Validation

# Validate all configurations
cdc validate

Development

Setup

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black .
ruff check .

Docker Development Container

docker compose up -d
docker compose exec dev fish

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

MIT License - see LICENSE file for details.

Links

Example Projects

  • adopus-cdc-pipeline: db-per-tenant pattern with MSSQL source
  • asma-cdc-pipeline: db-shared pattern with PostgreSQL source

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cdc_pipeline_generator-0.1.0.tar.gz (99.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cdc_pipeline_generator-0.1.0-py3-none-any.whl (122.9 kB view details)

Uploaded Python 3

File details

Details for the file cdc_pipeline_generator-0.1.0.tar.gz.

File metadata

  • Download URL: cdc_pipeline_generator-0.1.0.tar.gz
  • Upload date:
  • Size: 99.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for cdc_pipeline_generator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3a648a4d32d9128addf75925731d181dbe1c93e9e79abd63f7c942bafc695200
MD5 5324e2639d44faa7e78cd9308015fc01
BLAKE2b-256 8ec5dfecc75e2e3d6897c8252d880e6bda9ac99531804134f7d0b503004fa19c

See more details on using hashes here.

File details

Details for the file cdc_pipeline_generator-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cdc_pipeline_generator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b7b0036474e234ecc54b8906d3380539c2a71bced5cfdec198d6b775ae5a6de7
MD5 2ba08dfd090c92d72faffd809b05d854
BLAKE2b-256 e4f3c76f7d50b2034030555b146eecb9f064c4f126102c182b04b5f78d199893

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page