Skip to content

scene_pipelines.core.db

Small DataJoint helpers shared by the write paths (ids, transactions, key lookup).

new_id

new_id() -> UUID

Return a new opaque id for a minted primary key (UUID4).

atomic

atomic(connection: Connection)

Open a transaction, or join the one already open (DataJoint cannot nest).

lookup_key

lookup_key(table: type[Manual], restriction: DjKey) -> DjKey | None

Return the primary key of the row matching restriction, or None.

restriction should cover a unique index (e.g. lab_id + a code), so at most one row matches.