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
Release history Release notifications | RSS feed
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.7.tar.gz
(3.2 kB
view details)
Built Distribution
File details
Details for the file liquisource-1.2.7.tar.gz
.
File metadata
- Download URL: liquisource-1.2.7.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20641b1d7d9ad4632b08e018ff2e2a1b5fcd0f40a3e64a35095f060f9d6fd1bb |
|
MD5 | fef9dce81abf285809f9d8a9869ee300 |
|
BLAKE2b-256 | d5e764b62184cc67f76caf2a3fe1e7a0a184d4be615bfaf22a1ee9aff592084e |
File details
Details for the file liquisource-1.2.7-py3-none-any.whl
.
File metadata
- Download URL: liquisource-1.2.7-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 361993bdcebfa99d08b4e9719ba2e1fbe55b65151fd1a8a3da41162626bf2065 |
|
MD5 | 9a1f92e89fd18cef29c89a6034a2503e |
|
BLAKE2b-256 | 1cd789ab62bdd2d66e1b7db6bd54195d39eb1adf699b5f4575f92f18e7f2a9f3 |