query: add --warn-exceptions, dateparser, docs

added --warn-exceptions (like --raise-exceptions/--drop-exceptions, but
lets you pass a warn_func if you want to customize how the exceptions are
handled. By default this creates a logger in main and logs the exception

added dateparser as a fallback if its installed (it's not a strong dependency, but
I mentioned in the docs that it's useful for parsing dates/times)

added docs for query, and a few examples

--output gpx respects the --{drop,warn,raise}--exceptions flags, have
an example of that in the docs as well
This commit is contained in:
Sean Breckenridge 2023-04-15 12:09:47 -07:00
parent 82bc51d9fc
commit a58fef0d06
7 changed files with 404 additions and 24 deletions

View file

@ -531,7 +531,7 @@ If you like the shell or just want to quickly convert/grab some information from
#+begin_src bash
$ hpi query my.coding.commits.commits --stream # stream JSON objects as they're read
--order-type datetime # find the 'datetime' attribute and order by that
--after '2020-01-01 00:00:00' --before '2020-12-31 23:59:59' # in 2020
--after '2020-01-01' --before '2021-01-01' # in 2020
| jq '.committed_dt' -r # extract the datetime
# mangle the output a bit to group by month and graph it
| cut -d'-' -f-2 | sort | uniq -c | awk '{print $2,$1}' | sort -n | termgraph
@ -552,6 +552,8 @@ If you like the shell or just want to quickly convert/grab some information from
2020-12: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 383.00
#+end_src
See [[https://github.com/karlicoss/HPI/blob/master/doc/QUERY.md][query docs]]
for more examples
** Querying Roam Research database
:PROPERTIES: