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()[run.py](..%2F..%2F..%2FDownloads%2Frun.py)
    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.17.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

liquisource-1.2.17-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: liquisource-1.2.17.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for liquisource-1.2.17.tar.gz
Algorithm Hash digest
SHA256 1b8e6d215a355f84ce6fcb04c97a60a6a83d8496798748159144ead5db103edf
MD5 c6695806aba52e61d87ade28a43fee3e
BLAKE2b-256 2ed0c42444d1e2eadf980596b1fdf41e95050755bee8e98032a8e58532b99103

See more details on using hashes here.

File details

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

File metadata

  • Download URL: liquisource-1.2.17-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for liquisource-1.2.17-py3-none-any.whl
Algorithm Hash digest
SHA256 a3060611cfe025759370fab277df222561492a51880787463b73994d11f4d5c1
MD5 a165deafd6cd65cfee2656b53b2a5827
BLAKE2b-256 a8452834a2fbc36660f9244f507a1d1e3973b53bf5fe5be77cd6c77b32a9b4fc

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