langchain/libs/community/langchain_community/graphs
German Martin 3a1d05394d
community: Apache AGE wrapper. Ensure Node Uniqueness by ID. (#28759)
**Description:**

The Apache AGE graph integration incorrectly handled node merging,
allowing duplicate nodes with different IDs but the same type and other
properties. Unlike
[Neo4j](cdf6202156/libs/community/langchain_community/graphs/neo4j_graph.py (L47)),
[Memgraph](cdf6202156/libs/community/langchain_community/graphs/memgraph_graph.py (L50)),
[Kuzu](cdf6202156/libs/community/langchain_community/graphs/kuzu_graph.py (L253)),
and
[Gremlin](cdf6202156/libs/community/langchain_community/graphs/gremlin_graph.py (L165)),
it did not use the node ID as the primary identifier for merging.

This inconsistency caused data integrity issues and unexpected behavior
when users expected updates to specific nodes by ID.

**Solution:**
This PR modifies the `node_insert_query` to `MERGE` nodes based on label
and ID *only* and updates properties with `SET`, aligning the behavior
with other graph database integrations. The `_format_properties` method
was also modified to handle id overrides.

**Impact:**

This fix ensures data integrity by preventing duplicate nodes, and
provides a consistent behavior across graph database integrations.
2024-12-17 09:21:59 -05:00
..
__init__.py community[patch]: Add unit test to verify that init is correctly defined (#22030) 2024-05-22 17:19:00 +00:00
age_graph.py community: Apache AGE wrapper. Ensure Node Uniqueness by ID. (#28759) 2024-12-17 09:21:59 -05:00
arangodb_graph.py infra: rm unused # noqa violations (#22049) 2024-05-22 15:21:08 -07:00
falkordb_graph.py community: switch to falkordb python client (#20229) 2024-04-09 20:19:44 +00:00
graph_document.py multiple: pydantic 2 compatibility, v0.3 (#26443) 2024-09-13 14:38:45 -07:00
graph_store.py docs: community docstring updates (#21040) 2024-04-29 17:40:23 -04:00
gremlin_graph.py docs: community docstring updates (#21040) 2024-04-29 17:40:23 -04:00
hugegraph.py community[minor]: import fix (#20995) 2024-04-29 10:32:50 -04:00
index_creator.py multiple: pydantic 2 compatibility, v0.3 (#26443) 2024-09-13 14:38:45 -07:00
kuzu_graph.py community: KuzuGraph needs allow_dangerous_requests, add graph documents via LLMGraphTransformer (#27949) 2024-12-10 03:15:28 +00:00
memgraph_graph.py community: update Memgraph integration (#27017) 2024-12-10 10:57:21 -05:00
nebula_graph.py community[minor]: import fix (#20995) 2024-04-29 10:32:50 -04:00
neo4j_graph.py community[patch]: Neo4j community deprecation (#28130) 2024-11-25 10:34:22 -08:00
neptune_graph.py community: NeptuneGraph fix (#23281) 2024-08-23 15:34:26 +00:00
neptune_rdf_graph.py community[minor]: import fix (#20995) 2024-04-29 10:32:50 -04:00
networkx_graph.py infra: update mypy 1.10, ruff 0.5 (#23721) 2024-07-03 10:33:27 -07:00
ontotext_graphdb_graph.py community[minor]: import fix (#20995) 2024-04-29 10:32:50 -04:00
rdf_graph.py community[minor]: import fix (#20995) 2024-04-29 10:32:50 -04:00
tigergraph_graph.py community: tigergraph fixes (#20034) 2024-04-24 16:49:21 -04:00