parthpalkhiwala-vonage commented on issue #20875:
URL: https://github.com/apache/airflow/issues/20875#issuecomment-1139587968

   > > Is the issue related to the Db upgrade or something related to the code?
   > 
   > The root cause is that your serialized dags are likely using some older 
version of libraries and objects that are serialized are likely not restorable 
with the new versions - depending on what libraries and objects you have and 
dependencies you had, it might be something that is not at all in control of 
Airflow.. The "reserialize" will simply delete serialized dags from the 
database which will force them to be re-serialized agaain. Think of it as a 
"cached versions" of your DAGs.
   
   Thanks for the quick response.
   Unfortunately airflow dags reserialize isn't available in 2.2.5 but based on 
the github code, we ran the following code to reserialize our dags
   
   ```from airflow.models import DagBag
   from airflow.models.serialized_dag import SerializedDagModel
   from airflow.settings import Session
   
   session = Session()
   session.query(SerializedDagModel).delete(synchronize_session=False)
   session.commit()
   
   dagbag = DagBag()
   dagbag.collect_dags(only_if_updated=False, safe_mode=False)
   dagbag.sync_to_db()
   ```
   
   But that too doesn't seem to work as the dags still were giving import 
errors. 
   Interestingly enough if I duplicate the same dag code in a new Dag in a new 
file, it runs without giving any import error.


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