Package ais :: Module sqlhelp
[hide private]
[frames] | no frames]

Module sqlhelp

source code

Helper functions to create SQL statements.


License: GPL

To Do:

Bugs:

Note: This is not as snazzy as SQLAlchemy or SQLObject, but it works and is simple

Author: Kurt Schwehr

Version: 5548

Copyright: 2006

Classes [hide private]
  select
Construct an sql select query
  create
Helper for building create SQL commands.
  insert
Help create an SQL insert statement for injecting data into a database.

Functions [hide private]
  addVerbosityOptions(parser)
Added the verbosity options to a parser
str sqlInsertStrFromList(table, aList)
Take a list and make an insert string.

Variables [hide private]
  __date__ = '2007-02-08'
Date of last svn commit
  BOMBASTIC = 4
  VERBOSE = 3
  TRACE = 2
  TERSE = 1
  ALWAYS = 0
  NEVER = 0
  success = False

Function Details [hide private]

addVerbosityOptions(parser)

source code 
Added the verbosity options to a parser

sqlInsertStrFromList(table, aList)

source code 
Take a list and make an insert string. This works with dictionaries too. Here is a quick example:
>>> aList = [('one',1),('2','two'),('threepoint',3.)]
>>> sqlInsertStrFromList('myTable',aList)
"insert into myTable (one,2,threepoint) values (1,'two',3.0);"
Parameters:
  • table (str) - Which table to insert into
  • aList - list of tubles pairs to insert - (name, value) @type aList(list)
Returns: str
complete SQL insert command

Variables Details [hide private]

__date__

Date of last svn commit
Value:
'2007-02-08'                                                           
      

BOMBASTIC

None
Value:
4                                                                     
      

VERBOSE

None
Value:
3                                                                     
      

TRACE

None
Value:
2                                                                     
      

TERSE

None
Value:
1                                                                     
      

ALWAYS

None
Value:
0                                                                     
      

NEVER

None
Value:
0                                                                     
      

success

None
Value:
False