معرفی شرکت ها


clickhouse-migrate-0.0.4


Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر

توضیحات

Migration library for Clickhouse
ویژگی مقدار
سیستم عامل -
نام فایل clickhouse-migrate-0.0.4
نام clickhouse-migrate
نسخه کتابخانه 0.0.4
نگهدارنده []
ایمیل نگهدارنده []
نویسنده -
ایمیل نویسنده Pavel Trunov <xpen95@gmail.com>
آدرس صفحه اصلی -
آدرس اینترنتی https://pypi.org/project/clickhouse-migrate/
مجوز MIT License Copyright (c) 2021 by Pavel Trunov. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# ClickHouse Migrate [![codecov](https://codecov.io/gh/trushad0w/clickhouse-migrate/branch/master/graph/badge.svg?token=WSTIR7MOHG)](https://codecov.io/gh/trushad0w/clickhouse-migrate) [![PyPI version](https://badge.fury.io/py/clickhouse-migrate.svg)](https://badge.fury.io/py/clickhouse-migrate) Python library for creating and applying migrations in ClickHouse database. ## Installation Installation via PyPi: ```shell pip install clickhouse-migrate ``` ## Usage To use this tool it is required to create and provide a directory in which the migration files will be created, stored and from which they will be applied. `clickhouse-migrate` tool supports clustered ClickHouse setup and therefore it requires ALL clickhouse servers that are clustered as a database parameter. ### Environment variables Required parameters can be provided as environment variables ```shell # Comma separated ClickHouse connection strings from one cluster # Can be as a single connection string in case of standalone clickhouse instance CLICKHOUSE_MIGRATE_DATABASES="clickhouse+native://<user>:<pass>@<host1>:<port>, ... ,clickhouse+native://<user>:<pass>@<host2>:<port>" CLICKHOUSE_MIGRATE_DIRECTORY=<path to directory with migrations files> ``` ### Create migration file One can create a new migration via calling `clickhouse-migrate create_migration` command. #### Command parameters: `-n` / `--name <name of a new migration file>` — this is a required parameter `-dir` / `--migration_dir` — optional parameter for providing path to directory with migration files, default value `./migrations`, can be replaced by `CLICKHOUSE_MIGRATE_DIRECTORY` environment variable Example usage: ```shell clickhouse-migrate create_migration -n test_migration -dir migrations ``` After calling the above-mentioned command a blank migration file `YYYY-MM-DD-HH-mm-ss_<migration_name>.py` will be created in the `migrations` directory which was defined in command line arguments. The content of the created file will look like this ```python from clickhouse_migrate import Step migrations = [Step(sql="")] ``` One should use `Step` dataclass to create migrations. Migrations would be applied in the same order that they are stated in the `migrations` list variable. All of listed changes in the `migration` list variable are by default applied to all databases listed in the `*.ini` config file, since usually changes are required for all replicated instances. If an SQL query stated in the `Step` dataclass should not be executed for all DB replicas one may use `Step(sql="<sql query>", replicated=False)` statement. This rule does not apply in case there is only one connection string in `*.ini` file. ### Apply migrations One can apply migrations created via `clickhouse-migrate create_migration` command by calling `clickhouse-migrate migrate`. This command will check for already applied migrations and will only apply new ones. #### Command parameters: `-db` / `--databases` — optional parameter for providing database connection strings, can be replaced by `CLICKHOUSE_MIGRATE_DATABASES` environment variable `-dir` / `--migration_dir` — optional parameter for providing path to directory with migration files, can be replaced by `CLICKHOUSE_MIGRATE_DIRECTORY` environment variable Example usage: ```shell clickhouse-migrate migrate -dir /home/my_project/migrations -db clickhouse+native://default:@host1:9000/db -db clickhouse+native://default:@host2:9000/db ``` After calling this command all changes from migration files will be applied step-by-step. Changes are stored in `clickhouse_migrate` table.


نیازمندی

مقدار نام
>=8.0.3 click
>=0.2.2 clickhouse-driver
==0.2.0 envparse
- importlib-metadata
==5.10.1 isort
==22.3.0 black
>=2.17.0 pre-commit
==4.0.1 flake8
==6.2.5 pytest
==3.6.1 pytest-mock
==3.0.0 pytest-cov


زبان مورد نیاز

مقدار نام
>=3.7 Python


نحوه نصب


نصب پکیج whl clickhouse-migrate-0.0.4:

    pip install clickhouse-migrate-0.0.4.whl


نصب پکیج tar.gz clickhouse-migrate-0.0.4:

    pip install clickhouse-migrate-0.0.4.tar.gz