This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

A simple wrapper over mysqldb

Project Description

For use with the mysqldb module for python

Usage

import mysqldbhelper
db = mysqldbhelper.DatabaseConnection('hostname',
                    user='username',
                    passwd='password',
                    db='databasename')

For single transactions

db.get_one('select book_name from book where isbn = %s', ('SOMEISBN',))

‘limit 1’ is automatically added

db.get_all('select book_name from book where author = %s', ('Richard Dawkins',))
db.put('''
insert into book
(book_name, book_author)
values
(%s, %s)''', ('Phantoms in the brain', 'V.S. Ramachandran')

put can be used for insert, update and delete queries

db.put('''delete from book
where
book_author = %s''' ('Deepak Chopra',))

For multiple transcations that need to be run atomically

try:
    db.start()
    db.get(...)
    db.put(...)
    ...
    db.save()
except Exception, e:
    db.rollback()
    raise

Used at Comparnion.com

Release History

Release History

This version
History Node

1.0.2

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
mysqldbhelper-1.0.2.tar.gz (2.2 kB) Copy SHA256 Checksum SHA256 Source Feb 6, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting