attr: clickhouse_migrations.__doc__
Project description
Clickhouse Migrations
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.
Features:
- Supports multi statements - more than one query per migration file.
- Allow running migrations out-of-box
- Simple file migrations format: {VERSION}_{name}.sql
Installation
You can install from pypi using pip install clickhouse-migrations
.
Usage
In command line
clickhouse-migrations --db-host localhost \
--db-user default \
--db-password secret \
--db-name test \
--migrations-dir ./migrations
In code
from clickhouse_migrations.clickhouse_cluster import ClickhouseCluster
cluster = ClickhouseCluster(db_host, db_user, db_password)
cluster.migrate(db_name, migrations_home, create_db_if_no_exists=True, multi_statement=True)
Parameter | Description | Default |
---|---|---|
db_host | Clickhouse database hostname | localhost |
db_user | Clickhouse uesr | **** |
db_password | ***** | **** |
db_name | Clickhouse database name | None |
migrations_home | Path to list of migration files | <project_root> |
create_db_if_no_exists | If the db_name is not present, enabling this will create the db |
True |
multi_statement | Allow multiple statements in migration files | True |
Notes
The Clickhouse driver does not natively support executing multipe statements in a single query. To allow for multiple statements in a single migration, you can use the multi_statement param. There are two important caveats:
- This mode splits the migration text into separately-executed statements by a semi-colon ;. Thus cannot be used when a statement in the migration contains a string with a semi-colon.
- The queries are not executed in any sort of transaction/batch, meaning you are responsible for fixing partial migrations.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for clickhouse-migrations-0.2.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c102c98f9272c649f799e2ba91ac355b0aae2153633f161bcb8df3b2a83b65f |
|
MD5 | 2854f43bb8833bdeffb6e3eeee59b6a4 |
|
BLAKE2b-256 | 04a992322c48b4f54fd9127f0cd77a9e92fe7d888349ede9dc9b6ca25fbd76c5 |
Close
Hashes for clickhouse_migrations-0.2.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c7167cb29586ea810fca7cefd288fa50ce931f79a32c3bd85aad3a82142146f |
|
MD5 | 573452fc0d54beb2ae738cc4959d05e9 |
|
BLAKE2b-256 | c2be4b50f77656bc65f68f49c6fef3d58d8fe2a675421f9fcbdb9cf2f84ba739 |