houqp commented on a change in pull request #13278:
URL: https://github.com/apache/airflow/pull/13278#discussion_r551615312
##########
File path: airflow/utils/types.py
##########
@@ -24,6 +24,9 @@ class DagRunType(str, enum.Enum):
SCHEDULED = "scheduled"
MANUAL = "manual"
+ def __str__(self) -> str: # pylint: disable=invalid-str-returned
Review comment:
we need this, inheriting from str doesn't override `__str__`, but only
`__format__`. If you look into the mysql client code i linked in the
discussion, `__str__` is what it calls to serialize the binding params:
For example:
```
>>> from airflow.utils.types import DagRunType
>>> str(DagRunType.SCHEDULED)
'DagRunType.SCHEDULED'
>>> f'{DagRunType.SCHEDULED}'
'scheduled'
>>> format(DagRunType.SCHEDULED)
'scheduled'
```
You can also reproduce the problem with the unit test provided in this PR by
removing `__str__` override.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]