MySqlDbHelper
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
Metadata
Release files for mysqldbhelper 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mysqldbhelper-1.0.2.tar.gz | 2.2 kB | Details |
Release files / mysqldbhelper-1.0.2.tar.gz
| Download URL | mysqldbhelper-1.0.2.tar.gz |
|---|---|
| Size | 2.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e82653eeaf8039f1271a589ab9151ad83eee8f86cdafb5eb2a13df07f18c354
|
|
BLAKE2b-256 checksum How to use checksums |
aec7be946000109c01b382c2886e86ec9715142a840f09bd0a6a58f6136b1176
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |