This commit is contained in:
2025-11-14 14:47:19 +00:00
parent 2a85845835
commit 3758c7572a
137 changed files with 365654 additions and 11147 deletions
@@ -70,11 +70,10 @@ class BaseNode(CommonModel): # pyre-ignore[13]
def merge(self, database: str = 'neo4j') -> None:
"""Merge this node into the graph."""
params = self._get_merge_parameters()
all_labels = [self.__primarylabel__] + self.__secondarylabels__
cypher = f"""
MERGE (n:{":".join(all_labels)} {{ {self.__primaryproperty__}: $pp }})
ON MATCH SET n += $set_on_match
@@ -82,10 +81,15 @@ class BaseNode(CommonModel): # pyre-ignore[13]
SET n += $always_set
RETURN n
"""
print(f"DEBUG: Executing merge query: {cypher}")
print(f"DEBUG: With params: {params}")
print(f"DEBUG: Database: {database}")
graph = GraphConnection()
with graph.driver.session(database=database) as session:
result = session.run(cypher, params).single()
print(f"DEBUG: Merge result: {result}")
if result:
return self.__class__(**dict(result["n"]))
return None