Skip to content

Commit 6c63625

Browse files
committed
Rename ensure_lineage_table to create_lineage_table
Also: - Remove redundant U check for second operand in assert_join_compatibility - Suggest .join(semantic_check=False) in error message for non-homologous namesakes
1 parent 5606348 commit 6c63625

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/datajoint/condition.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def assert_join_compatibility(expr1, expr2):
115115
raise DataJointError("Object %r is not a QueryExpression and cannot be joined." % rel)
116116

117117
# dj.U is always compatible - it contains all possible lineages
118-
if isinstance(expr1, U) or isinstance(expr2, U):
118+
if isinstance(expr1, U):
119119
return
120120

121121
# Find namesake attributes (same name in both expressions)
@@ -130,7 +130,8 @@ def assert_join_compatibility(expr1, expr2):
130130
raise DataJointError(
131131
f"Cannot join on attribute `{name}`: different lineages "
132132
f"({lineage1} vs {lineage2}). "
133-
f"Use .proj() to rename one of the attributes."
133+
f"Use .proj() to rename one of the attributes or "
134+
f".join(semantic_check=False) to force a natural join."
134135
)
135136

136137

src/datajoint/lineage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
LINEAGE_TABLE_NAME = "~lineage"
2020

2121

22-
def ensure_lineage_table(connection, database):
22+
def create_lineage_table(connection, database):
2323
"""Create the ~lineage table if it doesn't exist."""
2424
connection.query(
2525
f"""
@@ -100,7 +100,7 @@ def insert_lineage_entries(connection, database, entries):
100100
if not entries:
101101
return
102102

103-
ensure_lineage_table(connection, database)
103+
create_lineage_table(connection, database)
104104

105105
for table_name, attribute_name, lineage in entries:
106106
connection.query(

0 commit comments

Comments
 (0)