Clickhouse.build
Postgres to ClickHouse Migration Agent built with the help of AWS Pace program
Install / Use
/learn @ClickHouse/Clickhouse.buildREADME
clickhouse.build
Agentic PostgreSQL to ClickHouse migration tool for TypeScript projects.
This prototype was co-developed between AWS and ClickHouse. Read more in our blog post.
<img src="./.github/static/chbuild.png" alt="clickhouse.build cli tool">How Can You Try It?
clickhouse.build is a free, client-side CLI. You can install the CLI from this repo and try it out with your project.
If you don't already have a ClickHouse environment, you can sign up for a free ClickHouse Cloud trial with $300 in credits.
What Does It Do?
clickhouse.build assists with the process of migrating from PostgreSQL to ClickHouse:
- Scans your codebase to discover PostgreSQL analytical queries (aggregations, GROUP BY, window functions, etc.)
- Generates ClickPipe configuration for CDC or snapshot-based data replication
- Migrates application code by installing ClickHouse client and implementing patterns for query routing
The tool uses specialized AI agents that understand your code structure, database schema, and ORM patterns to generate production-ready migration code.
Prerequisites
Before using clickhouse.build, ensure you have:
- Python 3.13+ (uses latest Python features)
- uv package manager (installation guide)
- AWS credentials with access to Amazon Bedrock
- Claude Sonnet 4.5 enabled in your AWS Bedrock account
Installation
- Clone the repository:
git clone https://github.com/ClickHouse/clickhouse.build.git
cd clickhouse.build
- Set up AWS credentials:
cp .env.template .env
# Edit .env with your AWS credentials
Required environment variables:
AWS_ACCESS_KEY_ID- Your AWS access keyAWS_SECRET_ACCESS_KEY- Your AWS secret keyAWS_DEFAULT_REGION- AWS region (e.g., us-east-1)
- Install dependencies:
uv sync
Preparation
Before running the migration:
- Work on a branch - Never run migrations directly on main
- Create AGENTS.md - Add an AGENTS.md file to your repository to help
chbuildimprove its efficacy when understanding your codebase - Consider running
clickhouse.buildin a VM or container for additional safety precautions
Running
Display help and available commands:
uv run main.py --help
Quick Start: Full Migration
Run the complete migration workflow (recommended for first-time users):
uv run main.py migrate /path/to/your/repo --replication-mode cdc
This will:
- Scan for analytical queries
- Generate ClickPipe configuration
- Migrate application code
- Prompt for approval before making any changes
Individual Commands
Scanner Agent - Analyze a repository and find PostgreSQL analytical queries:
uv run main.py scanner [REPO_PATH]
Output: .chbuild/scanner/scan_TIMESTAMP.json with discovered queries
Data Migrator Agent - Generate ClickPipe configuration for data migration:
uv run main.py data-migrator [REPO_PATH] [--replication-mode cdc|snapshot|cdc_only]
Output: curl command with ClickPipe JSON configuration
Code Migrator Agent - Migrate application code:
uv run main.py code-migrator [REPO_PATH]
Output: Modified application files with ClickHouse integration
Migrate - Run the complete migration workflow (scanner → data-migrator → code-migrator):
uv run main.py migrate [REPO_PATH] [--replication-mode cdc|snapshot|cdc_only]
Options
--skip-credentials-check- Skip AWS credentials validation--yes/-y- Skip all confirmation prompts and approve all changes automatically (useful for CI/CD)--replication-mode- Set replication mode for data migration:cdc- Change Data Capture with initial snapshot + real-time syncsnapshot- One-time snapshot replication onlycdc_only- CDC without initial snapshot
Contributing
See CONTRIBUTING.md for development setup and guidelines.
We welcome feedback on the direction of this project as we continue to evolve it.
Related Skills
node-connect
352.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
