athenacli icon indicating copy to clipboard operation
athenacli copied to clipboard

json output format

Open mooreniemi opened this issue 2 years ago • 4 comments
trafficstars

This output list is exhaustive, and json is not supported today, right?

When I try --table-format "json", I get unrecognized format_name "json". It seems weird to me that html is supported but not just json.

mooreniemi avatar Aug 05 '23 20:08 mooreniemi

The list in the docs in not exhaustive, but the comment in the CLI config file should be:

https://github.com/dbcli/athenacli/blob/c9e477447345a28b070badb014bfd2c6679cc902/athenacli/athenaclirc#L45-L49

athenacli uses cli_helpers to do output formatting, which in return uses tabulate. https://pypi.org/project/tabulate/. json is not supported by tabulate, I would guess because it's not really a tabular format.

j-bennet avatar Aug 06 '23 02:08 j-bennet

@mooreniemi thanks for the feedback. Unfortunately, we don't support json format now. I think that's the great idea to support it.

zzl0 avatar Aug 06 '23 12:08 zzl0

Ok, I am not sure I will have time but if you point me to where a potential refactoring point is to add it, I may be able to help.

mooreniemi avatar Aug 07 '23 00:08 mooreniemi

@mooreniemi You would add a new adapter here:

https://github.com/dbcli/cli_helpers/tree/main/cli_helpers/tabular_output

For an example, take a look at this PR, which was adding a tsv adapter:

https://github.com/dbcli/cli_helpers/pull/47

j-bennet avatar Aug 07 '23 19:08 j-bennet