bugraoz93 commented on code in PR #43506:
URL: https://github.com/apache/airflow/pull/43506#discussion_r1835512233
##########
airflow/api_fastapi/core_api/routes/public/dag_run.py:
##########
@@ -147,3 +156,70 @@ def patch_dag_run(
dag_run = session.get(DagRun, dag_run.id)
return DAGRunResponse.model_validate(dag_run, from_attributes=True)
+
+
+@dag_run_router.get("/", responses=create_openapi_http_exception_doc([401]))
+async def get_dag_runs(
+ dag_id: str,
+ limit: QueryLimit,
+ offset: QueryOffset,
+ logical_date: Annotated[
+ RangeFilter, Depends(datetime_range_filter_factory("logical_date",
DagRun, "execution_date"))
+ ],
+ start_date_range: Annotated[RangeFilter,
Depends(datetime_range_filter_factory("start_date", DagRun))],
+ end_date_range: Annotated[RangeFilter,
Depends(datetime_range_filter_factory("end_date", DagRun))],
+ update_at_range: Annotated[RangeFilter,
Depends(datetime_range_filter_factory("updated_at", DagRun))],
+ state: QueryDagRunStateFilter,
+ order_by: Annotated[
+ SortParam,
+ Depends(
+ SortParam(
+ [
+ "id",
+ "state",
+ "dag_id",
+ "execution_date",
+ "dag_run_id",
+ "start_date",
+ "end_date",
+ "updated_at",
+ "external_trigger",
+ "conf",
+ ],
+ DagRun,
+ ).dynamic_depends(default="id")
+ ),
+ ],
+ session: Annotated[Session, Depends(get_session)],
+ # fields: list[str] | None = Query(None),
Review Comment:
Due to its type and purpose, this should be similar to `update_mask` (even
though it is reversed regarding `masking`). We will get in `explode=true`,
similar to update_mask again `....?fields=item1&fields=item2`.
As far as I see there isn't a way to exclude fields during `validation` and
doing `dump` and `validate` won't work until we have a dynamically generated
`Pydantic` model with the selected fields making the validation on return. I
saw a discussion about including this capability. There are also some
workarounds for people there. Maybe we can also have a generic exclusion method
for `Pydantic` models until it is provided fully.
https://github.com/pydantic/pydantic/issues/9573
--
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]