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
Document allow_invalid_primary_key as public parameter
Make allow_invalid_primary_key a public parameter for join() so users
can bypass the left join A → B constraint when they take responsibility
for handling the potentially invalid primary key.
This is useful when subsequent operations (like GROUP BY) will reset
the primary key. Aggregation uses this internally for keep_all_rows=True.
Co-authored-by: dimitri-yatsenko<dimitri@datajoint.com>
Copy file name to clipboardExpand all lines: docs/src/design/semantic-matching-spec.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -341,6 +341,22 @@ The following attributes from the right operand's primary key are not determined
341
341
the left operand: ['z']. Use an inner join or restructure the query.
342
342
```
343
343
344
+
### Bypassing the Left Join Constraint
345
+
346
+
For special cases where the user takes responsibility for handling the potentially invalid primary key, the constraint can be bypassed using `allow_invalid_primary_key=True`:
347
+
348
+
```python
349
+
# Normally blocked - B does not determine A
350
+
A.join(B, left=True) # Error: A → B not satisfied
351
+
352
+
# Bypass the constraint - user takes responsibility
When bypassed, the resulting primary key is the union of both operands' primary keys (PK(A) ∪ PK(B)). The user must ensure that subsequent operations (such as `GROUP BY` or projection) establish a valid primary key.
357
+
358
+
This mechanism is used internally by aggregation (`aggr`) with `keep_all_rows=True`, which resets the primary key via the `GROUP BY` clause.
359
+
344
360
### Aggregation Exception
345
361
346
362
`A.aggr(B, keep_all_rows=True)` uses a left join internally but has the **opposite requirement**: **B → A** (the group expression B must have all of A's primary key attributes).
0 commit comments