jason810496 commented on code in PR #54382:
URL: https://github.com/apache/airflow/pull/54382#discussion_r2273909813


##########
airflow-core/src/airflow/api_fastapi/common/parameters.py:
##########
@@ -540,6 +540,22 @@ def is_active(self) -> bool:
             self.value.lower_bound is not None or self.value.upper_bound is 
not None
         )
 
+class _IsDagScheduledFilter(BaseParam[bool]):
+    """Filter on timetable_description."""
+
+    def to_orm(self, select: Select) -> Select:
+        if not self.value is None and self.skip_none:
+            if not self.value:
+                return 
select.where(DagModel.timetable_description.ilike("%Never%"))
+            else:
+                return 
select.where(DagModel.timetable_description.not_like("%Never%"))

Review Comment:
   I have a little concern about using `timetable_description` to filter 
whether the dag is scheduled or not, but it seems which is the only way to 
filter at db level.
   
   This _should_ be no problem for most case, as there will only be `Never` 
substring in `NullTimetable`.
   
https://github.com/apache/airflow/blob/81538ef9217093c51aeeb29747fe4796cf89c550/airflow-core/src/airflow/timetables/simple.py#L60-L68
   



##########
airflow-core/src/airflow/api_fastapi/common/parameters.py:
##########
@@ -540,6 +540,22 @@ def is_active(self) -> bool:
             self.value.lower_bound is not None or self.value.upper_bound is 
not None
         )
 
+class _IsDagScheduledFilter(BaseParam[bool]):
+    """Filter on timetable_description."""
+
+    def to_orm(self, select: Select) -> Select:
+        if not self.value is None and self.skip_none:
+            if not self.value:
+                return 
select.where(DagModel.timetable_description.ilike("%Never%"))
+            else:
+                return 
select.where(DagModel.timetable_description.not_like("%Never%"))

Review Comment:
   A small speedup for query 
   
   ```suggestion
                   return 
select.where(DagModel.timetable_description.ilike("Never%"))
               else:
                   return 
select.where(DagModel.timetable_description.not_like("Never%"))
   ```



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