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.2.tar.gz
(9.3 kB
view details)
Built Distribution
dbinterface-0.2-py3-none-any.whl
(17.1 kB
view details)
File details
Details for the file dbinterface-0.2.tar.gz
.
File metadata
- Download URL: dbinterface-0.2.tar.gz
- Upload date:
- Size: 9.3 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 | bd09816a401591c25f080957a984e3a855b0edd98f3d83d75b7ec82916934aa1 |
|
MD5 | 4383ad75726f001e943b99ee67e123a9 |
|
BLAKE2b-256 | 3237f1da5144d7e7dc185f772d1b3df1cd6f67739db1ac623971ccf48229580d |
File details
Details for the file dbinterface-0.2-py3-none-any.whl
.
File metadata
- Download URL: dbinterface-0.2-py3-none-any.whl
- Upload date:
- Size: 17.1 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 | 8172711570df2e809f8426aa39c9ba1915b5d8111d10e9c94712dc6f52140853 |
|
MD5 | 4835ffaaeee65dd6679462e5654d9930 |
|
BLAKE2b-256 | 1f49a4de011d8600f41331d7029d842f0466ed7989fcea71a1b86d8802b157c2 |