No project description provided
Project description
dbinterface
Python 连接数据库,执行读写操作的通用接口。
安装
pip install dbinterface
使用方法
from dbinterface.database_client import DataBaseClientFactory
client1 = DataBaseClientFactory.create(
dbtype="postgres",
host="localhost",
port=5432,
user="postgres",
pwd="121113",
database="postgres",
)
result1 = client1.read("select current_date")
client = DataBaseClientFactory.create(
dbtype="mysql",
host="localhost",
port=3306,
user="aaron",
pwd="aaron",
database="information_schema",
)
result2 = client.read("select current_date()")
扩展
以 oracle 为例,在 dbinterface 目录下,新增 oracle_client.py 文件,参考其他 client 编写即可。
然后修改 dbinterface 目录下 database_client.py 文件,修改 DataBaseClientFactory 类,添加对应的数据库类型。
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dbinterface-0.3.tar.gz
(10.7 kB
view details)
Built Distribution
dbinterface-0.3-py3-none-any.whl
(19.2 kB
view details)
File details
Details for the file dbinterface-0.3.tar.gz
.
File metadata
- Download URL: dbinterface-0.3.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33c416f5e84dd11f25c11e5c45255940ab5c2282bb0660fcfacfc46e1f8d7110 |
|
MD5 | 107314cb2cd8f120a0a004cc2a276a69 |
|
BLAKE2b-256 | dffdb0705b863087fab2058c1f1cd5fca398e727809d420c9b5b4b13428deab0 |
File details
Details for the file dbinterface-0.3-py3-none-any.whl
.
File metadata
- Download URL: dbinterface-0.3-py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0dbce3eee0e1265d15ed83d658ad3f2fb7dc348927ef583bc90be27285162e5 |
|
MD5 | 6252950463bee1d07061291051d05530 |
|
BLAKE2b-256 | 2fbbbded20af13081d0e9461bf4128b2fe99e4dfbf71bdc5a7632afcca75f130 |