prabhusneha commented on code in PR #44624: URL: https://github.com/apache/airflow/pull/44624#discussion_r1879697035
########## airflow/api_fastapi/common/parameters.py: ########## @@ -112,6 +112,34 @@ def depends(self, only_active: bool = True) -> _OnlyActiveFilter: return self.set_value(only_active) +class _NoneFilter(BaseParam[bool]): + """check if a column is none or not.""" + + def __init__(self, attribute: ColumnElement, value: bool | None = None, skip_none: bool = True) -> None: + super().__init__(value, skip_none) + self.attribute: ColumnElement = attribute + self.value: bool | None = value + + def to_orm(self, select: Select) -> Select: + if not self.value and self.skip_none: + return select + return select.where(self.attribute.is_(None)) + + def depends(self, *args: Any, **kwargs: Any) -> Self: + raise NotImplementedError("Use search_param_factory instead , depends is not implemented.") + + +def none_param_factory( + attribute: ColumnElement, + none_filter_name: str, + skip_none: bool = True, +) -> Callable[[bool | None], _NoneFilter]: Review Comment: Modified the code -- 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: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org