[DB-SIG] pydal release

Randall Smith randall at tnr.cc
Sat Nov 20 09:15:23 CET 2004


Some of you may remember a discussion a few months back about creating a 
database wrapper to hide differences between database modules.  I made a 
release tonight that you can download from sourceforge.

http://sourceforge.net/projects/pydal/

It is alpha so don't use it in production.  Two of the key features are 
consistent, settable date types and paramstyles.  I would appreciate bug 
reports and suggestions.

Example:

import dal
dbdriver = dal.wrapdriver('psycopg')
con = dbdriver
# Set date type (optional - defaults to Python datetime)
con.dtmod = 'py'
# Set param style (optional - defaults to qmark)
con.paramstyle = 'qmark'
mydt = dbdriver.Date(2004,1,1)
query = "Select * from mytable where dtcol > ?"
cur = con.cursor()
cur.execute(query, [mydt])
result = cur.fetchall()
# Returned datetime fields will be Python datetime type
# dtmod and paramstyle can be changed on the cursor.

I appreciate all of your input thus far.  Feel free to contact me 
directly or to post in the Sourceforge forums.

Randall


More information about the DB-SIG mailing list