eladkal commented on issue #20116:
URL: https://github.com/apache/airflow/issues/20116#issuecomment-1177177172

   Duplicate of https://github.com/apache/airflow/issues/21656 issue was fixed 
in https://github.com/apache/airflow/pull/21705
   
   Noting that the reproduce example provided will not work even now.
   `task.get_task_instances(start_date="20211201", end_date="20211201")` is 
wrong. The values can not be strings.
   
   
https://github.com/apache/airflow/blob/c23b31cd786760da8a8e39ecbcf2c0d31e50e594/airflow/models/baseoperator.py#L1242-L1243
   
   
   The DAG 
   
   ```
   import pendulum
   from airflow.operators.dummy import DummyOperator
   from airflow import DAG
   dag = DAG(
        "20116",
        start_date=pendulum.parse("20211201"),
    )
   with dag:
        task1 = DummyOperator(task_id="test_task")
   
   task = dag.get_task("test_task")
   task.get_task_instances(start_date="20211201", end_date="20211201")
   ```
   
   Will yield:
   
   ```
   Broken DAG: [/files/dags/20116.py] Traceback (most recent call last):
     File "/usr/local/lib/python3.7/site-packages/sqlalchemy/sql/type_api.py", 
line 1487, in process
       return process_param(value, dialect)
     File "/opt/airflow/airflow/utils/sqlalchemy.py", line 68, in 
process_bind_param
       raise TypeError('expected datetime.datetime, not ' + repr(value))
   TypeError: expected datetime.datetime, not '20211201'
   ```
   
   You can change it to:
   `task.get_task_instances(start_date=pendulum.parse("20211201"), 
end_date=pendulum.parse("20211201"))`


-- 
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]

Reply via email to