How to see the real SQL query in Python cursor.execute using pyodbc and MS-Access

前端 未结 9 1429
有刺的猬
有刺的猬 2020-12-04 17:17

I use the following code in Python (with pyodbc for a MS-Access base).

cursor.execute(\"select a from tbl where b=? and c=?\", (x, y))

It\'

9条回答
  •  旧时难觅i
    2020-12-04 18:07

    You can use print cursor._last_executed to get the last executed query.

    Read in this answer that you can also use print cursor.mogrify(query,list) to see the full query before or after executing.

提交回复
热议问题