def get_async_engine(url: str | None) -> sqlalchemy.ext.asyncio.AsyncEngine:
    """Get the async database engine.

    Args:
        url: The database url.

    Returns:
        The async database engine.

    Raises:
        ValueError: If the async database url is None.
    """
    if url is None:
        conf = get_config()
        url = conf.async_db_url
        if url is not None and conf.db_url is not None:
            async_db_url_tail = url.partition("://")[2]
            db_url_tail = conf.db_url.partition("://")[2]
            if async_db_url_tail != db_url_tail:
                console.warn(
                    f"async_db_url `{_safe_db_url_for_logging(url)}` "
                    "should reference the same database as "
                    f"db_url `{_safe_db_url_for_logging(conf.db_url)}`."
                )
    if url is None:
        msg = "No async database url configured"
        raise ValueError(msg)

    global _ASYNC_ENGINE
    if url in _ASYNC_ENGINE:
        return _ASYNC_ENGINE[url]

    if not environment.ALEMBIC_CONFIG.get().exists():
        console.warn(
            "Database is not initialized, run [bold]reflex db init[/bold] first."
        )
    _ASYNC_ENGINE[url] = sqlalchemy.ext.asyncio.create_async_engine(
        url,
        **get_engine_args(url),
    )
    return _ASYNC_ENGINE[url]
Get the async database engine.

    Args:
        url: The database url.

    Returns:
        The async database engine.

    Raises:
        ValueError: If the async database url is None.
    
reflex/model.py