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
**Deprecation**: Join on `dj.U` (using `*`) is deprecated. It was previously used only for PK manipulation, which is now done via restriction (`&`).
136
+
137
+
**Example**:
138
+
```python
139
+
# Group sessions by subject, counting sessions per subject
140
+
dj.U('subject_id').aggr(Session, n="count(*)")
141
+
# Result: (subject_id) -> n
142
+
# subject_id lineage comes from Session.subject_id
143
+
144
+
# Promote subject_id to PK (removing session_id from PK)
145
+
dj.U('subject_id') & Session
146
+
# Result PK: {subject_id}
147
+
```
148
+
113
149
### Primary Key Formation in Joins
114
150
115
151
The primary key of `A * B` is determined by functional dependency analysis, not simple union.
@@ -710,6 +746,22 @@ WHERE c.contype = 'f'
710
746
711
747
**Keep all rows**: The same constraint applies for `A.aggr(B, ..., keep_all_rows=True)`. A tuples with no matching B tuples appear with NULL aggregates, but the grouping constraint remains.
712
748
749
+
### D10: Universal Set `dj.U` Semantics
750
+
751
+
**Decision**: `dj.U` attributes are homologous to any namesake. Deprecate join (`*`) on `dj.U`.
752
+
753
+
**Homology rule**: Attributes of `dj.U` bypass lineage checking — they match any namesake attribute.
754
+
755
+
**Valid operations**:
756
+
-`dj.U('a', 'b') & A` — promotes a, b to PK; lineage transferred from A
757
+
-`dj.U('a', 'b').aggr(A, ...)` — aggregates A grouped by a, b
758
+
759
+
**Invalid operations**:
760
+
-`dj.U('a', 'b') - A` — produces infinite set (error)
761
+
-`dj.U('a', 'b') * A` — deprecated, use `&` instead
762
+
763
+
**Rationale**: Join on `dj.U` was only used for PK manipulation. Restriction (`&`) is clearer for this purpose.
764
+
713
765
## Testing Strategy
714
766
715
767
1.**Unit tests** for lineage propagation through all query operations
@@ -756,6 +808,7 @@ Semantic matching is a significant change to DataJoint's join semantics that imp
756
808
|**D7**: Migration | Utility function + automatic fallback computation |
0 commit comments