Using bean-query programmatically

67 views
Skip to first unread message

Chary Chary

unread,
Aug 10, 2020, 8:21:19 AM8/10/20
to Beancount
All documentation about bean-query assumes, that query is issues manually from command line and then output is also read from the screen.

But what if I want to use bean-query engine programmatically? 

Meaning that I would issue bean-query from my python script, capture output and then will do something else with this output.

What is the best way to do this? 

Martin Michlmayr

unread,
Aug 10, 2020, 8:26:32 AM8/10/20
to bean...@googlegroups.com
* Chary Chary <char...@gmail.com> [2020-08-10 05:21]:
> All documentation about bean-query assumes, that query is issues
> manually from command line and then output is also read from the
> screen.

I think that is because in most cases you'd use the Python API to do
the things you want to do directly.

> But what if I want to use bean-query engine programmatically?

Look at query.run_query()

Examples that make use of it are:

beancount/plugins/split_expenses.py
experiments/misc/monthly_balance.py

--
Martin Michlmayr
https://www.cyrius.com/

Chary Chary

unread,
Aug 10, 2020, 10:48:27 AM8/10/20
to Beancount
Martin,

thanks!

Reply all
Reply to author
Forward
0 new messages