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.20.tar.gz
(6.2 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.20.tar.gz.
File metadata
- Download URL: liquisource-1.2.20.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
670cebbe2955d31d6d4e507b821b8b7880486efd4b4fc45626a18e6e0c7948c5
|
|
| MD5 |
8cc884faa27fdd9b9bd27527cafb7b91
|
|
| BLAKE2b-256 |
613e07234ad96b97238205839c705760e10e83c50b9205243b19f751eced541f
|
File details
Details for the file liquisource-1.2.20-py3-none-any.whl.
File metadata
- Download URL: liquisource-1.2.20-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47db96f99254b6b680912a629aa05d8804eaa8bdc37434034d5bedfd623c6cdf
|
|
| MD5 |
7153b198258e298181c3cffc4d43adb9
|
|
| BLAKE2b-256 |
a08aca7433821bbdc58a25f0b1e675be379c353bc06e6a6a7d69b0eacd9982dd
|