import asyncio from sqlalchemy.ext.asyncio import create_async_engine from sqlalchemy.pool import NullPool async def test_engine(): try: url = "postgresql+asyncpg://postgres:postgres@localhost:5432/test" engine = create_async_engine( url, prepared_statement_cache_size=0, poolclass=NullPool ) print("Engine created successfully (direct arg)") except Exception as e: print(f"Failed with direct arg: {e}") try: engine = create_async_engine( url, connect_args={"statement_cache_size": 0}, poolclass=NullPool ) print("Engine created successfully (connect_args)") except Exception as e: print(f"Failed with connect_args: {e}") if __name__ == "__main__": asyncio.run(test_engine())