danieldeleo opened a new issue, #49720:
URL: https://github.com/apache/airflow/issues/49720

   ### Apache Airflow version
   
   2.10.5
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   https://github.com/apache/airflow/pull/34947 introduced a bug which causes 
get_dag_details API endpoint to always return the default_timezone setting 
under [core] for every dag, even if a DAG has specified a custom timezone that 
is different from the default_timezone. The root cause is that the DagModel 
class returns only 
[settings.TIMEZONE](https://github.com/apache/airflow/blob/b93c3db6b1641b0840bd15ac7d05bc58ff2cccbf/airflow/models/dag.py#L3935)
 for its timezone property. PR#34947 made the get_dag_details endpoint return a 
union of DagModel & Dag object attributes but gave DagModel attributes 
preference when both DagModel and Dag objects had the same named attribute.  
The problematic code is pasted below:
   
   ```
       dag_model: DagModel = session.get(DagModel, dag_id)
       for key, value in dag.__dict__.items():
           if not key.startswith("_") and not hasattr(dag_model, key):
               setattr(dag_model, key, value)
   
       return dag_detail_schema.dump(dag_model)
   ```
   
   ### What you think should happen instead?
   
   The Dag object's attribute for timezone should be returned instead of the 
DagModel's timezone attribute
   
   ### How to reproduce
   
   Create a timezone aware DAG that has a timezone different from the Airflow 
default, and then call get_dag_details endpoint. The returned timezone will be 
the same as the Airflow default, and not the DAG's actual timezone.
   
   ### Operating System
   
   This applies to all OSes
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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