db utils with pymysql by chzcb
Project description
dbutils
使用方法
from zcb_dbutils import DBConnection
import logging
import pandas as pd
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(filename)s[line:%(lineno)d ] %(levelname)s %(message)s',
datefmt='%d %b %Y,%a %H:%M:%S', #日 月 年 ,星期 时 分 秒
)
dbconn = DBConnection(host='localhost', port=3306, user='root', password='', database='basic')
ret = dbconn.fetch_one("select * from tb_user1 where id = 1000")
print(ret)
ret = dbconn.showtable('basic', 'tb_user')
print(pd.DataFrame.from_dict(ret))
ret = dbconn.show_table_index('basic', 'tb_user')
print(pd.DataFrame.from_dict(ret))
rows = dbconn.fetch_list('select user_id,id from tb_user')
print(rows)
id = dbconn.insert('insert into tb_role (role_name,role_type,remark_info,created,updated) value (%s,1,%s,0,0)',('xxx', 'xxxx'))
dbconn.commit()
print(id)
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
zcb_dbutils-0.0.7.tar.gz
(4.5 kB
view details)
File details
Details for the file zcb_dbutils-0.0.7.tar.gz.
File metadata
- Download URL: zcb_dbutils-0.0.7.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e6e7ff164e0a5c6b8c3a8732ae0a70d3b956791c7c7e67c9c2d82f527838b46
|
|
| MD5 |
388573adec14ef581bad397b08dfbc15
|
|
| BLAKE2b-256 |
25a6285fae0a813c3eade8b5783a2cbcd2143ae154d45caba79f5df922c00a36
|