Skip to content

Commit

Permalink
fix: make jobloggingdb compatible with mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-mazenoux committed Sep 12, 2023
1 parent e536567 commit d677dbf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/diracx/db/jobs/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,11 @@ async def insert_record(
UTC time is used.
"""

seqnum_stmt = (
select(func.coalesce(func.max(LoggingInfo.SeqNum) + 1, 1))
.where(LoggingInfo.JobID == job_id)
.scalar_subquery()
# First, fetch the maximum SeqNum for the given job_id
seqnum_stmt = select(func.coalesce(func.max(LoggingInfo.SeqNum) + 1, 1)).where(
LoggingInfo.JobID == job_id
)
seqnum = await self.conn.scalar(seqnum_stmt)

epoc = (
time.mktime(date.timetuple())
Expand All @@ -302,7 +302,7 @@ async def insert_record(

stmt = insert(LoggingInfo).values(
JobID=int(job_id),
SeqNum=seqnum_stmt,
SeqNum=seqnum,
Status=status,
MinorStatus=minor_status,
ApplicationStatus=application_status[:255],
Expand Down

0 comments on commit d677dbf

Please sign in to comment.