Why this change is needed: After implementing model isolation, two critical bugs were discovered that would cause data access failures: Bug 1: In delete_entity_relation(), the SQL query uses positional parameters ($1, $2) but the parameter dict was not converted to a list of values before passing to db.execute(). This caused parameter binding failures when trying to delete entity relations. Bug 2: Four read methods (get_by_id, get_by_ids, get_vectors_by_ids, drop) were still using namespace_to_table_name(self.namespace) to get legacy table names instead of self.table_name with model suffix. This meant these methods would query the wrong table (legacy without suffix) while data was being inserted into the new table (with suffix), causing data not found errors. How it solves it: - Bug 1: Convert parameter dict to list using list(params.values()) before passing to db.execute(), matching the pattern used in other methods - Bug 2: Replace all namespace_to_table_name(self.namespace) calls with self.table_name in the four affected methods, ensuring they query the correct model-specific table Impact: - delete_entity_relation now correctly deletes relations by entity name - All read operations now correctly query model-specific tables - Data written with model isolation can now be properly retrieved - Maintains consistency with write operations using self.table_name Testing: - All 6 PostgreSQL migration tests pass (test_postgres_migration.py) - All 6 Qdrant migration tests pass (test_qdrant_migration.py) - Verified parameter binding works correctly - Verified read methods access correct tables |
||
|---|---|---|
| .. | ||
| api | ||
| evaluation | ||
| kg | ||
| llm | ||
| tools | ||
| __init__.py | ||
| base.py | ||
| constants.py | ||
| exceptions.py | ||
| lightrag.py | ||
| namespace.py | ||
| operate.py | ||
| prompt.py | ||
| rerank.py | ||
| types.py | ||
| utils.py | ||
| utils_graph.py | ||