Skip to content
Cory Cook edited this page Apr 10, 2014 · 2 revisions

Python Usage

Be sure to import Db

from db import Db

Use a connection string to connect to your database

db = Db('DSN=DSNNAME')

Select a table to perform actions on

db.table('tablename')

To search for a particular string in a column

db.search('column', 'value')

To search for a numeric value in a column

db.search('column', 1)

To search for a match in a set of values

db.search('column', [1, 2, 3])

To copy connection and table information

db2 = Db(db)

To search for a match in a subquery

db = Db('DSN=DSNNAME')
db2 = Db(db)
db2.search('column2', 'value2')
db.search('column', db2)

Warning: the above query is the same as the following

db = Db('DSN=DSNNAME')
db2 = Db(db)
db.search('column', db2)
db2.search('column2', 'value2')

Clone this wiki locally