Skip to content

Commit

Permalink
Undo type:ignore: legitimate SA2.0 error (see note)
Browse files Browse the repository at this point in the history
In 2.0 the type of result is ChunkedIteratorResult, which does not have
`rowcount` attribute. In 1.4, it's LegacyCursorResult, which DOES have a
rowcount. HOWEVER, as per SA docs:
"Statements that use RETURNING may not return a correct rowcount."
https://docs.sqlalchemy.org/en/20/core/connections.html#sqlalchemy.engine.CursorResult.rowcount

So, this whole code block needs to be redone.
  • Loading branch information
jdavcs committed Feb 10, 2024
1 parent 115d509 commit 686d15b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/galaxy/celery/base_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def calculate_task_start_time( # type: ignore
result = sa_session.execute(
self._update_stmt, {"userid": user_id, "interval": task_interval_secs, "now": now}
)
if result.rowcount == 0: # type:ignore[attr-defined]
if result.rowcount == 0:
sched_time = now + datetime.timedelta(seconds=task_interval_secs)
result = sa_session.execute(
self._upsert_stmt, {"userid": user_id, "now": now, "sched_time": sched_time}
Expand Down

0 comments on commit 686d15b

Please sign in to comment.