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

   ### Under which category would you file this issue?
   
   Airflow Core
   
   ### Apache Airflow version
   
   3.1.6 (the source code seems the same at 3.2.2)
   
   ### What happened and how to reproduce it?
   
   in 
https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/models/serialized_dag.py
 in the method `write_dag`, you have the following block:
   ```
           if dag_version and not has_task_instances:
               # This is for dynamic DAGs that the hashes changes often. We 
should update
               # the serialized dag, the dag_version and the dag_code instead 
of a new version
               # if the dag_version is not associated with any task instances
   
               # Use direct UPDATE to avoid loading the full serialized DAG
               result = session.execute(
                   update(cls)
                   .where(cls.dag_version_id == dag_version.id)
                   .values(
                       {
                           cls._data: new_serialized_dag._data,
                           cls._data_compressed: 
new_serialized_dag._data_compressed,
                           cls.dag_hash: new_serialized_dag.dag_hash,
                       }
                   )
               )
   
               if getattr(result, "rowcount", 0) == 0:
                   # No rows updated - serialized DAG doesn't exist
                   return False
   ```
   This allows the following scenario to happen - you have the dag in 
`dag_version` without task instances, but not in `serialized_dag` - in which 
case the dag is never serialized.
   
   ### What you think should happen instead?
   
   the dag should be serialized if it is missing
   
   ### Operating System
   
   _No response_
   
   ### Deployment
   
   Other
   
   ### Apache Airflow Provider(s)
   
   _No response_
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Official Helm Chart version
   
   Not Applicable
   
   ### Kubernetes Version
   
   _No response_
   
   ### Helm Chart configuration
   
   _No response_
   
   ### Docker Image customizations
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [x] 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