Skip to content

scene_pipelines.core.access_markers

Intent markers for SCENE tables: sync authority and write role.

Note

Markers are not enforced by this package. The database administrator sets up grants and sync rules from them.

Read them with sync_authority_of / write_role_of.

SyncAuthority names which database holds the truth for a row:

  • CENTRAL: the central database (consortium catalogs such as Lab). Site -> central verifies and central wins; central -> site overwrites.
  • ORIGIN: the site that acquired the data (subjects, sessions). The site's copy wins; central does not write these tables (enforced by grants, see WriteRole). The row's provenance stamp records the last writer, not an owner.
  • SHARED: no owner; append-only identities (Deployment). Either direction inserts missing rows and never overwrites.

An unmarked table is ORIGIN. A dj.Part follows its master, and a row-meta table follows its tracked_table.

WriteRole restricts who may INSERT. ADMIN is a SCENE consortium administrator; ACQUISITION is a lab's experimenter or acquisition pipeline, and that marker admits no other role. No marker means unrestricted: admin, acquisition, and any later role may write. The sync account is not a marker.

SyncAuthority

Bases: str, Enum

Which database holds the truth for a table's rows (see module docs).

WriteRole

Bases: str, Enum

Which kind of account may INSERT. Absent means unrestricted (see module docs).

mark_sync_authority

mark_sync_authority(authority: SyncAuthority)

Class decorator declaring which database owns this table's rows.

mark_write_role

mark_write_role(role: WriteRole)

Class decorator restricting INSERT to one kind of account.

sync_authority_of

sync_authority_of(table: type) -> SyncAuthority

Return the table's sync authority: its marker, its master's, or ORIGIN.

write_role_of

write_role_of(table: type) -> WriteRole | None

Return the table's write role, or None when INSERT is unrestricted.