Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 954 Bytes

File metadata and controls

27 lines (21 loc) · 954 Bytes

Standalone

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

Cluster

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.

  1. Set up clickhouse cluster locally with docker-compose for example.
  2. Tune CLICKHOUSE_DATABASE_URI to one of ClickHouse replica exposed ports. Do not forget sqlalchemy.url in alembic.ini.
  3. 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