Skip to content

Commit 1d25762

Browse files
fix: Unescape single quotes in MySQL expression indexes
MySQL stores escaped single quotes (\') in the EXPRESSION column of information_schema.statistics. Unescape them in heading.py when processing index metadata. Also add swap files to .gitignore.
1 parent bd35a7e commit 1d25762

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,8 @@ datajoint.json
195195

196196
# Test outputs
197197
*_test_summary.txt
198+
199+
# Swap files
200+
*.swp
201+
*.swo
202+
*~

src/datajoint/heading.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,9 @@ def _init_from_database(self) -> None:
551551
index_name = item.get("index_name") or item.get("Key_name")
552552
seq = item.get("seq_in_index") or item.get("Seq_in_index") or len(keys[index_name]) + 1
553553
column = item.get("column_name") or item.get("Column_name")
554+
# MySQL EXPRESSION column stores escaped single quotes - unescape them
555+
if column:
556+
column = column.replace("\\'", "'")
554557
non_unique = item.get("non_unique") or item.get("Non_unique")
555558
nullable = item.get("nullable") or (item.get("Null", "NO").lower() == "yes")
556559

0 commit comments

Comments
 (0)