Skip to content

Commit

Permalink
Merge pull request #86 from simon-mazenoux/fix-jobloggingdb-incompati…
Browse files Browse the repository at this point in the history
…bility-with-mysql

Make jobloggingdb compatible with mysql
  • Loading branch information
chrisburr authored Sep 12, 2023
2 parents e73630d + d677dbf commit 0935652
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 0935652

Please sign in to comment.