MCPcopy Create free account
hub / github.com/agentscope-ai/Trinity-RFT / to_async_url

Function to_async_url

trinity/buffer/utils.py:10–18  ·  view source on GitHub ↗

Convert a synchronous DB URL to its async dialect equivalent.

(url: str)

Source from the content-addressed store, hash-verified

8
9
10def to_async_url(url: str) -> str:
11 """Convert a synchronous DB URL to its async dialect equivalent."""
12 if url.startswith("sqlite:///"):
13 return url.replace("sqlite:///", "sqlite+aiosqlite:///", 1)
14 if url.startswith("postgresql://"):
15 return url.replace("postgresql://", "postgresql+asyncpg://", 1)
16 if url.startswith("mysql://"):
17 return url.replace("mysql://", "mysql+aiomysql://", 1)
18 return url
19
20
21async def async_run_with_retry_session(

Callers 5

init_async_engineFunction · 0.90
test_sqliteMethod · 0.90
test_postgresqlMethod · 0.90
test_mysqlMethod · 0.90
test_already_asyncMethod · 0.90

Calls

no outgoing calls

Tested by 4

test_sqliteMethod · 0.72
test_postgresqlMethod · 0.72
test_mysqlMethod · 0.72
test_already_asyncMethod · 0.72