[DB-SIG] mogrify/query for adodbapi

Federico Di Gregorio fog at initd.org
Mon Feb 14 16:56:38 CET 2011

On 14/02/11 15:49, William Dode wrote:
> I would like to see the query after the binding. For example with 
> msaccess "insert into t (a), (?)", (True,) will insert -1 with 
> postgresql it will insert 1
> Also i would like to can copy and paste the query for debugging. For 
> example with msaccess, if a field is misswritted the error will not show 
> wich field is it. If i copy-paste it on msaccess it will say me wich 
> field is it.
> I thought maybe ado could show me this. If not i will do it by hand for 
> debugging and of course use the params for the real query.

If the python library sends the query+parameters you can't because it is
the backend that will build the final query. Currently psycopg does all
argument escaping and quoting on the client so we have the final query
ready for inspection.

Anyway, if the client library sends query+parameters to the backend it
is possible to build a "fake" query for logging/debugging purpuse. For
example, we plan to move psycopg .executemany() to prepared queries and
even in that case .mogrify() will return the full query, but in that
case it will be not the one we sent to the db.


Federico Di Gregorio                                       fog at initd.org
 There's no greys, only white that's got grubby. I'm surprised you
  don't know that. And sin, young man, is when you treat people as
  things. Including yourself.                       -- Granny Weatherwax

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/db-sig/attachments/20110214/d810ab87/attachment.pgp>

More information about the DB-SIG mailing list