maahir22 commented on code in PR #30432:
URL: https://github.com/apache/airflow/pull/30432#discussion_r1155342153


##########
airflow/cli/commands/dag_command.py:
##########
@@ -343,6 +344,24 @@ def dag_list_dags(args):
     )
 
 
+@cli_utils.action_cli
+@suppress_logs_and_warning
+@provide_session
+def dag_details(args, session=NEW_SESSION):
+    """Get DAG details given a DAG id"""
+    dag = DagModel.get_dagmodel(args.dag_id, session=session)
+    if not dag:
+        raise SystemExit(f"DAG: {args.dag_id} does not exist in 'dag' table")
+    dag_detail = dag_schema.dump(dag)
+    for key, value in dag_detail.items():
+        if isinstance(value, dict):
+            print(f"\t{key}:")
+            for subkey, subvalue in value.items():
+                print(f"\t\t{subkey}: {subvalue}")
+        else:
+            print(f"\t{key}: {value}")

Review Comment:
   Are you sure you want to do that @potiuk, @hussein-awala ? The default 
fallback when no --output option is provided is table -> so args.output becomes 
table by default, the SimpleTable isn't able to render such a large table 
properly due to the number of parameters and the length of these fields - most 
devices won't be able to display this output in a comprehensible way.
   To standardise the approach, I've switched to AirflowConsole(), with a 
caveat that "table" isn't allowed as an output option - if it's received "yaml" 
output is displayed instead.
   
   <h2> Table/Default Format </h2>
   ![table](https://i.ibb.co/nLSJdth/Screenshot-2023-04-02-at-9-58-34-PM.png)
   <br>
   
   <h2> JSON Format </h2>
   ![json](https://i.ibb.co/hCF6Vbj/Screenshot-2023-04-02-at-9-55-14-PM.png)
   <br>
   
   <h2> YAML Format </h2>
   ![yaml](https://i.ibb.co/7KWVPDg/Screenshot-2023-04-02-at-9-54-43-PM.png)
   <br>
   
   <h2> Plain Format </h2>
   ![plain](https://i.ibb.co/4P4rmNQ/Screenshot-2023-04-02-at-9-56-08-PM.png)
   <br>
   



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