Beancount INquiry tool to inject parameters into a query directive

37 views
Skip to first unread message

Oscar & Ale

unread,
Sep 15, 2025, 3:14:59 PM (4 days ago) Sep 15
to bean...@googlegroups.com
Hello everyone, in case someone else may find this useful, I created a small cli tool called `bean-inquiry` to help run queries with parameters, based on the discussion here: https://groups.google.com/g/beancount/c/td18CgN1y-0/m/zK2oeiz-BgAJ.

You can write your query directive like so in your ledger:

```
2025-01-01 query "balance" "SELECT date, narration, account, position WHERE account ~ '{}' AND year >= {}"
```

And then run `bean-inquiry` like so:

```
bean-inquiry ledger.beancount balance Assets 2025
```

Indexed placeholders `{0}, {1}` and named placeholders `{account}, {year}` work as well. Just specify the key of the placeholder like so:

```
2025-01-01 query "balance" "SELECT date, narration, account, position WHERE account ~ '{account}' AND year >= {year}"
...
bean-inquiry ledger.beancount balance account:Assets year:2025
```

I believe this is something that is in the works for `beanquery` based on the discussion here: https://github.com/beancount/beanquery/issues/249 but in the meantime, I have found this pretty helpful and wanted to share it. It is available on PyPi here: https://pypi.org/project/bean-inquiry/. To install it I recommend using pipx `pipx install bean-inquiry`


Thanks!

Oscar & Ale
ma...@aleyoscar.com

Timothy Jesionowski

unread,
Sep 15, 2025, 5:30:07 PM (4 days ago) Sep 15
to bean...@googlegroups.com
This looks really neat, thanks for publishing!



Sincerely,
Timothy Jesionowski

--
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 beancount+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/beancount/48cdbe610d64e5a947489f98c113aa44e0bb46d1%40aleyoscar.com.
Reply all
Reply to author
Forward
0 new messages