Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions redisgraph/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,15 @@ def add_edge(self, edge):
assert self.nodes[edge.src_node.alias] is not None and self.nodes[edge.dest_node.alias] is not None
self.edges.append(edge)

def commit(self):
def commit(self, merge=False):
"""
Create entire graph.
"""
if merge:
query = 'MERGE '
else:
query = 'CREATE '

query = 'CREATE '
for _, node in self.nodes.items():
query += str(node) + ','

Expand All @@ -134,6 +137,12 @@ def commit(self):
query = query[:-1]

return self.query(query)

def merge(self):
"""
Merge entire graph.
"""
return self.commit(True)

def query(self, q):
"""
Expand Down