Skip to content

Commit

Permalink
fix: drop graph instead of truncate
Browse files Browse the repository at this point in the history
  • Loading branch information
aMahanna committed Sep 30, 2024
1 parent 81a1fba commit 35100f9
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions nx_arangodb/classes/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,21 @@ def __init__(
self.__set_arangodb_backend_config(read_parallelism, read_batch_size)

if overwrite_graph:
logger.info("Truncating graph collections...")

for col in self.adb_graph.vertex_collections():
self.db.collection(col).truncate()

for col in self.adb_graph.edge_definitions():
self.db.collection(col["edge_collection"]).truncate()
logger.info("Overwriting graph...")

properties = self.adb_graph.properties()
self.db.delete_graph(name, drop_collections=True)
self.db.create_graph(
name=name,
edge_definitions=properties["edge_definitions"],
orphan_collections=properties["orphan_collections"],
smart=properties.get("smart"),
disjoint=properties.get("disjoint"),
smart_field=properties.get("smart_field"),
shard_count=properties.get("shard_count"),
replication_factor=properties.get("replication_factor"),
write_concern=properties.get("write_concern"),
)

if isinstance(incoming_graph_data, nx.Graph):
self._load_nx_graph(incoming_graph_data, write_batch_size, write_async)
Expand Down

0 comments on commit 35100f9

Please sign in to comment.