I just read the thread in
http://www.mail-archive.com/[email protected]/msg00478.html
and am wondering what is currently 'best' for an application developer if we
want our code to be portable across the various db modules?
Here is what I am currently doing:
import MySQLdb
con = MySQLdb.connect(...)
cur = con.cursor()
ret = cur.execute(
"insert into logs (host, facility) values (%(host)s, %(facility)s)",
{'host': 'foo3', 'facility': 'bar3'} )
I am also wondering what the best way is to specify object names:
print "#1", cur.execute("select count(*) as ncount from `logs`" )
print "#2", cur.execute("select count(*) as ncount from `%s`" %('logs') )
print "#3", cur.execute("select count(*) as ncount from %(table)s",
{'table':'logs'} ) !
# errors because it gets quoted with single quote, not back quote. bug?
Carl K
_______________________________________________
DB-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/db-sig