Spaces:
3SCError404
/
Paused

File size: 843 Bytes
80c383d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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())