Skip to content

scene_pipelines.ingestion.scene.admin.project

Admin helper: ensure a Project catalog row exists.

project_meta_payload

project_meta_payload(row: dict[str, Any]) -> dict[str, str]

Non-key Project fields. A missing title hashes as an empty string.

ensure_project

ensure_project(project: DjRow[Project], *, deployment: DjRow[Deployment] | None = None, if_exists: DuplicatePolicy = REJECT) -> DjKey[Project]

Insert a project row and stamp the deployment that registered it.

Runs atomically; joins the caller's transaction when one is open.

Parameters:

Name Type Description Default
project DjRow[Project]

Full project insert dict (project_name, optional project_title, …).

required
deployment DjRow[Deployment] | None

Optional deployment row. If omitted, built from SCENE_DEPLOYMENT_ID / SCENE_DEPLOYMENT_LABEL.

None
if_exists DuplicatePolicy

Policy when project_name is already stored; see DuplicatePolicy.

REJECT

Returns:

Type Description
DjKey[Project]

Project primary key {project_name: ...}.

Raises:

Type Description
ValueError

If deployment is omitted and SCENE_DEPLOYMENT_ID is unset, or if_exists rejects the existing row.