clickhouse-migrations
Simple file-based migrations for clickhouse
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has low install friction, carries no known vulnerabilities, and solves a real problem for ClickHouse users. It is the most actively maintained migration tool for ClickHouse in Python and supports features (multi-statement files, cluster awareness) that alternatives lack. MIT licensing adds no restrictions.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a running ClickHouse server accessible at the specified host and port (default 9000 for clickhouse-driver, 8123 for clickhouse-connect).
- Low friction: pure Python wheel with a single runtime dependency (clickhouse-driver).
- Actively maintained as of 2026-07-08 with recent releases.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution with minimal attribution requirements.
last release 2026-07-08 (37 days) · last repo commit 2026-07-08 · 38 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 74,838 downloads/mo, #14,784 on PyPI
Alternatives
Verify before relying
pip install clickhouse-migrations
# Create migrations/001_init.sql with SQL statements
clickhouse-migrations --db-host localhost --db-name mydb --migrations-dir ./migrations
# Or in Python:
from clickhouse_migrations.clickhouse_cluster import ClickhouseCluster
cluster = ClickhouseCluster(db_host="localhost")
cluster.migrate(db_name="test", migration_path="./migrations")- Whether the tool handles concurrent migration attempts across cluster nodes without race conditions.
- Performance characteristics when applying many migrations to large ClickHouse clusters.
- Compatibility guarantees with specific ClickHouse server versions.
What it is and what it does
clickhouse-migrations is a file-based schema migration tool for ClickHouse that reads versioned SQL files from a directory and applies them in order, tracking which migrations have been run. It supports both the native clickhouse-driver (TCP) and the official clickhouse-connect (HTTP) driver, and is aware of ClickHouse cluster deployments, keeping migration state consistent across all nodes.
You write plain `.sql` files named like `001_init.sql`, `002_add_column.sql`, etc., each containing one or more SQL statements. The tool applies them via CLI commands, a Python API, or CI/CD integration. It can show migration status without applying anything, supports dry-run inspection, and offers optional rollback via paired `.down.sql` files. Multi-statement files and cluster-aware execution distinguish it from simpler alternatives.
Use it for
- Manage schema changes in production ClickHouse clusters without manual coordination across nodes.
- Automate database initialization and schema updates in Docker or Kubernetes deployments via CLI.
- Track and inspect pending vs. applied migrations before running them in CI/CD pipelines.
- Roll back individual migrations using explicit hand-written down files when needed.
- Apply complex multi-statement migrations (e.g., table creation plus column additions) atomically.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has low install friction, carries no known vulnerabilities, and solves a real problem for ClickHouse users. It is the most actively maintained migration tool for ClickHouse in Python and supports features (multi-statement files, cluster awareness) that alternatives lack. MIT licensing adds no restrictions.
Install
clickhouse-migrations on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency (clickhouse-driver). Actively maintained as of 2026-07-08 with recent releases.
Requires a running ClickHouse server accessible at the specified host and port (default 9000 for clickhouse-driver, 8123 for clickhouse-connect).
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal attribution requirements.
Quickstart
pip install clickhouse-migrations
# Create migrations/001_init.sql with SQL statements
clickhouse-migrations --db-host localhost --db-name mydb --migrations-dir ./migrations
# Or in Python:
from clickhouse_migrations.clickhouse_cluster import ClickhouseCluster
cluster = ClickhouseCluster(db_host="localhost")
cluster.migrate(db_name="test", migration_path="./migrations")
Verify before relying
- Whether the tool handles concurrent migration attempts across cluster nodes without race conditions.
- Performance characteristics when applying many migrations to large ClickHouse clusters.
- Compatibility guarantees with specific ClickHouse server versions.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release <4,>=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packageclickhouse-driver |
| Maintenance | Actively maintained 37 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 74,838 / month, #14,784 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9 |
Evidence: clickhouse_migrations-0.13.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “clickhouse schema migrations”
- clickhouse-migrationsApplies versioned SQL migrations to ClickHouse databases from the…
- clickhouse-connectA Python database driver for ClickHouse that supports DataFrames,…
- django-clickhouse-backendA Django database backend that lets you use Django ORM to query and…
Give your agent the search over MCP, or paste the wish link into any chat.
More Database packages
psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.
Python client library for connecting to and executing commands against Redis key-value stores, supporting both synchronous and asynchronous operations.
Install it if your application needs to interact with Redis; the only prerequisite is a running Redis server instance.
YDB Python SDK is the official client library for connecting to and querying YDB databases from Python applications.
Install it if you need to connect Python applications to YDB databases.
Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.
sqlparse tokenizes SQL text into a tree of statements, clauses, and expressions, and provides functions to split scripts, format queries, and inspect parsed tokens without validating dialect or syntax.
Install it if you need to manipulate, format, or analyze SQL text programmatically.
Provides base adapter protocols and shared functionality that database adapters use to integrate with dbt-core, handling connections, dialect translation, relation caching, and core interface management.
See also clickhouse-sqlalchemy · clickhouse-connect · schemachange · alembic · django-clickhouse-backend · django-clickhouse · openupgradelib · yoyo-migrations · mongodb-migrations · chdb