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.19.tar.gz (6.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.19-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: liquisource-1.2.19.tar.gz
  • Upload date:
  • Size: 6.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.19.tar.gz
Algorithm Hash digest
SHA256 0561cf3a6aae1db1ae2b171e51bcee0f136f555aa6a46393a5d18e4d22ec4afd
MD5 1cf75794137754ad2be11082469d3fc9
BLAKE2b-256 2fe866824b7306a908de13b63b7413fc79ccbb8bd72514277b3e838978999744

See more details on using hashes here.

File details

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

File metadata

  • Download URL: liquisource-1.2.19-py3-none-any.whl
  • Upload date:
  • Size: 7.3 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.19-py3-none-any.whl
Algorithm Hash digest
SHA256 89224368728eacc06af020f7608a6cfa36be0790d201a244f70f8b8d06e23558
MD5 d1d9365955f2773647985c1858d10719
BLAKE2b-256 1d312eded0ad4a0d118b722563002a60686f49937d68d49d26d1c483af43f525

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