---
title: "Why does the DayOfWeekSensor exist in Airflow?"
description: "How to make an Airflow DAG wait until a specified day of the week"
author: "Bartosz Mikulski"
author_bio: "Principal AI Engineer & MLOps Architect. I bridge the gap between \"it works in a notebook\" and \"it works for 200 million users.\""
author_url: https://mikulskibartosz.name
author_linkedin: https://www.linkedin.com/in/mikulskibartosz/
author_github: https://github.com/mikulskibartosz
canonical_url: https://mikulskibartosz.name/why-does-dayofweeksensor-exist-in-airflow
---

I was surprised when I saw the `DayOfWeekSensor` in Airflow. Why is it here? Is it for the people who don't know how to choose a day of the week in the CRON expression?

In the documentation, we see an example which looks like this:

```python
weekend_check = DayOfWeekSensor(
    task_id='weekend_check',
    week_day={'Saturday', 'Sunday'},
    use_task_execution_day=True,
    dag=dag)
```

It is strange. We can get the same result using a cron expression, for example: `0 10 * * 6-7`.

So what are the possible use-case for the `DayOfWeekSensor`? I found two of them:

First, putting a sensor that waits for a specific day of the week is more explicit than tweaking the cron expression, so it is easier to spot that this DAG runs only on weekends.

Second, in the case of DAGs that run for multiple days, we may have a DAG that starts on Monday, runs some code for a few hours, and needs to wait until Wednesday to do something else. Still, for whatever reason, we don't want to split that DAG into two separate DAGs running on different days.

To be honest, I have no idea what is the usage of this sensor. Do you know? Let me know.

