Skip to content

Commit d583a0b

Browse files
committed
Verify that Redis graph key is unused before processing inputs
1 parent ebc7c3e commit d583a0b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

bulk_insert.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,12 @@ def bulk_insert(graph, host, port, password, nodes, relations, max_token_count,
359359
# Ignore check if the connected server does not support the "MODULE LIST" command
360360
pass
361361

362+
# Verify that the graph name is not already used in the Redis database
363+
key_exists = client.execute_command("EXISTS", graph)
364+
if key_exists:
365+
print("Graph with name '%s', could not be created, as Redis key '%s' already exists." % (graph, graph))
366+
exit(1)
367+
362368
QUERY_BUF = QueryBuffer(graph, client)
363369

364370
# Create a node dictionary if we're building relations and as such require unique identifiers

0 commit comments

Comments
 (0)