Zach Massia

03/31/2023, 3:41 AM
Are there any known issues with
? I keep running into
pyodbc.ProgrammingError: No results.  Previous SQL was not a query.
I'm getting a crash, which ends up hanging the terminal. On my Windows laptop I must close the terminal as
does nothing (on Linux I get an even longer trace). I have been able to reproduce with a minimal ~30 line example. Here is the example code, it's output, as well as the longer trace from my full program: Thanks in advance if anyone can point me in the right direction!
Some extra info, from playing around with the sample a bit I've discovered that if I remove the task decorator from the query_db function, all works (even if there is a flow, and the connection fn is a task)
By pure luck I've got it working! I don't know if this is a Prefect or PyODBC issue, but it seems that passing around the connection, instead of a cursor, fixes everything. 🤷‍♂️
Copy code
def query_db(con):
    print('Querying DB')
    results = con.cursor().execute('select top (1) * from raw.TRUCK').fetchall()
    return results