Run migrations:
cd simple && \
clickhouse-client --query 'DROP DATABASE IF EXISTS alembic' && \
clickhouse-client --allow_deprecated_database_ordinary 1 --query 'CREATE DATABASE alembic Engine = Ordinary' && \
alembic upgrade head
In cluster case client (driver) connects to single node, but DDL is executed on all nodes in cluster if commands in migration contain clickhouse_cluster
or on_cluster
arguments.
- Set up clickhouse cluster locally with docker-compose for example.
- Tune
CLICKHOUSE_DATABASE_URI
to one of ClickHouse replica exposed ports. Do not forgetsqlalchemy.url
inalembic.ini
. - Run migrations:
cd cluster && \
clickhouse-client --query 'DROP DATABASE IF EXISTS alembic ON CLUSTER mycluster' && \
clickhouse-client --allow_deprecated_database_ordinary 1 --query 'CREATE DATABASE alembic ON CLUSTER mycluster Engine = Ordinary' && \
alembic upgrade head