-
Notifications
You must be signed in to change notification settings - Fork 16.6k
Description
Apache Airflow version
main (development)
What happened?
airflowctl pools export accepts --output table|yaml|plain via ARG_OUTPUT (defined in cli_config.py:208-218), but only the json format is properly handled. For all other formats, the command falls through to rich.print(pools_list) which outputs the raw Python list-of-dicts representation.
The AirflowConsole class in console_formatting.py already provides proper formatting for all 4 output formats via its print_as() method, but pool_command.py:export() doesn't use it.
What you think should happen instead?
Non-json formats should produce properly formatted output:
--output table→ rich table with columns (name, slots, description, ...)--output yaml→ YAML text--output plain→ plain tabulated output suitable for piping
This is the behavior provided by AirflowConsole().print_as() and used by auto-generated list commands elsewhere in airflow-ctl.
How to reproduce
- Start Airflow with at least one pool configured (the
default_poolis always present) - Run:
airflowctl pools export --output table pools.json
Actual output:
[{'name': 'default_pool', 'slots': 128, 'description': 'Default pool', ...}]
(Raw Python list repr via rich.print())
Expected output:
A formatted table, similar to other --output table commands.
The same issue occurs with --output yaml and --output plain.
Code reference — airflow-ctl/src/airflowctl/ctl/commands/pool_command.py:74-81:
if args.output == "json":
file_path = Path(args.file)
with open(file_path, "w") as f:
json.dump(pools_list, f, indent=4, sort_keys=True)
rich.print(f"Exported {pools_response.total_entries} pool(s) to {args.file}")
else:
# For non-json formats, print the pools directly to console
rich.print(pools_list)Operating System
Linux
Versions of Apache Airflow Providers
N/A
Deployment
Other
Deployment details
Breeze development environment
Anything else?
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct