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)
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.5.tar.gz
(4.2 kB
view hashes)
Built Distribution
Close
Hashes for zcb_dbutils-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee6a355cd360dac73c87b871550ea57fd59a2c096bb0440f3297aaf7748be32c |
|
MD5 | dd997c9f34080170f91ef7de6238919b |
|
BLAKE2b-256 | 575644136271c8c738568b5ba4a06811b1f3bebf6f1478526618e8cda4f56cce |