Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
sladebe
Active Participant
0 Kudos
A basic piece of code using the ASE Python SDK libraries doesn't work
conn = sybpydb.connect(user='user', password='password')
cur = conn.cursor()
cur.execute("if 1=1 select 1")
# This fetchmany call 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)
rows=cur.fetchmany()
for row in rows:
print(f"row={row}")

returns the error:
sybpydb.ProgrammingError: 
('No result set to fetch rows from: DBCAPI layer:
unable to get origin message string: error string not available', 134349063)


The KBA 2770299 says to call cur.rowcount to check if rows are available for the current results set before calling cursor.fetchone or cursor.fetchmany (not in the docs) then call cur.nextset to get the next results set , but that only works if there's a buffered option for the cursor which SAP ASE Python doesn't have.

So this will work, if you know to insert the extra cur.nextset()
conn = sybpydb.connect(user='user', password='password')
cur = conn.cursor()
cur.execute("if 1=1 select 1")
cur.nextset()
rows=cur.fetchmany()
for row in rows:
print(f"row={row}")

 
Labels in this area