Skip to content

Commit

Permalink
fix: store the task type value rather than enum when creating a task (#…
Browse files Browse the repository at this point in the history
…1329)

* fix: store the task type value not enum when creating a task

* Update demo.py
  • Loading branch information
adamstruck authored Oct 24, 2023
1 parent 7480a64 commit 9f8c001
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion querybook/server/logic/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def set_up_demo(uid: int, session=None):
"task": "tasks.update_metastore.update_metastore",
"cron": "0 0 * * *",
"args": [metastore_id],
"task_type": ScheduleTaskType.PROD,
"task_type": ScheduleTaskType.PROD.value,
"enabled": True,
},
# commit=False,
Expand Down
2 changes: 1 addition & 1 deletion querybook/server/logic/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def create_task_schedule(
kwargs=kwargs or {},
options=options or {},
enabled=enabled,
task_type=get_schedule_task_type(name),
task_type=get_schedule_task_type(name).value,
)

session.add(schedule)
Expand Down
4 changes: 3 additions & 1 deletion querybook/server/models/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ class TaskSchedule(CRUDMixin, Base):
no_changes = sql.Column(sql.Boolean, default=False)

task_type = sql.Column(
sql.String(length=name_length), nullable=False, default=ScheduleTaskType.PROD
sql.String(length=name_length),
nullable=False,
default=ScheduleTaskType.PROD.value,
)

def get_cron(self):
Expand Down

0 comments on commit 9f8c001

Please sign in to comment.