One way to do this is to enable profiling :
cursor.execute('set profiling = 1') try: cursor.execute('SELECT * FROM blah where foo = %s',[11]) except Exception: cursor.execute('show profiles') for row in cursor: print(row) cursor.execute('set profiling = 0')
gives
(1L, 0.000154, 'SELECT * FROM blah where foo = 11')
Note that the argument was inserted into the request and that the request was logged even if the request failed.
Another way is to start the server with logging enabled:
sudo invoke-rc.d mysql stop sudo mysqld --log=/tmp/myquery.log
Then you need to sift through /tmp/myquery.log to find out what the server received.
unutbu Aug 15 '11 at 10:18 2011-08-15 22:18
source share