Skip to main content

Migration library for Clickhouse

Project description

Clickhouse Migrator

Clickhouse is known for its scale to store and fetch large datasets.

Development and Maintenance of large-scale db systems many times requires constant changes to the actual DB system. Holding off the scripts to migrate these will be painful.

We found there is nothing existing earlier and developed one inspired by, Flyway, Alembic

This is a python library, which you can execute as a pre-hook using sys python. Or as a migration framework before deployment/server-startup in your application as required.

Installation

You can install from pypi using pip install clickhouse-migrator.

Usage

from migration_lib.migrate import migrate

migrate(db_name, migrations_home, db_host, db_user, db_password, create_db_if_no_exists)
Parameter Description Default
db_name Clickhouse database name None
migrations_home Path to list of migration files <project_root>
db_host Clickhouse database hostname localhost
db_password ***** ****
create_db_if_no_exists If the db_name is not present, enabling this will create the db True

Folder and Migration file patterns

The filenames are pretty similar to how flyway keeps it.

Your first version filename should be prefixed with V1__ (double underscore) These migrations are executed one by one, failures in between will stop and not further version files will be executed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clickhouse-migrator-1.0.2.tar.gz (3.1 kB view details)

Uploaded Source

File details

Details for the file clickhouse-migrator-1.0.2.tar.gz.

File metadata

  • Download URL: clickhouse-migrator-1.0.2.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.7

File hashes

Hashes for clickhouse-migrator-1.0.2.tar.gz
Algorithm Hash digest
SHA256 84fc1e58fb80ad872a15cf479198472014b898f662d2679066399506b324fdaf
MD5 92f32759afe053cd14fac56c33be98f6
BLAKE2b-256 bfc29252c4125388e91b23d2854bf00f1715817e259c51ab39ed6ee3647916ba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page