A Python SDK for building RisingWave data pipelines with PostgreSQL CDC and multiple sink destinations
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
RisingWave Pipeline SDK
A Python SDK for building RisingWave data pipelines with PostgreSQL CDC, automatic table discovery, and multiple sink destinations.
Features
- PostgreSQL CDC Integration: Complete Change Data Capture support with automatic schema discovery
- Flexible Table Selection: Pattern-based, interactive, or programmatic table selection
- Multiple Sink Support: Iceberg, S3, and PostgreSQL destinations
- Advanced CDC Configuration: SSL, backfilling, publication management, and more
- SQL Generation: Automatically generates optimized RisingWave SQL statements
Installation
# Using uv (recommended)
uv add risingwave-pipeline-sdk
# Using pip
pip install risingwave-pipeline-sdk
Quick Start
from risingwave_pipeline_sdk import (
RisingWaveClient,
PipelineBuilder,
PostgreSQLConfig,
TableSelector
)
# Connect to RisingWave
client = RisingWaveClient("postgresql://root@localhost:4566/dev")
# Configure PostgreSQL CDC
config = PostgreSQLConfig(
hostname="localhost",
port=5432,
username="postgres",
password="secret",
database="mydb",
auto_schema_change=True
)
# Create pipeline with table selection
builder = PipelineBuilder(client)
result = builder.create_postgresql_pipeline(
config=config,
table_selector=TableSelector(include_patterns=["users", "orders"])
)
print(f"Created CDC source with {len(result['selected_tables'])} tables")
Table Discovery and Selection
Discover Available Tables
# Discover all available tables
available_tables = builder.discover_postgresql_tables(config)
for table in available_tables:
print(f"{table.qualified_name} - {table.row_count} rows")
Flexible Table Selection
# Select specific tables
TableSelector(specific_tables=["users", "orders", "products"])
# Pattern-based selection
TableSelector(
include_patterns=["user_*", "order_*"],
exclude_patterns=["*_temp", "*_backup"]
)
# Include all tables except specific ones
TableSelector(
include_all=True,
exclude_patterns=["temp_*", "backup_*"]
)
PostgreSQL CDC Configuration
config = PostgreSQLConfig(
# Connection details
hostname="localhost",
port=5432,
username="postgres",
password="secret",
database="mydb",
schema_name="public",
# CDC settings
auto_schema_change=True,
publication_name="rw_publication",
slot_name="rw_slot",
# SSL configuration
ssl_mode="require",
ssl_root_cert="/path/to/ca.pem",
# Performance tuning
backfill_parallelism="8",
backfill_num_rows_per_split="100000",
backfill_as_even_splits=True
)
Sink Destinations
Iceberg Data Lake
from risingwave_pipeline_sdk import IcebergConfig
iceberg_config = IcebergConfig(
sink_name="analytics_lake",
warehouse_path="s3://my-warehouse/",
database_name="analytics",
table_name="events",
catalog_type="storage",
# S3 configuration
s3_region="us-east-1",
s3_access_key="your-access-key",
s3_secret_key="your-secret-key",
# Data type
data_type="append-only",
force_append_only=True
)
# Create sink
builder.create_sink(iceberg_config, ["events", "users"])
S3 Data Archive
from risingwave_pipeline_sdk import S3Config
s3_config = S3Config(
sink_name="data_archive",
bucket_name="my-data-bucket",
path="raw-data/",
region_name="us-east-1",
access_key_id="your-access-key",
secret_access_key="your-secret-key",
# Format configuration
format_type="PLAIN",
encode_type="PARQUET"
)
builder.create_s3_sink(s3_config, ["users", "orders"])
PostgreSQL Analytics Database
from risingwave_pipeline_sdk import PostgreSQLSinkConfig
analytics_config = PostgreSQLSinkConfig(
sink_name="analytics_db",
hostname="analytics.example.com",
port=5432,
username="analytics_user",
password="password",
database="analytics",
postgres_schema="real_time"
)
# Create sink with custom transformations
custom_queries = {
"users": "SELECT id, name, email, created_at FROM users WHERE active = true",
"orders": "SELECT * FROM orders WHERE status != 'cancelled'"
}
builder.create_postgresql_sink(
analytics_config,
["users", "orders"],
select_queries=custom_queries
)
Complete Pipeline Example
# 1. Set up CDC source
cdc_result = builder.create_postgresql_pipeline(
config=postgres_config,
table_selector=TableSelector(include_patterns=["user_*", "order_*"])
)
selected_tables = [t.qualified_name for t in cdc_result['selected_tables']]
# 2. Create multiple sinks
builder.create_s3_sink(s3_config, selected_tables) # Data lake
builder.create_postgresql_sink(analytics_config, selected_tables) # Analytics
builder.create_sink(iceberg_config, selected_tables) # Iceberg warehouse
Examples
The examples/ directory contains complete working examples:
postgres_cdc_iceberg_pipeline.py- End-to-end CDC to Iceberg pipelineinteractive_discovery.py- Interactive table discovery and selectionenv_config_example.py- Environment variable based configuration
Environment Configuration
Configure using environment variables for production deployments:
# RisingWave connection
export RW_HOST=localhost
export RW_PORT=4566
export RW_USER=root
export RW_DATABASE=dev
# PostgreSQL CDC source
export PG_HOST=localhost
export PG_PORT=5432
export PG_USER=postgres
export PG_PASSWORD=secret
export PG_DATABASE=mydb
# Table selection
export TABLE_PATTERNS="users,orders,products"
Development
# Clone and set up development environment
git clone https://github.com/risingwavelabs/risingwave-pipeline-sdk.git
cd risingwave-pipeline-sdk
# Install with development dependencies
uv venv
source .venv/bin/activate
uv pip install -e .[dev]
# Run tests
pytest
# Format code
ruff format .
Requirements
- Python ≥ 3.10
- RisingWave instance (local or cloud)
- PostgreSQL with CDC enabled
- Required Python packages:
psycopg[binary],pydantic
License
Apache 2.0 License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file risingwave_pipeline_sdk-0.1.0.tar.gz.
File metadata
- Download URL: risingwave_pipeline_sdk-0.1.0.tar.gz
- Upload date:
- Size: 75.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d519c6a8a50896405e3f0e3aea24cb337ecfbe4854d2d7da9942bae52a1c49ac
|
|
| MD5 |
c391776cc93bd1138b11bb2ba4cfdec4
|
|
| BLAKE2b-256 |
7ff851eb94a2c74837048656639addba89278c068fd1728326183dc2063e21c6
|
Provenance
The following attestation bundles were made for risingwave_pipeline_sdk-0.1.0.tar.gz:
Publisher:
publish.yml on risingwavelabs/risingwave-pipeline-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
risingwave_pipeline_sdk-0.1.0.tar.gz -
Subject digest:
d519c6a8a50896405e3f0e3aea24cb337ecfbe4854d2d7da9942bae52a1c49ac - Sigstore transparency entry: 437316085
- Sigstore integration time:
-
Permalink:
risingwavelabs/risingwave-pipeline-sdk@53d9da923315d6df5c43bbd7a58a818584073f30 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/risingwavelabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@53d9da923315d6df5c43bbd7a58a818584073f30 -
Trigger Event:
release
-
Statement type:
File details
Details for the file risingwave_pipeline_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: risingwave_pipeline_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e735e3045ae57df8b833893a39076743766920000f0227c5e42069a0ff3151d3
|
|
| MD5 |
e6436b2aca499102f629e1a89f1365d6
|
|
| BLAKE2b-256 |
86fd02fbde8018de577333d163950c10f70850b476431707b8ab81415932fecd
|
Provenance
The following attestation bundles were made for risingwave_pipeline_sdk-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on risingwavelabs/risingwave-pipeline-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
risingwave_pipeline_sdk-0.1.0-py3-none-any.whl -
Subject digest:
e735e3045ae57df8b833893a39076743766920000f0227c5e42069a0ff3151d3 - Sigstore transparency entry: 437316120
- Sigstore integration time:
-
Permalink:
risingwavelabs/risingwave-pipeline-sdk@53d9da923315d6df5c43bbd7a58a818584073f30 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/risingwavelabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@53d9da923315d6df5c43bbd7a58a818584073f30 -
Trigger Event:
release
-
Statement type: