A lite python mysql driver
Project description
py-mysql-client
py-mysql-client is a lite version for mysql-python-connector package , pure mysql driver written by python
Installation
pip install py-mysql-client
Features
No cursor , get the results instantly after a query like using mysql command line client
Support transactions autocommited
Support prepare stmt
Support debug mode , mysql protocal packages and commands would be printed out for debuging
Usage
Execute ordinary query
from easymysql.connector import MySQLClient
db = MySQLClient()
db.connect(host="121.4.60.147",port=3306,user="root",password="jsak")
print db.execute("show databases;")
stdout :
[(u'information_schema',), (u'mysql',), (u'performance_schema',), (u'stock',), (u'sys',)]
Execute ordinary dml
db.execute("drop table if exists testmy")
db.execute("create table if not exists testmy(id int(11),name varchar(10))")
db.execute("insert into testmy (id,name) values(1,'mamo')")
db.commit()
Execute transcations autocommitted
db.autocommit = True
db.execute("drop table if exists testmy")
db.execute("create table if not exists testmy(id int(11),name varchar(10))")
db.execute("insert into testmy (id,name) values(1,'mamo')")
Execute prepare stmt
db.connect(host="121.4.60.147",port=3306,user="root",password="Yrj1993718!",database="jsak")
db.prepare()
db.execute("select * from stock_daily where stock_code = ?",(601318,))
Debug mode
db = MySQLClient()
db.set_debug()
db.connect(host="121.4.60.197",port=3306,user="root",password="Yrj1993718!",database="stock")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py-mysql-client-0.0.0.2.tar.gz
(117.9 kB
view hashes)
Built Distribution
Close
Hashes for py_mysql_client-0.0.0.2-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f1e70f255e09e193ae2701d4ac3df4eddfccca49d2615125defa27167c533b6 |
|
MD5 | 1dbba48f6f60347e6755c6ea1f3f429a |
|
BLAKE2b-256 | ca2e25f333dd7671308997565db618be048eb5c1f1284533508fe1daa767f2ac |