MCPcopy Create free account
hub / github.com/AgentOps-AI/agentops / get_async_clickhouse

Function get_async_clickhouse

app/api/agentops/api/db/clickhouse_client.py:83–99  ·  view source on GitHub ↗

FastAPI dependency to get the async ClickHouse client. This allows for proper dependency injection and easier testing. Returns: AsyncClient: The async ClickHouse client instance

()

Source from the content-addressed store, hash-verified

81
82
83async def get_async_clickhouse():
84 """
85 FastAPI dependency to get the async ClickHouse client.
86 This allows for proper dependency injection and easier testing.
87
88 Returns:
89 AsyncClient: The async ClickHouse client instance
90 """
91 global async_clickhouse
92
93 # Check again inside the lock to prevent race conditions
94 if async_clickhouse is None:
95 async with _async_clickhouse_lock:
96 # Check again inside the lock to prevent race conditions
97 if async_clickhouse is None:
98 async_clickhouse = await get_async_client(**ConnectionConfig.to_connection_dict())
99 return async_clickhouse
100
101
102# Annotated dependencies for better type hinting

Callers 9

selectMethod · 0.90
selectMethod · 0.90
get_v2_sourced_rowsFunction · 0.90
count_v2_sourced_rowsFunction · 0.90
clickhouse_createFunction · 0.90
clickhouse_get_span_rawFunction · 0.90
clickhouse_delete_spanFunction · 0.90
async_clickhouse_clientFunction · 0.90

Calls 1

to_connection_dictMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…