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.18.tar.gz (5.2 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.18-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: liquisource-1.2.18.tar.gz
  • Upload date:
  • Size: 5.2 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.18.tar.gz
Algorithm Hash digest
SHA256 7b7fcd5eaee721fef9e4a5a4989e99fddc1fa382c3c9e04015787b2dc94f5f8a
MD5 ccc452fe741e65b190f159f4b4fb69ef
BLAKE2b-256 6f5950201c1ba03471b3f6023cc63072b924873a5c5ffac4a59adb5f46557de3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: liquisource-1.2.18-py3-none-any.whl
  • Upload date:
  • Size: 6.9 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.18-py3-none-any.whl
Algorithm Hash digest
SHA256 41604ef43386ca24cfc33e85f4a19f4a1665924baa29d73d511ad0dc5a85951d
MD5 c2e998db73d7818253af1a1cd91a4dc1
BLAKE2b-256 1e905bddd7f34f109e6359f94fde4a398d31b485df66bb7839ba48b4e88247c8

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