LightRAG/lightrag
BukeLy 7dc1f83efb fix: PostgreSQL read methods and delete_entity_relation bugs
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
2025-11-19 23:01:01 +08:00
..
api Bump API version to 0256 2025-11-18 23:15:31 +08:00
evaluation Update LLM cache migration docs and improve UX prompts 2025-11-08 23:48:19 +08:00
kg fix: PostgreSQL read methods and delete_entity_relation bugs 2025-11-19 23:01:01 +08:00
llm Improve Bedrock error handling with retry logic and custom exceptions 2025-11-17 12:54:32 +08:00
tools Improve LightRAG initialization checker tool with better usage docs 2025-11-17 15:42:54 +08:00
__init__.py Bump core version to 1.4.9.9 and API to 0252 2025-11-08 11:27:26 +08:00
base.py feat: enhance BaseVectorStorage for model isolation 2025-11-19 02:15:22 +08:00
constants.py Refactor entity merging with unified attribute merge function 2025-10-27 00:04:17 +08:00
exceptions.py Auto-initialize pipeline status in LightRAG.initialize_storages() 2025-11-17 12:54:33 +08:00
lightrag.py Fix linting 2025-11-18 22:38:43 +08:00
namespace.py
operate.py Adjust chunking parameters to match the default environment variable settings 2025-11-18 23:14:50 +08:00
prompt.py
rerank.py
types.py
utils.py feat: enhance EmbeddingFunc with model_name support 2025-11-19 02:11:39 +08:00
utils_graph.py Improve entity merge logging by removing redundant message and fixing typo 2025-10-31 17:16:59 +08:00