Closed coreybrett closed 2 years ago
Does your driver not support manual commit ? Here is where the pyODBC attempts to turn off autocommit (admittedly, the == false
is a little odd) if you specify so:
https://github.com/mkleehammer/pyodbc/src/connection.cpp#L381
Try autocommit=True , which will prevent pyODBC from attempting to change the commit option upon connect, since ODBC drivers default to autocommit.
Awesome! That fixed it.
The following works perfect now.
Thank you!!!
import pyodbc
from icecream import ic
cnxn = pyodbc.connect(
"DSN=nds.udd;UID=xxx;PWD=xxx;", readonly=True, autocommit=True
)
cursor = cnxn.cursor()
q = r"""SELECT SA_HEADER.VH_WORKORDER, SA_HEADER.VH1_STATUS
FROM root.SA_HEADER SA_HEADER
WHERE (SA_HEADER.VH_WORKORDER Like 'A%') AND (SA_HEADER.VH1_STATUS='O')"""
cursor.execute(q)
rows = cursor.fetchall()
ic(rows)
Issue
When attempting the following...
I get...
How would I get past this?