From 37796e848fa462a186fb9c1714e1505153e88266 Mon Sep 17 00:00:00 2001 From: Chris Burr Date: Tue, 16 Aug 2022 16:30:31 +0200 Subject: [PATCH] refactor (DMS): Replace deprecated Subquery coercion with explicit select src/DIRAC/DataManagementSystem/DB/test/Test_FTS3DB.py::test_raceCondition /Users/cburr/Development/DIRAC-dev/DIRAC/src/DIRAC/DataManagementSystem/DB/FTS3DB.py:550: SAWarning: Coercing Subquery object into a select() for use in IN(); please pass a select() construct explicitly .filter(~FTS3Operation.operationID.in_(opIDsWithJobAssigned)) --- src/DIRAC/DataManagementSystem/DB/FTS3DB.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DIRAC/DataManagementSystem/DB/FTS3DB.py b/src/DIRAC/DataManagementSystem/DB/FTS3DB.py index 6d0e0627a86..74bd2cf6798 100644 --- a/src/DIRAC/DataManagementSystem/DB/FTS3DB.py +++ b/src/DIRAC/DataManagementSystem/DB/FTS3DB.py @@ -12,7 +12,7 @@ from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.sql.expression import and_ from sqlalchemy.orm import relationship, sessionmaker, mapper -from sqlalchemy.sql import update, delete +from sqlalchemy.sql import update, delete, select from sqlalchemy import ( create_engine, Table, @@ -541,7 +541,7 @@ def getNonFinishedOperations(self, limit=20, operationAssignmentTag="Assigned"): # We need to do the select in two times because the join clause that makes the limit difficult # We get the list of operations ID that have associated jobs assigned - opIDsWithJobAssigned = session.query(FTS3Job.operationID).filter(~FTS3Job.assignment.is_(None)).subquery() + opIDsWithJobAssigned = select(FTS3Job.operationID).filter(~FTS3Job.assignment.is_(None)) operationIDsQuery = ( session.query(FTS3Operation.operationID) .filter(FTS3Operation.status.in_(["Active", "Processed"]))