yangdx
commited on
Commit
·
ee06c6d
1
Parent(s):
60bdd12
Update logger message
Browse files- lightrag/kg/postgres_impl.py +18 -4
lightrag/kg/postgres_impl.py
CHANGED
@@ -1318,6 +1318,18 @@ class PGGraphStorage(BaseGraphStorage):
|
|
1318 |
retry=retry_if_exception_type((PGGraphQueryException,)),
|
1319 |
)
|
1320 |
async def upsert_node(self, node_id: str, node_data: dict[str, str]) -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1321 |
label = node_id.strip('"')
|
1322 |
properties = self._format_properties(node_data)
|
1323 |
|
@@ -1334,8 +1346,8 @@ class PGGraphStorage(BaseGraphStorage):
|
|
1334 |
try:
|
1335 |
await self._query(query, readonly=False, upsert=True)
|
1336 |
|
1337 |
-
except Exception
|
1338 |
-
logger.error("POSTGRES,
|
1339 |
raise
|
1340 |
|
1341 |
@retry(
|
@@ -1375,8 +1387,10 @@ class PGGraphStorage(BaseGraphStorage):
|
|
1375 |
try:
|
1376 |
await self._query(query, readonly=False, upsert=True)
|
1377 |
|
1378 |
-
except Exception
|
1379 |
-
logger.error(
|
|
|
|
|
1380 |
raise
|
1381 |
|
1382 |
async def _node2vec_embed(self):
|
|
|
1318 |
retry=retry_if_exception_type((PGGraphQueryException,)),
|
1319 |
)
|
1320 |
async def upsert_node(self, node_id: str, node_data: dict[str, str]) -> None:
|
1321 |
+
"""
|
1322 |
+
Upsert a node in the Neo4j database.
|
1323 |
+
|
1324 |
+
Args:
|
1325 |
+
node_id: The unique identifier for the node (used as label)
|
1326 |
+
node_data: Dictionary of node properties
|
1327 |
+
"""
|
1328 |
+
if "entity_id" not in node_data:
|
1329 |
+
raise ValueError(
|
1330 |
+
"PostgreSQL: node properties must contain an 'entity_id' field"
|
1331 |
+
)
|
1332 |
+
|
1333 |
label = node_id.strip('"')
|
1334 |
properties = self._format_properties(node_data)
|
1335 |
|
|
|
1346 |
try:
|
1347 |
await self._query(query, readonly=False, upsert=True)
|
1348 |
|
1349 |
+
except Exception:
|
1350 |
+
logger.error("POSTGRES, upsert_node error on node_id: {node_id}")
|
1351 |
raise
|
1352 |
|
1353 |
@retry(
|
|
|
1387 |
try:
|
1388 |
await self._query(query, readonly=False, upsert=True)
|
1389 |
|
1390 |
+
except Exception:
|
1391 |
+
logger.error(
|
1392 |
+
"POSTGRES, upsert_edge error on edge: {source_node_id} - {target_node_id}"
|
1393 |
+
)
|
1394 |
raise
|
1395 |
|
1396 |
async def _node2vec_embed(self):
|