From 658f68b077562b9d5f4133e53579188b1c14048c Mon Sep 17 00:00:00 2001 From: Avram Lubkin Date: Mon, 3 Jul 2023 11:40:20 -0400 Subject: [PATCH] Update spreadsheet.get_revision() query --- comma/util/spreadsheet.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/comma/util/spreadsheet.py b/comma/util/spreadsheet.py index 6015587..f0e2abe 100644 --- a/comma/util/spreadsheet.py +++ b/comma/util/spreadsheet.py @@ -13,7 +13,6 @@ from typing import Any, Dict, Tuple import git import openpyxl -import sqlalchemy from openpyxl.cell.cell import Cell from openpyxl.workbook.workbook import Workbook from openpyxl.worksheet.worksheet import Worksheet @@ -187,12 +186,11 @@ class Spreadsheet: # NOTE: For some distros (e.g. Ubuntu), we continually add new revisions (Git tags) as they # become available, so we need the max ID, which is the most recent. with self.database.get_session() as session: - subject, _ = ( - session.query( - MonitoringSubjects, - sqlalchemy.func.max(MonitoringSubjects.monitoringSubjectID), - ) + subject = ( + session.query(MonitoringSubjects) .filter_by(distroID=distro) + .order_by(MonitoringSubjects.monitoringSubjectID.desc()) + .limit(1) .one() )