Skip to content

Commit

Permalink
leverages BulkDataDeletion module to delete and index graph resources…
Browse files Browse the repository at this point in the history
…, re #10781
  • Loading branch information
whatisgalen committed Apr 18, 2024
1 parent 37fee10 commit c640753
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions arches/app/models/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,17 +568,13 @@ def delete_instances(self, verbose=False, request=None):
deletes all associated resource instances
"""
resources_to_delete = list(Resource.objects.filter(graph_id=self.graphid))
delete_count = len(resources_to_delete)
if verbose is True:
bar = pyprind.ProgBar(delete_count)
for resource in resources_to_delete:
resource.delete()
if verbose is True:
bar.update()
if verbose is True:
print(bar)
return delete_count
from arches.app.etl_modules.bulk_data_deletion import BulkDataDeletion
bulk_deleter = BulkDataDeletion()
loadid = uuid.uuid4()
resp = bulk_deleter.delete_resources(request.user.id, loadid, self.graphid)
bulk_deleter.index_resource_deletion(loadid)

return resp

def get_tree(self, root=None):
"""
Expand Down

0 comments on commit c640753

Please sign in to comment.