Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json output format #78

Open
mooreniemi opened this issue Aug 5, 2023 · 4 comments
Open

json output format #78

mooreniemi opened this issue Aug 5, 2023 · 4 comments

Comments

@mooreniemi
Copy link

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.

@j-bennet
Copy link

j-bennet commented Aug 6, 2023

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

# Table format. Possible values: ascii, double, github,
# psql, plain, simple, grid, fancy_grid, pipe, orgtbl, rst, mediawiki, html,
# latex, latex_booktabs, textile, moinmoin, jira, vertical, tsv, csv.
# Recommended: ascii
table_format = ascii

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.

@zzl0
Copy link
Contributor

zzl0 commented Aug 6, 2023

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

@mooreniemi
Copy link
Author

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.

@j-bennet
Copy link

j-bennet commented Aug 7, 2023

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

dbcli/cli_helpers#47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants