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
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.16.tar.gz
(4.9 kB
view details)
Built Distribution
File details
Details for the file liquisource-1.2.16.tar.gz
.
File metadata
- Download URL: liquisource-1.2.16.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 031e11f6fc3843dc6d35599381b8b116c1a78cc013d7b1852c9bee340f2c14b8 |
|
MD5 | 4e41e9aef6ae5043cd2761c2f67e97c0 |
|
BLAKE2b-256 | a6c755fb70891e30af126f19b3258c2904708b62a5b667842f714195a47f1053 |
File details
Details for the file liquisource-1.2.16-py3-none-any.whl
.
File metadata
- Download URL: liquisource-1.2.16-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc71b6e52e1b05505ead61277d986df00c1ad6181a258318c8de9f4f8a5b804d |
|
MD5 | b98009ac65c32e959eabf2a9f25f1735 |
|
BLAKE2b-256 | cc5eff33dc2e449d332c056646ee4498f5dd2f458d49f6bd17b2777cbacd1371 |