Skip to main content

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


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)

Uploaded Source

Built Distribution

py_mysql_client-0.0.0.2-py2-none-any.whl (137.2 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page