Skip to content

Confusing "trio.run received unrecognized yield message None" error when client_id is None #117

@lucianosrp

Description

@lucianosrp

When running the following code:

import urllib.parse

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

firebolt_client_id = None  
firebolt_secret = "..."
db_name = "..."
account_name = "..."
engine_name = "..."


secret = urllib.parse.quote_plus(firebolt_secret)
url = (
    f"asyncio+firebolt://{firebolt_client_id}:{secret}@{db_name}/"
    f"{engine_name}?account_name={account_name}"
)


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


if __name__ == "__main__":
    import asyncio

    asyncio.run(main())

I will get this error:

TypeError: trio.run received unrecognized yield message None. Are you trying to use a library written for some other framework like asyncio? That won't work without some kind of compatibility shim.

I guess this comes from the internal firebolt-sdk package but somehow I was only able to replicate this error on the sqlalchemy's API.
It was quite hard for me to find out what the real cause of the error was and I eventually realized that it is cause by firebolt_client_id being None. It would be nice to get this error caught earlier with a more specific error message.

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