Questions to DB-API 2

Jakob Simon-Gaarde jsgaarde at tdcspace.dk
Fri Feb 21 06:00:03 EST 2003


Quiestions to DB-API 2

1. In DB-API 1 using the odbc module I was able to use question-signs
to format my SQL, thus things like pings around strings and date
formats was automatically taken care of. I would write something like
this:

cur.execute("insert into table (text,number,date) values (?,?,?)",
(strvar,numvar,datevar))

Unfortunately this doesen't seem to work in DB-API 2 but since I don't
expect that it is a degrade compared to DB-API 1 I guess there must be
some other way.
Can anybody help please. Is there a tutorial to db-api 2 with usage
examples, because the description on python.org/topics/db isn't very
informative in the respects of usage.

2. For debug reasons I would really like if I could print the full
SQL-statement when a database exception occures, is this possible? I
can't see any attributes with on the exception classes.

best regards 
Jakob Simon-Gaarde




More information about the Python-list mailing list