From 63b97eb2431eafc3356692f472749a897a7c54a2 Mon Sep 17 00:00:00 2001 From: Dhanush Varma Date: Sat, 21 Feb 2026 17:34:56 +0530 Subject: [PATCH] Fix SQLAlchemy 2.x subquery deprecation warnings in controllers --- mod_ci/controllers.py | 8 +++++--- mod_sample/controllers.py | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/mod_ci/controllers.py b/mod_ci/controllers.py index ee4cfe00..127c5f7f 100755 --- a/mod_ci/controllers.py +++ b/mod_ci/controllers.py @@ -2437,7 +2437,9 @@ def progress_type_request(log, test, test_id, request) -> bool: results = g.db.query(count(TestResultFile.got)).filter( and_( TestResultFile.test_id == test.id, - TestResultFile.regression_test_id.in_(results_zero_rc), + TestResultFile.regression_test_id.in_( + results_zero_rc.select() + ), TestResultFile.got.isnot(None) ) ).scalar() @@ -2513,13 +2515,13 @@ def update_final_status(): finished_tests = select(TestProgress.test_id).filter( and_( TestProgress.status.in_([TestStatus.canceled, TestStatus.completed]), - TestProgress.test_id.in_(platform_tests) + TestProgress.test_id.in_(platform_tests.select()) ) ) in_progress_statuses = [TestStatus.preparation, TestStatus.completed, TestStatus.canceled] finished_tests_progress = g.db.query(TestProgress).filter( and_( - TestProgress.test_id.in_(finished_tests), + TestProgress.test_id.in_(finished_tests.select()), TestProgress.status.in_(in_progress_statuses) ) ).subquery() diff --git a/mod_sample/controllers.py b/mod_sample/controllers.py index dc3ef161..7b3d5d85 100755 --- a/mod_sample/controllers.py +++ b/mod_sample/controllers.py @@ -70,11 +70,11 @@ def display_sample_info(sample) -> Dict[str, Any]: sq = select(RegressionTest.id).filter(RegressionTest.sample_id == sample.id) exit_code = g.db.query(TestResult.exit_code).filter(and_( TestResult.exit_code != TestResult.expected_rc, - and_(TestResult.test_id == test_commit.id, TestResult.regression_test_id.in_(sq)) + and_(TestResult.test_id == test_commit.id, TestResult.regression_test_id.in_(sq.select())) )).first() not_null = g.db.query(TestResultFile.got).filter(and_( TestResultFile.got.isnot(None), - and_(TestResultFile.test_id == test_commit.id, TestResultFile.regression_test_id.in_(sq)) + and_(TestResultFile.test_id == test_commit.id, TestResultFile.regression_test_id.in_(sq.select())) )).first() if exit_code is None and not_null is None: @@ -88,12 +88,12 @@ def display_sample_info(sample) -> Dict[str, Any]: exit_code = g.db.query(TestResult.exit_code).filter( and_( TestResult.exit_code != TestResult.expected_rc, - and_(TestResult.test_id == test_release.id, TestResult.regression_test_id.in_(sq)) + and_(TestResult.test_id == test_release.id, TestResult.regression_test_id.in_(sq.select())) ) ).first() not_null = g.db.query(TestResultFile.got).filter(and_( TestResultFile.got.isnot(None), - and_(TestResultFile.test_id == test_release.id, TestResultFile.regression_test_id.in_(sq)) + and_(TestResultFile.test_id == test_release.id, TestResultFile.regression_test_id.in_(sq.select())) )).first() if exit_code is None and not_null is None: