nathadfield opened a new issue #18909:
URL: https://github.com/apache/airflow/issues/18909
### Apache Airflow version
2.2.0 (latest released)
### Operating System
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"NAME="Debian GNU/Linux"
VERSION_ID="11" VERSION="11 (bullseye)" VERSION_CODENAME=bullseye ID=debian
### Versions of Apache Airflow Providers
_No response_
### Deployment
Astronomer
### Deployment details
_No response_
### What happened
When providing a dict to `params`, `None` is no longer accepted as a value
and the DAG fails to parse.
```
Broken DAG: [/usr/local/airflow/dags/test.py] Traceback (most recent call
last):
File "/usr/local/lib/python3.9/site-packages/airflow/models/dag.py", line
481, in __init__
self.validate_schedule_and_params()
File "/usr/local/lib/python3.9/site-packages/airflow/models/dag.py", line
2636, in validate_schedule_and_params
raise AirflowException(
airflow.exceptions.AirflowException: DAG Schedule must be None, if there are
any required params without default values
```
-
### What you expected to happen
This is a change in behaviour from 2.1.x
### How to reproduce
The following DAG code will reproduce the error.
```from datetime import datetime, timedelta
from airflow import models
from airflow.operators.dummy import DummyOperator
params = {
'key': None
}
default_args = {
'owner': 'airflow',
'retries': 2,
'retry_delay': timedelta(minutes=5)
}
with models.DAG(
'my_dag',
default_args=default_args,
start_date=datetime(2021, 10, 1),
schedule_interval='0 0 * * *',
params=params
) as dag:
test = DummyOperator(
task_id='test'
)
### Anything else
The issue is a result of the work involved in #17100; specifically the
method `validate_schedule_and_params`
https://github.com/apache/airflow/blob/main/airflow/models/dag.py#L2625
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]