MySQLdb - parameterised SQL - how to see resulting SQL ?

shearichard at gmail.com shearichard at gmail.com
Wed May 17 21:41:55 EDT 2006


Hi - I've got SQL that looks like this ...

cursor =
self.MySQLDb_conn.cursor(cursorclass=MySQLdb.cursors.DictCursor)
sqlQuery = "SELECT * FROM T1 WHERE C1 = %s and C2 = %s"
sql = cursor.execute(sqlQuery,(strURLAlias,strSessionID))
rows = cursor.fetchall()
cursor.close

... i would be interested in seeing what the actual SQL used by the
.execute looks like after the replacements have been done. Is there a
way of doing this ?

thanks

richard.




More information about the Python-list mailing list