ephraimbuddy commented on code in PR #36739:
URL: https://github.com/apache/airflow/pull/36739#discussion_r1450324722
##########
airflow/cli/simple_table.py:
##########
@@ -118,8 +118,9 @@ def print_as(
dict_data = data
else:
raise ValueError("To tabulate non-dictionary data you need to
provide `mapper` function")
- dict_data = [{k: self._normalize_data(v, output) for k, v in
d.items()} for d in dict_data]
- renderer(dict_data)
+ dict_data = [{k: self._normalize_data(v, output) for k, v in
d.items()} for d in dict_data if d]
+ if dict_data:
+ renderer(dict_data)
Review Comment:
Still needed?
##########
airflow/cli/commands/dag_command.py:
##########
@@ -375,15 +409,18 @@ def dag_list_dags(args, session=NEW_SESSION) -> None:
file=sys.stderr,
)
- def get_dag_detail(dag: DAG) -> dict:
+ def get_dag_detail(dag: DAG) -> dict | None:
Review Comment:
```suggestion
def get_dag_detail(dag: DAG) -> dict:
```
##########
airflow/cli/commands/dag_command.py:
##########
@@ -375,15 +409,18 @@ def dag_list_dags(args, session=NEW_SESSION) -> None:
file=sys.stderr,
)
- def get_dag_detail(dag: DAG) -> dict:
+ def get_dag_detail(dag: DAG) -> dict | None:
dag_model = DagModel.get_dagmodel(dag.dag_id, session=session)
- dag_detail = dag_schema.dump(dag_model)
+ if dag_model:
+ dag_detail = dag_schema.dump(dag_model)
+ else:
+ dag_detail = _get_dagbag_dag_details(dag)
return {col: dag_detail[col] for col in valid_cols}
AirflowConsole().print_as(
data=sorted(dagbag.dags.values(), key=operator.attrgetter("dag_id")),
output=args.output,
- mapper=get_dag_detail,
+ mapper=get_dag_detail, # type: ignore[arg-type]
Review Comment:
```suggestion
mapper=get_dag_detail,
```
I don't think we need this anymore
--
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]