aio-libs/aioodbc

Cursor.execute returns a pyodbc.Cursor instead of itself

peterdotran opened this issue · 2 comments

Python 3.6
aioodbc 0.1.0
Windows
SQLite

The following just can't work

async def example():
    async aioodbc.connect(...) as conn, conn.cursor() as cursor:
        async for row in await cursor.execute("SELECT * FROM some_table"):
            print(row)

Currently for it to work I have to use two lines

async def example():
    async aioodbc.connect(...) as conn, conn.cursor() as cursor:
        cursor.execute("SELECT * FROM some_table")
        async for row in await cursor:
            print(row)

or not use async for loop but that defeats the purpose of async.

good catch fixed!