Skip to content

Commit

Permalink
ZO-4267: bulk delete for postgresql connector if collection is deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
stollero authored and louika committed Mar 1, 2024
1 parent 3bd86b4 commit b842483
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/zeit/connector/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ def __delitem__(self, uniqueid):
log.info('Ignored NotFound while deleting GCS blob %s', uniqueid)
if props.is_collection:
(parent, _) = self._pathkey(uniqueid)
paths = self.session.query(Path).filter(Path.parent_path.startswith(parent)).all()
for path in paths:
query = select(Path).where(Path.parent_path.startswith(parent))
for path in self.session.execute(query).scalars():
self.session.delete(path)

self.session.delete(props)
Expand Down

0 comments on commit b842483

Please sign in to comment.