liquisource 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- liquisource-0.0.1/PKG-INFO +8 -0
- liquisource-0.0.1/README.md +48 -0
- liquisource-0.0.1/liquisource.egg-info/PKG-INFO +8 -0
- liquisource-0.0.1/liquisource.egg-info/SOURCES.txt +7 -0
- liquisource-0.0.1/liquisource.egg-info/dependency_links.txt +1 -0
- liquisource-0.0.1/liquisource.egg-info/requires.txt +4 -0
- liquisource-0.0.1/liquisource.egg-info/top_level.txt +1 -0
- liquisource-0.0.1/setup.cfg +4 -0
- liquisource-0.0.1/setup.py +18 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# liquibase数据源驱动
|
|
2
|
+
> liquibase引入python3脚本,统一管理管理mongo、clickhouse的库表结构。changelog记录还是选在记录到mysql中,这样业务上会更加灵活
|
|
3
|
+
```xml
|
|
4
|
+
<changeSet id="xxxxx" author="xxxxxx" labels="mongo">
|
|
5
|
+
<comment>xxxxx</comment>
|
|
6
|
+
<executeCommand executable="python3">
|
|
7
|
+
<arg value="script/db_tag/creat_collection.py"/>
|
|
8
|
+
</executeCommand>
|
|
9
|
+
</changeSet>
|
|
10
|
+
```
|
|
11
|
+
```python
|
|
12
|
+
#!/usr/bin/env python3
|
|
13
|
+
# -*- coding: utf-8 -*-
|
|
14
|
+
|
|
15
|
+
from liquibase_datasource import *
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def create_tag_database():
|
|
19
|
+
# 获取mongo链接实例
|
|
20
|
+
client = get_client(filepath)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
return client[db]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def create_tag_collection():
|
|
27
|
+
# 获取mongo链接实例
|
|
28
|
+
db_name = get_tenant_shard(tag_database)
|
|
29
|
+
client = get_client()
|
|
30
|
+
db = client[db_name]
|
|
31
|
+
|
|
32
|
+
# db开启分片
|
|
33
|
+
client.admin.command("enableSharding", db_name)
|
|
34
|
+
|
|
35
|
+
db.create_collection(tag_collection)
|
|
36
|
+
|
|
37
|
+
# 创建索引
|
|
38
|
+
coll = db[tag_collection]
|
|
39
|
+
coll.create_index(
|
|
40
|
+
[("id", 1), ("name", 1)])
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
if __name__ == "__main__":
|
|
44
|
+
# 创建标签集合
|
|
45
|
+
create_tag_database()
|
|
46
|
+
create_tag_collection()
|
|
47
|
+
|
|
48
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="liquisource",
|
|
5
|
+
version="0.0.1",
|
|
6
|
+
packages=find_packages(),
|
|
7
|
+
install_requires=[
|
|
8
|
+
"setuptools",
|
|
9
|
+
"jproperties",
|
|
10
|
+
"clickhouse_connect",
|
|
11
|
+
"pymongo"
|
|
12
|
+
],
|
|
13
|
+
author="garypdong",
|
|
14
|
+
author_email="garypdong@tencent.com",
|
|
15
|
+
description="A package for liquibase monogo or clickhosue client.",
|
|
16
|
+
keywords="liquisource",
|
|
17
|
+
url="http://github.com/jiyis/liquisource"
|
|
18
|
+
)
|