From 8acdc891fa12a74e3d8c5577958b0aeea655456a Mon Sep 17 00:00:00 2001 From: John Davis Date: Fri, 6 Oct 2023 10:07:23 -0400 Subject: [PATCH] Fix SA2.0 usage in tool_shed.webapp.util.shed_statistics --- lib/tool_shed/webapp/util/shed_statistics.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/tool_shed/webapp/util/shed_statistics.py b/lib/tool_shed/webapp/util/shed_statistics.py index 2b2ae9db2d2a..d864420ecb2d 100644 --- a/lib/tool_shed/webapp/util/shed_statistics.py +++ b/lib/tool_shed/webapp/util/shed_statistics.py @@ -3,6 +3,10 @@ strftime, ) +from sqlalchemy import select + +from tool_shed.webapp.model import Repository + class ShedCounter: def __init__(self, model): @@ -38,7 +42,7 @@ def generate_statistics(self): self.unique_valid_tools = 0 self.workflows = 0 unique_user_ids = [] - for repository in self.sa_session.query(self.model.Repository): + for repository in self.sa_session.scalars(select(Repository)): self.repositories += 1 self.total_clones += repository.times_downloaded is_deleted = repository.deleted