Diagram.restrict: apply Part conditions through the Master to preserve master-part compositional integrity
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 52/100
- Type d'issue
- Fonctionnalité
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- python
- Domaine
- data-engineering, databases
Piste de recherche
Commencez dans src/datajoint/diagram.py avec restrict et _propagate_restrictions(mode="restrict"), puis comparez _propagate_part_to_master avec le parcours vers le haut de cascade. Vérifiez la reproduction existante et suivez la manière dont les conditions de Part sont propagées. Le travail est terminé lorsque les restrictions de Part sélectionnent les Masters correspondants, tandis que chaque Master sélectionné conserve tous ses Parts, sans modifier le comportement de suppression de cascade.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Summary
dj.Diagram.restrict is logically conjunctive (AND — it removes rows that fail the criteria).
Unlike the disjunctive trace/cascade (which include everything touched and keep/pull whole
compositional units), a conjunctive filter can cut into a master-part group, leaving partial
groups — a Master exported with only a subset of its Parts (or none). This preserves referential
integrity but breaks compositional integrity: the exported entity misrepresents the original.
Reproduction (structural)
dj.Diagram(schema).restrict(Master & 'm=1').restrict(Master.Part & 'p>3')
Master→ all ofm=1.Master.Part→ (Parts ofm=1, from the master-keyed downstream restriction) ANDp>3→ only
thep>3Parts.- Result:
Master m=1whole, but only a subset of its Parts. A Master can even survive with zero
Parts, sincerestrictdoes not walk up from Part to Master.
Why it matters
- Referential integrity — fine. A kept Part's FK to its Master is satisfied; a Master needs no Parts
to be valid. The export re-imports without dangling foreign keys. - Compositional integrity — broken. DataJoint's master-part contract treats a Master's Parts as one
atomic entity. A recording exported with only some of its channels loads cleanly but is a
corrupted/partial entity.
Root cause / model
In DataJoint's model the Master is the entity; Parts have no independent existence. The unit of
export is therefore the Master-with-all-its-Parts. A Part-level filter is either meaningless for export,
or should mean "Masters that have a matching Part."
Decision (v2.4)
In Diagram restriction, conditions on Part tables are applied through their Master:
- A restriction that selects Part rows lifts to an existential restriction on the Master — Masters
that have a matching Part are selected. - A selected Master brings in all of its Parts.
- Net: compositional units are never split; Parts are never filtered within a unit.
This is the compositional-integrity analogue, for read-only restriction/export, of what cascade's
part_integrity="cascade" does for delete.
Scope / relationships
- Not for 2.3.1 — behavior change deferred to v2.4.
- Distinct from #1500 (which established that
restrictdoes not performcascade's deletion
part→master walk-up). This issue is about filtering granularity — keeping units whole under a
conjunctive filter — a different mechanism; the two are compatible. - Optional 2.3.x stopgap: document the current behavior (restrict can yield partial Part groups; lift
Part criteria to the Master viaMaster & (Part & cond)).
References
- Surfaced in the 2.3.1
dj.Diagramreview (finding F12). - Code:
src/datajoint/diagram.py—restrict,_propagate_restrictions(mode="restrict"); contrast
_propagate_part_to_master(cascade's upward walk).
- Langage dominant
- Python
- Étoiles
- 197
- Forks
- 98
- Merge moyen
- 6 j 7 h
- PR mergées (30 j)
- 1
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de datajoint/datajoint-python
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
datajoint/datajoint-python#1539 · 3 commentaires ·
-
dj.Diagram SVG output is not byte-reproducible: set iteration order leaks into node emission order Ouvertebug
Difficulté 3/5 1-2 jours Accessibilité débutants 78/100
datajoint/datajoint-python#1551 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
datajoint/datajoint-python#1550 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
datajoint/datajoint-python#1547 ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 52/100
datajoint/datajoint-python#1546 · 1 commentaire ·
Toutes les issues de datajoint/datajoint-python
Issues similaires
-
[Bug] reef-hermes tells me to resume with hermes --resume, which does not work from my shell Ouvertearea: harness bug status: needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Human-Agent-Society/reef#625 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 80/100
learningequality/kolibri#15351 · 2 commentaires ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
Name consistency Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
eellak/triplestore#65 · 1 commentaire ·