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
[email protected]
--
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 view this discussion visit
https://groups.google.com/d/msgid/beancount/48cdbe610d64e5a947489f98c113aa44e0bb46d1%40aleyoscar.com.