Skip to content

Commit f8f9df0

Browse files
committed
Deprecate @ operator in favor of .join(semantic_check=False)
Rationale: - Two join operators with subtle differences adds confusion - .join() method provides same functionality with explicit kwarg - Reduces documentation burden and cognitive load - Simplifies API surface Added D6 design decision documenting the deprecation.
1 parent 9a5442d commit f8f9df0

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

docs/SPEC-semantic-matching.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Lineage propagates through:
7373

7474
**The `.join()` method** provides additional control via kwargs:
7575
- Defaults to semantic matching (same as `*`)
76-
- `semantic_check=False` bypasses the non-homologous namesake error (equivalent to `@` operator)
76+
- `semantic_check=False` bypasses the non-homologous namesake error
7777

7878
**Non-homologous namesake cases**:
7979
- Both have lineage but different origins → error
@@ -82,6 +82,8 @@ Lineage propagates through:
8282

8383
**Resolution**: Use `.proj()` to rename one of the colliding attributes.
8484

85+
**Deprecated**: The `@` operator is deprecated. Use `.join(semantic_check=False)` instead.
86+
8587
**Note**: A warning may be raised for joins on unindexed attributes (performance consideration).
8688

8789
## Current Implementation Analysis
@@ -294,7 +296,7 @@ Update these methods to preserve lineage:
294296

295297
2. **Resolution guidance** in error messages:
296298
- Suggest specific projection syntax to resolve
297-
- Mention permissive join `@` as escape hatch
299+
- Mention `.join(semantic_check=False)` as escape hatch for advanced users
298300

299301
### Phase 6: Migration Utility
300302

@@ -488,7 +490,28 @@ if not has_index(table1, attr) or not has_index(table2, attr):
488490
)
489491
```
490492

491-
### D6: Migration via Utility Function
493+
### D6: Deprecate the `@` Operator
494+
495+
**Decision**: Deprecate the `@` (permissive join) operator.
496+
497+
**Rationale**:
498+
- Having two join operators (`*` and `@`) with subtle differences adds confusion
499+
- The `.join(semantic_check=False)` method provides the same functionality
500+
- Reduces documentation burden and cognitive load
501+
- Simplifies the API surface
502+
503+
**Migration**:
504+
```python
505+
# Old (deprecated)
506+
A @ B
507+
508+
# New
509+
A.join(B, semantic_check=False)
510+
```
511+
512+
The `@` operator will emit a deprecation warning and eventually be removed.
513+
514+
### D7: Migration via Utility Function
492515

493516
**Decision**: Provide a migration utility that computes the `~lineage` table from existing schema.
494517

@@ -608,7 +631,8 @@ Semantic matching is a significant change to DataJoint's join semantics that imp
608631
| **D3**: Computed attributes | Lineage = `None` (breaks matching) |
609632
| **D4**: `dj.U` interaction | Does not affect lineage |
610633
| **D5**: Secondary attr restriction | Replaced by lineage rule - FK-inherited attrs have lineage, native secondary don't |
611-
| **D6**: Migration | Utility function + automatic fallback computation |
634+
| **D6**: `@` operator | Deprecated - use `.join(semantic_check=False)` |
635+
| **D7**: Migration | Utility function + automatic fallback computation |
612636

613637
### Compatibility
614638

0 commit comments

Comments
 (0)