Skip to content

xzkostyan/clickhouse-sqlalchemy-alembic-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published