Hi,

I'd like to share a way to query the journal in addition to bean-query. 
Using a simple python script, the beancount journal could be converted to 
JSON. Then one can use command line JSON tools, for example jq 
<https://stedolan.github.io/jq/>, to manipulate and query it. 

Here's the script: b2j.py 
<https://gist.github.com/xiaoruoruo/3fdf8d0f92b3fd85f259b35f888e4257>.

For example:

./b2j.py test.beancount | jq '.[] | select (._type == "Event")'
{
  "meta": {
    "lineno": 50
  },
  "date": "2013-01-01",
  "type": "employer",
  "description": "Ace Corp",
  "_type": "Event"
}
{
  "meta": {
    "lineno": 80
  },
  "date": "2016-01-01",
  "type": "employer",
  "description": "Bob Corp",
  "_type": "Event"
}

Another use case is to query for transactions with certain metadata, which 
currently bean-count doesn't support querying. It's probably very hard for 
jq to do balance reports, but it's quite good at filtering and outputting 
parts of the transactions.

Hope this helps.

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/8d77b57a-23ef-4bcd-9a56-3e14c696aa0d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to