Skip to content

Commit

Permalink
Handle None values properly when CLI output is YAML/JSON format (#13024)
Browse files Browse the repository at this point in the history
str() should not be applied to None when we 'normalize' the data before we print it,
otherwise it's not given in proper format in YAML/JSON format of the CLI output
  • Loading branch information
XD-DENG authored Dec 12, 2020
1 parent ab250ec commit 5057f56
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions airflow/cli/simple_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def _normalize_data(self, value: Any, output: str) -> Union[list, str, dict]:
return [self._normalize_data(x, output) for x in value]
if isinstance(value, dict) and output != "table":
return {k: self._normalize_data(v, output) for k, v in value.items()}
if value is None:
return None
return str(value)

def print_as(self, data: List[Union[Dict, Any]], output: str, mapper: Optional[Callable] = None):
Expand Down

0 comments on commit 5057f56

Please sign in to comment.