If you run a Python script like this:
conn = sybpydb.connect(user='user', password='password')
cur = conn.cursor()
cur.execute("if 1=1 select 1")
rows=cur.fetchmany()
for row in rows:
print(f"row={row}")
The fetchmany() command will return the error:
sybpydb.ProgrammingError: ('No result set to fetch rows from: DBCAPI layer:
unable to get origin message string: error string not available', 134349063)
KBA 2770299 says you have to call cur.rowcount (no parens) first, and then don't call fetchmany() if cur.rowcount returns -1, but instead call cur.nextset() to get to the next results set.
But cur.rowcount only works if the cursor is buffered, which SAP Python doesn't support. The solution in KBA 2770299 just happens to work because there is only one no-rows results set before nextset() and fetchall() are called
Also, in standard Python, there's a "multi" option for the cur.execute() command to return an iterable result set, but SAP Python doesn't seem to support that either
Is there a way to do this that I'm missing?