question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

metadata cli: support JSON-formatted output

See original GitHub issue

Some CLIs (docker comes to mind) support optional JSON-formatted output to allow for programatic result processing to automate certain tasks, such as testing, migration etc. It would be nice if elyra-metadata would support a flag (for example) that the user can specify to have the results returned as a JSON document, which can be easily parsed using jq.

Example of current output:

$ elyra-metadata list code-snippets
Available metadata instances for code-snippets (includes invalid):

Schema         Instance   Resource                                                            
------         --------   --------                                                            
code-snippet   a          /Users/patti/Library/Jupyter/metadata/code-snippets/a.json          
code-snippet   aaa        /Users/patti/Library/Jupyter/metadata/code-snippets/aaa.json        
code-snippet   b          /Users/patti/Library/Jupyter/metadata/code-snippets/b.json          
code-snippet   c          /Users/patti/Library/Jupyter/metadata/code-snippets/c.json          
code-snippet   copyright  /Users/patti/Library/Jupyter/metadata/code-snippets/copyright.json  
code-snippet   s          /Users/patti/Library/Jupyter/metadata/code-snippets/s.json      

vs

$ elyra-metadata list code-snippets --format JSON
[
  {
    ...
  },
 {
   ...
  }
]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
kevin-batescommented, Jul 9, 2020

I didn’t see the option when I tried 1.0.0 b1 and don’t recall it being mentioned in the change log.

No worries - the option has been there since the tool existed.

I’m in favor of changing the functionality of --json so that it ONLY displays JSON (as array elements) and tolerates being piped to JSON-aware tools.

@lresende - are you okay with that?

1reaction
ptitzlercommented, Jul 9, 2020

If we add these to the Metadata class…

from elyra.metadata import MetadataManager
print(MetadataManager('code-snippets').get_all())

A programming language agnostic approach would be more user friendly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting the AWS CLI output format - AWS Documentation
The AWS CLI supports the following output formats: json – The output is formatted as a JSON string. yaml – The output is...
Read more >
put-metadata — AWS CLI 2.9.1 Command Reference
The JSON string follows the format provided by --generate-cli-skeleton . If other arguments are provided on the command line, those values will override...
Read more >
source Commands | Salesforce CLI Command Reference
sfdx force:source:convert: [ --json ]: [ --loglevel LOGLEVEL]: [ -r ROOTDIR] ... Output directory to store the Metadata API–formatted files in.
Read more >
Setting Vault CLI output format - Hashicorp Support
table (Default): The output is presented in a "human-friendly" format. · json: The output is formatted as a JSON string. · yaml: The...
Read more >
Setting up JSON metadata for an output file - 8.0
Available in... Open Studio for Big Data Open Studio for Data Integration Open Studio for ESB This section describes how to define JSON...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found