Skip to content

Commit

Permalink
Revert "fix: drop instead of truncate"
Browse files Browse the repository at this point in the history
This reverts commit 11347c9.
  • Loading branch information
aMahanna committed Sep 30, 2024
1 parent 11347c9 commit eb7c2cc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 27 deletions.
9 changes: 4 additions & 5 deletions nx_arangodb/classes/digraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,10 @@ class DiGraph(Graph, nx.DiGraph):
as expected.
overwrite_graph : bool (optional, default: False)
Whether to drop & re-create the graph collections before loading
**incoming_graph_data** into the graph. NOTE: This parameter only
applies if the graph already exists in the database. NOTE: Dropping
the graph collections will erase all properties of the collections, including
created indexes.
Whether to truncate the graph collections when the graph is loaded from
the database. If set to True, the graph collections will be truncated
before loading the graph data. NOTE: This parameter only applies if the
graph already exists in the database.
args: positional arguments for nx.Graph
Additional arguments passed to nx.Graph.
Expand Down
20 changes: 8 additions & 12 deletions nx_arangodb/classes/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,10 @@ class Graph(nx.Graph):
as expected.
overwrite_graph : bool (optional, default: False)
Whether to drop & re-create the graph collections before loading
**incoming_graph_data** into the graph. NOTE: This parameter only
applies if the graph already exists in the database. NOTE: Dropping
the graph collections will erase all properties of the collections, including
created indexes.
Whether to truncate the graph collections when the graph is loaded from
the database. If set to True, the graph collections will be truncated
before loading the graph data. NOTE: This parameter only applies if the
graph already exists in the database.
args: positional arguments for nx.Graph
Additional arguments passed to nx.Graph.
Expand Down Expand Up @@ -232,16 +231,13 @@ def __init__(
self.__set_arangodb_backend_config(read_parallelism, read_batch_size)

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

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

for ed in self.adb_graph.edge_definitions():
col = ed["edge_collection"]
self.db.delete_collection(col)
self.db.create_collection(col, edge=True)
for col in self.adb_graph.edge_definitions():
self.db.collection(col["edge_collection"]).truncate()

if isinstance(incoming_graph_data, nx.Graph):
self._load_nx_graph(incoming_graph_data, write_batch_size, write_async)
Expand Down
9 changes: 4 additions & 5 deletions nx_arangodb/classes/multidigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,10 @@ class MultiDiGraph(MultiGraph, DiGraph, nx.MultiDiGraph):
as expected.
overwrite_graph : bool (optional, default: False)
Whether to drop & re-create the graph collections before loading
**incoming_graph_data** into the graph. NOTE: This parameter only
applies if the graph already exists in the database. NOTE: Dropping
the graph collections will erase all properties of the collections, including
created indexes.
Whether to truncate the graph collections when the graph is loaded from
the database. If set to True, the graph collections will be truncated
before loading the graph data. NOTE: This parameter only applies if the
graph already exists in the database.
args: positional arguments for nx.Graph
Additional arguments passed to nx.Graph.
Expand Down
9 changes: 4 additions & 5 deletions nx_arangodb/classes/multigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,10 @@ class MultiGraph(Graph, nx.MultiGraph):
as expected.
overwrite_graph : bool (optional, default: False)
Whether to drop & re-create the graph collections before loading
**incoming_graph_data** into the graph. NOTE: This parameter only
applies if the graph already exists in the database. NOTE: Dropping
the graph collections will erase all properties of the collections, including
created indexes.
Whether to truncate the graph collections when the graph is loaded from
the database. If set to True, the graph collections will be truncated
before loading the graph data. NOTE: This parameter only applies if the
graph already exists in the database.
args: positional arguments for nx.Graph
Additional arguments passed to nx.Graph.
Expand Down

0 comments on commit eb7c2cc

Please sign in to comment.