-
-
Notifications
You must be signed in to change notification settings - Fork 242
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
Support CSV output where JSON is allowed #281
Conversation
Keep it up @davidag! 🙏 |
@jmaupetit if you give me the okay, I can squash the commits to prepare the merge... or make changes if needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nitpick, but LGTM otherwise 👍 .
@jmaupetit @k4nar I think there's something not working with Python 3.4, it looks related to Arrow compatibility:
Maybe Python 3.4 support should be dropped? |
@davidag : We should probably born arrow to |
@k4nar : I see how that can solve the issue, but I'm not sure I understand why Watson must still support Python 3.4, taking into account this message in travis:
You can see other Python projects dropping support for Python 3.4 some months ago. For example, Pelican. If you still want to support it, I suppose a different PR should be created. |
Good point @davidag! I think we should drop support for python 3.4 in a new PR. |
847f97a
to
9521d7a
Compare
@jmaupetit: Rebased, squashed and added a changelog entry. Ready to merge? 🎉 |
- New option --csv/-s in report, log and aggregate commands, mutually exclusive with --json/-j. - New hidden option --plain to handle the default output format in report, aggregate and log commands (i.e. plain text). This option is not intended to be used by the final user. - Add support in MutuallyExclusiveOption for options with an internal name different from the ones permitted in the command line.
In response to #256, which seems like an interesting use case to me, I've started to implement CSV format support in the same places where JSON is currently allowed (log/report/aggregate).
Some things are still missing, but I've created the PR to get early feedback (as suggested in the guidelines :).
TODO
MutuallyExclusiveOption
prints an invalid error message when specifying an option internal name, which is the case of-j/--json
(i.e.format_json
).--format
should be added (as discussed on Support JSON output in report command #102).cli.py
utils.py
Cli options
log
,report
andaggregate
:CSV format
Design decisions
csv
classes are instantiated with the default dialect, i.e. Excel.yyyy-MM-dd HH:mm:ss
according to this link)Examples
$ watson log --csv
$ watson report --csv
$ watson aggregate --csv