How to show full query with parameter values using pyodbc?

System: python 3.11 on Windows 10 Pro

I was using psycopg2 to get records from a Postgresql database. The cursor executes the SQL statement like cur.execute(sql,sqlparams). The psycopg2 cursor has a property called .query() which I believe shows me the whole query with the actual parameter values in it to help with debugging.

I have to change this program to use an Azure Synapse database which uses MS SQL so I’m using the pyodbc module to do that. The pyodbc module does not have cur.query() that I can see. Pyodbc cursor docs here.

How can I see my query with parameter values in a pyodbc cursor?

Thank you.

I have to change this program to use an Azure Synapse database which
uses MS SQL so I’m using the pyodbc module to do that. The pyodbc
module does not have cur.query() that I can see. Pyodbc cursor docs
here
.

How can I see my query with parameter values in a pyodbc cursor?

The C++ code says that a Cursor object has an hstmt field.

which is what’s used to dispatch the query:

but I do not know if that’s accessible on the Python side or useful.

But see if cur.hstat is a meaningful thing.

Also, what does dir(cur) show you?