Diagram.restrict: apply Part conditions through the Master to preserve master-part compositional integrity
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- data-engineering, databases
Hướng nghiên cứu
Bắt đầu trong src/datajoint/diagram.py với restrict và _propagate_restrictions(mode="restrict"), sau đó so sánh _propagate_part_to_master với quá trình đi lên của cascade. Xác minh reproduction hiện có và theo dõi cách các điều kiện của Part được truyền đi. Hoàn thành khi các restriction của Part chọn các Master đủ điều kiện, trong khi mọi Master được chọn vẫn giữ tất cả Part của mình, mà không thay đổi hành vi xóa của cascade.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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).
- Ngôn ngữ chính
- Python
- Star
- 197
- Fork
- 98
- Merge trung bình
- 6 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 1
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của datajoint/datajoint-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
datajoint/datajoint-python#1539 · 3 bình luận ·
-
dj.Diagram SVG output is not byte-reproducible: set iteration order leaks into node emission order Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 78/100
datajoint/datajoint-python#1551 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
datajoint/datajoint-python#1550 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
datajoint/datajoint-python#1547 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
datajoint/datajoint-python#1546 · 1 bình luận ·
Tất cả issue của datajoint/datajoint-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
anthropics/skills#1811 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
speaches-ai/speaches#678 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
datalayer/mcp-compose#42 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
conda-forge/spacy-feedstock#177 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
UKGovernmentBEIS/inspect_evals#2523 ·