iterative / ldb

Apache License 2.0
3 stars 0 forks source link

query command #488

Closed jonburdo closed 2 years ago

jonburdo commented 2 years ago

We need a command that works like jq, but runs queries like ldb eval --query <query> to run queries on plain json files without indexing them first. The examples should be possible:

ldb query 'class == inference.class' file1.json file2.json
cat file1.json | ldb query 'class == inference.class'

Alternatively the eval command could be adjusted to handle this.

This should include:

  1. Handling of filtering and selecting separately (i.e. like "where" vs "select" statements). For example it might use --query for filtering and another option like --select for the jmespath expression whose result will be shown. Note the eval command just uses --query for both and evaluates only the last --query (or --file) option given. This logic arose since eval was intended for debugging, but this is too confusing and should be changed later too.
  2. The ability to handle separate json objects separately or as members of a top-level array (i.e. something like jq's --slurp option).