diff --git a/core/src/zeit/connector/postgresql.py b/core/src/zeit/connector/postgresql.py index b8fdf73558..f95909fb93 100644 --- a/core/src/zeit/connector/postgresql.py +++ b/core/src/zeit/connector/postgresql.py @@ -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)