Skip to main content

A liquibase datasource client for python

Project description

liquibase数据源驱动

liquibase引入python3脚本,统一管理管理mongo、clickhouse的库表结构。changelog记录还是选在记录到mysql中,这样业务上会更加灵活

<changeSet id="xxxxx" author="xxxxxx" labels="mongo">
    <comment>xxxxx</comment>
    <executeCommand executable="python3">
        <arg value="script/db_tag/creat_collection.py"/>
    </executeCommand>
</changeSet>
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from liquibase_datasource import *


def create_tag_database():
    # 获取mongo链接实例
    client = get_client(filepath)


    return client[db]


def create_tag_collection():
    # 获取mongo链接实例
    db_name = get_tenant_shard(tag_database)
    client = get_client()
    db = client[db_name]

    # db开启分片
    client.admin.command("enableSharding", db_name)

    db.create_collection(tag_collection)

    # 创建索引
    coll = db[tag_collection]
    coll.create_index(
        [("id", 1), ("name", 1)])


if __name__ == "__main__":
    # 创建标签集合
    create_tag_database()
    create_tag_collection()

发布包

python3 -m pip install --upgrade build
python3 -m build
python3 -m pip install --upgrade twine
python3 -m twine upload  dist/*

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

liquisource-1.2.12.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

liquisource-1.2.12-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file liquisource-1.2.12.tar.gz.

File metadata

  • Download URL: liquisource-1.2.12.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.8

File hashes

Hashes for liquisource-1.2.12.tar.gz
Algorithm Hash digest
SHA256 571fd3dfaf1f5444c73f080caf517e19debff9ed44e245ca46f2659c93084a6e
MD5 ad052f386b36662a27701b0150f7ce3e
BLAKE2b-256 a092da3b9f9d68e6773e00eb94921f4abc50658984b02a47ad9205c75532075e

See more details on using hashes here.

File details

Details for the file liquisource-1.2.12-py3-none-any.whl.

File metadata

File hashes

Hashes for liquisource-1.2.12-py3-none-any.whl
Algorithm Hash digest
SHA256 e6bda834a908353971de44b71f8fce124b9e7bb39be0a6fccd0c0939a5366c68
MD5 6fd6a8154bef0880921bdfe13be7bd7b
BLAKE2b-256 1cb934b93342f745e19a8f85c8368300d1c870d7caf0f7ae7d5f78347faa0384

See more details on using hashes here.

Supported by

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