bugraoz93 commented on PR #55282: URL: https://github.com/apache/airflow/pull/55282#issuecomment-3263896034
> It does seem a little strange that we have to do this kind of manipulation. I noticed that those models have Python's datetime as object type - maybe we can use pendulum datetime in those models to avoid all this ? @kaxil @ashb @bugraoz93 ? Small clarification for who will check out the code and the question, there are two changes in the PR. One is the datetime manipulation that fixes the pydantic-client problem, which was explained in the above comment. Even though we do a pendulum update, this fix needs to be merged. The Second part is where the code started using a shared timezone and accepting the datetime fields from CLI as a pendulum datetime. The question is related to the second part. I can split PR into two if the pendulum discussion changes the direction of shared timezone usage :) The API is already using Pydantic `AwareDatetime` internally, which ensures consistency between datetime usages between the API and internal components via making the date forcefully timezone aware. They are generated as Python datetime on airflowctl while we run `tool.datamodel-codegen` with `datamodel-code-generator`. I don't think we need to update them to pendulum from Pydantic `AwareDatetime`. We still can, but I need to check what it would bring on the API end https://github.com/apache/airflow/blob/69bdd6bc04db34f764f64c34b7d1cd79cc372e2b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/dag_run.py#L96-L106 It is not mandatory to have the shared timezone and adding the datetime types in CLI to pendulum datetime. Even if we use `datetime.datetime` as the type for CLI commands and not pendulum datetime, it fails on the API side and gives the following error (in the picture below). If you pass it with a timezone-aware datetime, it is working. It is more about keeping the consistency between tools in how they handle the datetimes and user-side validation. I think at some level, API is validating without pendulum, even though documentation is not reflecting 100% where it is saying you can use `"logical_date": "2019-08-24T14:15:22Z",` where it is not possible because it is giving the error (in the picture below) on the Pydantic model validation level before executing the route method (422 Unprocessable Entity). <img width="1832" height="210" alt="Screenshot from 2025-09-07 18-20-36" src="https://github.com/user-attachments/assets/048d24ec-bf92-4954-9929-f666ed9d49b6" /> -- 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