You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/11/17 09:17:02 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #19471: Add cli command for 'airflow dags reserialize`

uranusjr commented on a change in pull request #19471:
URL: https://github.com/apache/airflow/pull/19471#discussion_r751042377



##########
File path: airflow/cli/commands/dag_command.py
##########
@@ -441,3 +442,10 @@ def dag_test(args, session=None):
             _display_dot_via_imgcat(dot_graph)
         if show_dagrun:
             print(dot_graph.source)
+
+
+@provide_session
+@cli_utils.action_logging
+def dag_reserialize(args, session=None):
+    session.query(SerializedDagModel).delete()
+    session.commit()

Review comment:
       ```suggestion
   @provide_session
   @cli_utils.action_logging
   def dag_reserialize(args, session=None):
       session.query(SerializedDagModel).delete(synchronize_session=False)
   ```
   
   Skip synchronisation to make the operation slightly faster. The session is going to end immediately after this so there’s no point to keep things in sync.
   
   The `provide_session` decorator calls `commit()` automatically, we don’t need to do that again.




-- 
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-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org