MCPcopy Create free account
hub / github.com/IQEngine/IQEngine / create_datasource

Function create_datasource

api/handlers/datasources.py:21–34  ·  view source on GitHub ↗

Create a new datasource. The datasource will be henceforth identified by account/container which must be unique or this function will return a 400.

(
    datasource: DataSource,
    datasources: AgnosticCollection = Depends(datasource_repo.collection),
    current_user: dict = Depends(get_current_user),
)

Source from the content-addressed store, hash-verified

19
20@router.post("/api/datasources", status_code=201, response_model=DataSource)
21async def create_datasource(
22 datasource: DataSource,
23 datasources: AgnosticCollection = Depends(datasource_repo.collection),
24 current_user: dict = Depends(get_current_user),
25):
26 """
27 Create a new datasource. The datasource will be henceforth identified by account/container which
28 must be unique or this function will return a 400.
29 """
30 if await datasource_exists(datasource.account, datasource.container):
31 raise HTTPException(status_code=409, detail="Datasource Already Exists")
32
33 datasource = await create(datasource=datasource, user=current_user)
34 return datasource
35
36
37@router.get("/api/datasources", response_model=list[DataSource])

Callers

nothing calls this directly

Calls 2

datasource_existsFunction · 0.90
createFunction · 0.90

Tested by

no test coverage detected