Skip to content

Commit

Permalink
refactor (DMS): Replace deprecated Subquery coercion with explicit se…
Browse files Browse the repository at this point in the history
…lect

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))
  • Loading branch information
chrisburr committed Aug 16, 2022
1 parent a548a6a commit 37796e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DIRAC/DataManagementSystem/DB/FTS3DB.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"]))
Expand Down

0 comments on commit 37796e8

Please sign in to comment.