Skip to content

BUG: async api no longer working (AsyncCursorWrapper requires _async_soft_close attribute) #113

@lucianosrp

Description

@lucianosrp

When running this simple code: (similar to what is shown in the README)

from sqlalchemy import text
from sqlalchemy.ext.asyncio import create_async_engine

uri = (
    f"asyncio+firebolt://{FIREBOLT_CLIENT_ID}:{FIREBOLT_SECRET}@wingx_data_test/"
    f"tiny?account_name={FIREBOLT_ACCOUNT_NAME}"
)
engine = create_async_engine(uri)


async def main():
    async with engine.connect() as conn:
        result = await conn.execute(text("SELECT 1;"))
        print(result.fetchall())

    await engine.dispose()


if __name__ == "__main__":
    import asyncio

    asyncio.run(main())

I get this output:

/home/luciano/repos/wingx/test.py:16: SADeprecationWarning: The dbapi() classmethod on dialect classes has been renamed to import_dbapi().  Implement an import_dbapi() classmethod directly on class <class 'firebolt_db.firebolt_async_dialect.AsyncFireboltDialect'> to remove this warning; the old .dbapi() classmethod may be maintained for backwards compatibility.
    engine = create_async_engine(uri)
Traceback (most recent call last):
    File "/home/luciano/repos/wingx/test.py", line 30, in <module>
    asyncio.run(main())
    File "/home/luciano/.local/share/uv/python/cpython-3.12.9-linux-x86_64-gnu/lib/python3.12/asyncio/runners.py", line 195, in run
    return runner.run(main)
            ^^^^^^^^^^^^^^^^
    File "/home/luciano/.local/share/uv/python/cpython-3.12.9-linux-x86_64-gnu/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/luciano/.local/share/uv/python/cpython-3.12.9-linux-x86_64-gnu/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete
    return future.result()
            ^^^^^^^^^^^^^^^
    File "/home/luciano/repos/wingx/test.py", line 21, in main
    result = await conn.execute(text("SELECT 1;"))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/luciano/repos/wingx/.venv/lib/python3.12/site-packages/sqlalchemy/ext/asyncio/engine.py", line 666, in execute
    return await _ensure_sync_result(result, self.execute)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/luciano/repos/wingx/.venv/lib/python3.12/site-packages/sqlalchemy/ext/asyncio/result.py", line 964, in _ensure_sync_result
    await cursor_result.cursor._async_soft_close()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'AsyncCursorWrapper' object has no attribute '_async_soft_close'

Here are the installed packages:

➜ uv pip freeze | grep firebolt
firebolt-sdk==1.18.1
firebolt-sqlalchemy==1.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions