Skip to content

Commit 30b7130

Browse files
fix: handle PostgreSQL double-quote format in _get_tier
The tier detection function now handles both MySQL backticks and PostgreSQL double quotes when extracting table names, enabling proper diagram rendering with correct colors and styling. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 79e712b commit 30b7130

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/datajoint/user_tables.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,16 @@ class _AliasNode:
276276

277277
def _get_tier(table_name):
278278
"""given the table name, return the user table class."""
279-
if not table_name.startswith("`"):
280-
return _AliasNode
279+
# Handle both MySQL backticks and PostgreSQL double quotes
280+
if table_name.startswith("`"):
281+
# MySQL format: `schema`.`table_name`
282+
extracted_name = table_name.split("`")[-2]
283+
elif table_name.startswith('"'):
284+
# PostgreSQL format: "schema"."table_name"
285+
extracted_name = table_name.split('"')[-2]
281286
else:
282-
try:
283-
return next(tier for tier in user_table_classes if re.fullmatch(tier.tier_regexp, table_name.split("`")[-2]))
284-
except StopIteration:
285-
return None
287+
return _AliasNode
288+
try:
289+
return next(tier for tier in user_table_classes if re.fullmatch(tier.tier_regexp, extracted_name))
290+
except StopIteration:
291+
return None

0 commit comments

Comments
 (0)