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()
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.0.tar.gz
(2.8 kB
view details)
Built Distribution
File details
Details for the file liquisource-1.2.0.tar.gz
.
File metadata
- Download URL: liquisource-1.2.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb36cea36b4f50e35eee00e4e2fa4cf23d60a521f0bae4348a3a07c0291a50aa |
|
MD5 | 06610a50ddeee40139382a2c66bf9450 |
|
BLAKE2b-256 | cd9537eb18393bdf106bc9dcdab9eb0a4641a7be687764b3146179c83deb733c |
File details
Details for the file liquisource-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: liquisource-1.2.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eff7fe4f64b99e6eef0b3a16406c506128f2eff09e5df31792dce3bd4592fafe |
|
MD5 | 117aa46255ea78a5b5c54681ffb50b36 |
|
BLAKE2b-256 | 0ec04d3e3fde7960c9c2cbd8320e827c27a15943c59c9398beda369cde7eaa9d |