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 details)
Built Distribution
File details
Details for the file py-mysql-client-0.0.0.2.tar.gz
.
File metadata
- Download URL: py-mysql-client-0.0.0.2.tar.gz
- Upload date:
- Size: 117.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.7.0 requests/2.25.1 setuptools/18.5 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/2.7.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95defdae3ec19390be72810c81bf02e41ef9f9057bf519ee38b61f923b3a0d89 |
|
MD5 | bcbfd7ef7e8bf4ce15c535ffe5521348 |
|
BLAKE2b-256 | 30b1b1c8ccd64eb213a1c3ff723d5095b345ea52615ddb5afb78659505fe1a47 |
File details
Details for the file py_mysql_client-0.0.0.2-py2-none-any.whl
.
File metadata
- Download URL: py_mysql_client-0.0.0.2-py2-none-any.whl
- Upload date:
- Size: 137.2 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.7.0 requests/2.25.1 setuptools/18.5 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/2.7.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f1e70f255e09e193ae2701d4ac3df4eddfccca49d2615125defa27167c533b6 |
|
MD5 | 1dbba48f6f60347e6755c6ea1f3f429a |
|
BLAKE2b-256 | ca2e25f333dd7671308997565db618be048eb5c1f1284533508fe1daa767f2ac |