Spaces:
Paused
Paused
Download scratch/test_db_args.py from 3SCError404/nexus: direct link, hf CLI and curl.
- Browser
- Download file 843 Bytes
-
https://huggingface.co/spaces/3SCError404/nexus/resolve/main/scratch/test_db_args.py
- Command line
-
hf download hf://spaces/3SCError404/nexus/scratch/test_db_args.py
-
curl -L -o test_db_args.py https://huggingface.co/spaces/3SCError404/nexus/resolve/main/scratch/test_db_args.py
843 Bytes
| 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()) | |