MCPcopy Create free account
hub / github.com/GerevAI/gerev / connect_data_source

Function connect_data_source

app/api/data_source.py:95–103  ·  view source on GitHub ↗
(request: Request, dto: AddDataSourceDto, background_tasks: BackgroundTasks)

Source from the content-addressed store, hash-verified

93
94@router.post("")
95async def connect_data_source(request: Request, dto: AddDataSourceDto, background_tasks: BackgroundTasks) -> int:
96 logger.info(f"Adding data source {dto.name} with config {json.dumps(dto.config)}")
97 data_source = await DataSourceContext.create_data_source(name=dto.name, config=dto.config)
98 Posthog.added_data_source(uuid=request.headers.get('uuid'), name=dto.name)
99 # in main.py we have a background task that runs every 5 minutes and indexes the data source
100 # but here we want to index the data source immediately
101 background_tasks.add_task(data_source.index)
102
103 return data_source.get_id()

Callers

nothing calls this directly

Calls 5

create_data_sourceMethod · 0.80
added_data_sourceMethod · 0.80
add_taskMethod · 0.80
get_idMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected