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.21.tar.gz
(6.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file liquisource-1.2.21.tar.gz.
File metadata
- Download URL: liquisource-1.2.21.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
502e6441d5d625020408dc5fd6733943c0b9ae98215d75264e7e8c092cdcbafd
|
|
| MD5 |
ca51aaa16845f4a082832237c30860f5
|
|
| BLAKE2b-256 |
f4ef2a09ad8bab33742118e2ccff19000c5c6420f92721248d3ec223fe8b89d0
|
File details
Details for the file liquisource-1.2.21-py3-none-any.whl.
File metadata
- Download URL: liquisource-1.2.21-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0c102c66ab9d1592365313ef767749be96d755432ed6eee01cec4ac9cd3b293
|
|
| MD5 |
2417c7d37ee36f1d4f12a0809b7eec94
|
|
| BLAKE2b-256 |
226f1a76b25366ca06536c4f73d3944ceacda1a94e9307803b21865460e82511
|