pierrejeambrun commented on code in PR #54302:
URL: https://github.com/apache/airflow/pull/54302#discussion_r2270389788
##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/dag_run.py:
##########
@@ -168,3 +168,11 @@ class DAGRunsBatchBody(StrictBaseModel):
start_date_lte: AwareDatetime | None = None
end_date_gte: AwareDatetime | None = None
end_date_lte: AwareDatetime | None = None
+ run_after_gt: AwareDatetime | None = None
+ run_after_lt: AwareDatetime | None = None
+ logical_date_gt: AwareDatetime | None = None
+ logical_date_lt: AwareDatetime | None = None
+ start_date_gt: AwareDatetime | None = None
+ start_date_lt: AwareDatetime | None = None
+ end_date_gt: AwareDatetime | None = None
+ end_date_lt: AwareDatetime | None = None
Review Comment:
nit: Maybe sort this, so xxx_gt, xxx_gte, xxx_lt, xxx_lte and up together,
it will be easier to read
##########
airflow-core/src/airflow/api_fastapi/common/parameters.py:
##########
@@ -526,8 +528,14 @@ def to_orm(self, select: Select) -> Select:
if self.value and self.value.lower_bound:
select = select.where(self.attribute >= self.value.lower_bound)
+ if self.value and self.value.lower_bound_excluded:
+ select = select.where(self.attribute >
self.value.lower_bound_excluded)
+
if self.value and self.value.upper_bound:
select = select.where(self.attribute <= self.value.upper_bound)
+ if self.value and self.value.upper_bound_excluded:
+ select = select.where(self.attribute <
self.value.upper_bound_excluded)
+
Review Comment:
same
##########
airflow-core/src/airflow/api_fastapi/common/parameters.py:
##########
@@ -565,9 +583,17 @@ def float_range_filter_factory(
def depends_float(
lower_bound: float | None = Query(alias=f"{filter_name}_gte",
default=None),
upper_bound: float | None = Query(alias=f"{filter_name}_lte",
default=None),
+ lower_bound_excluded: float | None = Query(alias=f"{filter_name}_gt",
default=None),
+ upper_bound_excluded: float | None = Query(alias=f"{filter_name}_lt",
default=None),
) -> RangeFilter:
return RangeFilter(
- Range(lower_bound=lower_bound, upper_bound=upper_bound),
getattr(model, filter_name)
+ Range(
+ lower_bound=lower_bound,
+ upper_bound=upper_bound,
+ lower_bound_excluded=lower_bound_excluded,
+ upper_bound_excluded=upper_bound_excluded,
Review Comment:
Same here.
##########
airflow-core/src/airflow/api_fastapi/common/parameters.py:
##########
@@ -526,8 +528,14 @@ def to_orm(self, select: Select) -> Select:
if self.value and self.value.lower_bound:
select = select.where(self.attribute >= self.value.lower_bound)
+ if self.value and self.value.lower_bound_excluded:
+ select = select.where(self.attribute >
self.value.lower_bound_excluded)
+
Review Comment:
That should be an if/else. Even if the second if will shadow the first one
at query time by it's logic, there is no need to make the emitted sql query
more complex than necessary.
##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/task_instances.py:
##########
@@ -116,6 +116,16 @@ class TaskInstancesBatchBody(StrictBaseModel):
end_date_lte: AwareDatetime | None = None
duration_gte: float | None = None
duration_lte: float | None = None
+ run_after_gt: AwareDatetime | None = None
+ run_after_lt: AwareDatetime | None = None
+ logical_date_gt: AwareDatetime | None = None
+ logical_date_lt: AwareDatetime | None = None
+ start_date_gt: AwareDatetime | None = None
+ start_date_lt: AwareDatetime | None = None
+ end_date_gt: AwareDatetime | None = None
+ end_date_lt: AwareDatetime | None = None
+ duration_gt: float | None = None
+ duration_lt: float | None = None
Review Comment:
Same, we can sort only the 'range' portion here
##########
airflow-core/src/airflow/api_fastapi/common/parameters.py:
##########
@@ -565,9 +583,17 @@ def float_range_filter_factory(
def depends_float(
lower_bound: float | None = Query(alias=f"{filter_name}_gte",
default=None),
upper_bound: float | None = Query(alias=f"{filter_name}_lte",
default=None),
+ lower_bound_excluded: float | None = Query(alias=f"{filter_name}_gt",
default=None),
+ upper_bound_excluded: float | None = Query(alias=f"{filter_name}_lt",
default=None),
Review Comment:
Maybe we should take the opportunity to rename variables (private python
interface) because it starts getting confusing in the naming IMOH.
```suggestion
lower_bound_gte: float | None = Query(alias=f"{filter_name}_gte",
default=None),
lower_bound_gt: float | None = Query(alias=f"{filter_name}_gt",
default=None),
upper_bound_lte: float | None = Query(alias=f"{filter_name}_lte",
default=None),
upper_bound_lt: float | None = Query(alias=f"{filter_name}_lt",
default=None),
```
--
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]