You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: declare hidden attributes in DataJoint notation
Platform columns are now written the way a user writes an attribute, and
appended to the table definition before it is parsed. The ordinary machinery
then does everything -- backend type mapping, the `:type:` comment, and the
column-comment bookkeeping PostgreSQL needs for its out-of-line COMMENT ON.
No Python construction, and no adapter method.
_job_start_time = null : datetime(3) # when computation began
_job_duration = null : float32 # computation duration in seconds
_job_version = "" : varchar(64) # code version
_prov = null : json # extrinsic provenance ...
_singleton = 1 : bool # singleton primary key
Grammar and policy are separated to make that possible. The attribute grammar
accepts a leading underscore, so the framework can spell its own columns; a
*user* declaring one is refused by `_reject_user_hidden_attributes`, called from
declare() on the user's definition before anything is appended. That ordering is
the whole mechanism: the guard never sees the framework's lines.
Placement matters and is not uniform:
- Job metadata and provenance are secondary, so they follow every user
attribute. A `---` is inserted when the definition has none, because
otherwise a table whose attributes are all primary key takes a nullable
hidden column as a nullable key attribute and is rejected.
- `_singleton` is the exception: it *is* the primary key, so it goes into the
key section of a table that declares none of its own. Detection is by the
absence of attribute or foreign-key lines ahead of the separator, so a
leading table comment does not mask it.
The test for the underscore ban now exercises the user-facing path rather than
compile_attribute, which deliberately accepts these names. It gains coverage for
per-tier placement -- Entry gets `_prov`, Computed and Imported get job
metadata, Lookup, parts and job tables get neither.
deploy.add_prov_column no longer reaches into the in-process heading cache. A
Heading is memoized from the database, and refreshing it meant poking private
state and guessing which class to poke; a deploy operation runs before the
workers that write through it, as set_replica_identity does. The requirement is
documented instead, and the test reloads the way a deployment would.
681 passed, 14 skipped.
0 commit comments