Merged
Conversation
- Add lineage tracking via ~lineage table per schema - Track attribute origin (schema.table.attribute) for FK and PK attributes - Semantic check on joins/restrictions: error if namesakes have different lineage - Add Schema.rebuild_lineage() to restore lineage for legacy schemas - Add Schema.lineage_table_exists property - Remove @ and ^ operators (use .join/.restrict with semantic_check=False) - Remove dj.U * table pattern (use dj.U & table instead) - Warn when parent lineage missing during table declaration - Skip semantic check with warning if ~lineage table doesn't exist - Add comprehensive spec with API reference and user guide 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Closed
- Remove redundant lineage_table_exists check in table.py (already handled inside delete_table_lineages) - Update spec examples to use core DataJoint types (uint32, uint16) instead of native types (int) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add get_schema_lineages() function in lineage.py - Add schema.lineage property returning flat dict mapping 'schema.table.attribute' to its lineage origin - Add note about A - B without semantic check in spec - Document schema.lineage in API reference 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
7 tasks
Base automatically changed from
claude/clarify-column-type-names-2dpns
to
pre/v2.0
January 7, 2026 14:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements semantic matching for joins in DataJoint 2.0. Instead of matching attributes purely by name (natural join), DataJoint now tracks attribute lineage (origin) and only allows joins on attributes that share both the same name AND the same lineage.
📄 Full Specification - API reference, user guide, and implementation details
Key Changes
lineageproperty indicating its origin (schema.table.attribute)~lineagetable: Hidden per-schema table storing lineage information, populated at table declaration timeschema.rebuild_lineage()to restore lineage for legacy schemas,schema.lineage_table_existsproperty@(permissive join) and^(permissive restriction) replaced by.join(semantic_check=False)and.restrict(semantic_check=False)dj.U * tableremoved: Join with universal set is no longer supportedNew Files
src/datajoint/lineage.py- Lineage management moduletests/integration/test_semantic_matching.py- 21 comprehensive testsdocs/src/design/semantic-matching-spec.md- Full specification with API reference and user guideModified Files
condition.py-assert_join_compatibility()with semantic checkingexpression.py- Updated join/restrict methods, removed@/^operatorsheading.py-lineage_availableproperty, lineage loading from~lineagetabletable.py-_populate_lineage()at declaration, cleanup at dropdeclare.py- FK attribute mapping for lineage trackingschemas.py-rebuild_lineage()method,lineage_table_existspropertyBehavior Summary
~lineagetable missingMigration for Users
Test Plan
🤖 Generated with Claude Code