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 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.3.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

liquisource-1.2.3-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: liquisource-1.2.3.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for liquisource-1.2.3.tar.gz
Algorithm Hash digest
SHA256 5aa7407184d6e79863f78a8134b912b2c7ea925efcb52aaafc450cfbda4b44b5
MD5 0a789f0e469589670fe74b8c1575f976
BLAKE2b-256 4a9355979f5de285e36218ca4550faeb329dd730f1d0bec893e02d56de7f8135

See more details on using hashes here.

File details

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

File metadata

  • Download URL: liquisource-1.2.3-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for liquisource-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4878faf78c991981f9c9f26e421fdc74882ed318b78da3722fd123de9769c9c3
MD5 9d3be0774940f3a1afcca0e8675a40be
BLAKE2b-256 a3e2931bbc9d3b7693adfde0eddf79cb50a3f7be94c37c9a6f6ddb492d73531c

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