bbovenzi commented on code in PR #68544:
URL: https://github.com/apache/airflow/pull/68544#discussion_r3546532871
##########
airflow-core/src/airflow/api_fastapi/common/parameters.py:
##########
@@ -894,6 +894,43 @@ def depends(cls, owners: list[str] =
Query(default_factory=list)) -> _OwnersFilt
return cls().set_value(owners)
+class _RelativeFilelocPrefixFilter(BaseParam[str | None]):
+ """
+ Filter Dags by the folder they live in, derived from ``relative_fileloc``.
+
+ The value is treated as a directory path relative to the bundle root (e.g.
+ ``team_a/etl``). It matches every Dag whose file lives directly in that
folder
+ or in any of its subfolders, using an escaped ``LIKE 'team_a/etl/%'`` so a
+ folder name is never a substring/prefix of another (``team_a`` won't match
+ ``team_alpha``). Dags at the bundle root (no ``/`` in ``relative_fileloc``)
+ are not matched by any folder value and appear only when no folder is
selected.
+ """
+
+ def to_orm(self, select: Select) -> Select:
+ if self.value is None and self.skip_none:
+ return select
+
+ if not self.value:
+ return select
+
+ directory = self.value.rstrip("/")
Review Comment:
Are we sure we can confidently determine dag folders just by parsing a
string by `/`? This feels very brittle.
I am less familiar with how we generate the relative_fileloc. @jedcunningham
any thoughts?
--
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]