From aa0d3db018dc0612308af8710fa53d7b4638a7d4 Mon Sep 17 00:00:00 2001 From: Robin Edwards Date: Mon, 19 Feb 2024 14:45:29 +0000 Subject: [PATCH] schedule may not contain an until key --- redash/models/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/redash/models/__init__.py b/redash/models/__init__.py index a0b0508563..91ddd91ee3 100644 --- a/redash/models/__init__.py +++ b/redash/models/__init__.py @@ -578,7 +578,8 @@ def past_scheduled_queries(cls): return [ query for query in queries - if query.schedule["until"] is not None + if "until" in query.schedule + and query.schedule["until"] is not None and pytz.utc.localize(datetime.datetime.strptime(query.schedule["until"], "%Y-%m-%d")) <= now ]