MCPcopy
hub / github.com/Agenta-AI/agenta / fetch_base_by_id

Function fetch_base_by_id

api/oss/src/services/db_manager.py:347–369  ·  view source on GitHub ↗

Fetches a base by its ID. Args: base_id (str): The ID of the base to fetch. Returns: VariantBaseDB: The fetched base, or None if no base was found.

(base_id: str)

Source from the content-addressed store, hash-verified

345
346
347async def fetch_base_by_id(base_id: str) -> Optional[VariantBaseDB]:
348 """
349 Fetches a base by its ID.
350
351 Args:
352 base_id (str): The ID of the base to fetch.
353
354 Returns:
355 VariantBaseDB: The fetched base, or None if no base was found.
356 """
357
358 assert base_id is not None, "no base_id provided"
359 base_uuid = await get_object_uuid(object_id=base_id, table_name="bases")
360 async with engine.core_session() as session:
361 result = await session.execute(
362 select(VariantBaseDB)
363 .options(joinedload(VariantBaseDB.deployment))
364 .filter_by(id=uuid.UUID(base_uuid))
365 )
366 base = result.scalars().first()
367 if base is None:
368 raise NoResultFound(f"Base with id {base_id} not found")
369 return base
370
371
372async def fetch_app_variant_by_name_and_appid(

Callers 2

_fetch_deploymentFunction · 0.90
_create_variantFunction · 0.90

Calls 2

get_object_uuidFunction · 0.85
core_sessionMethod · 0.80

Tested by

no test coverage detected