def asession(url: str | None = None) -> AsyncSession:
    """Get an async sqlmodel session to interact with the database.

    async with rx.asession() as asession:
        ...

    Most operations against the `asession` must be awaited.

    Args:
        url: The database url.

    Returns:
        An async database session.
    """
    global _AsyncSessionLocal
    if url not in _AsyncSessionLocal:
        _AsyncSessionLocal[url] = sqlalchemy.ext.asyncio.async_sessionmaker(
            bind=get_async_engine(url),
            class_=AsyncSession,
            expire_on_commit=False,
            autocommit=False,
            autoflush=False,
        )
    return _AsyncSessionLocal[url]()
Get an async sqlmodel session to interact with the database.

    async with rx.asession() as asession:
        ...

    Most operations against the `asession` must be awaited.

    Args:
        url: The database url.

    Returns:
        An async database session.
    
reflex/model.py