Oh wow, that's cool, I didn't realize it could do that on the cmdline. We'll build some Beancount helpers for petl. I love most things about petl.
On Thu, Apr 15, 2021 at 6:51 PM Ben Blount <b...@bben.us> wrote: > Why not write small python scripts whenever you want to do a query? You > could have pre-written scripts with bindable parameters. You could even go > as far as to accept python snippets from the command line, similarly to > how petl does. > <https://petl.readthedocs.io/en/stable/intro.html#petl-executable> > > On Thu, Apr 15, 2021 at 3:16 PM Daniele Nicolodi <dani...@grinta.net> > wrote: > >> On 15/04/2021 23:27, Martin Blais wrote: >> > >> > entries, _, __ = loader.load_file(filename) >> > for entry in data.filter_txns(entries): >> > if <condition>: >> > continue >> > printer.print_entry(entry) >> > >> >> My goal is to be able to do something like this: >> >> $ foobar.py ledger.beans --where="META('foo') = 'bar'" >> >> to have my tool operate on a selection of the entries in ledger.beans. I >> don't want to have to re-invent a DSL for specifying the --where option, >> and I think a BQL expression is a fairly nice solution. >> >> Cheers, >> Dan >> >> -- >> 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+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/beancount/890a57f0-bb7c-4dfc-34f6-01eda6fff46d%40grinta.net >> . >> > -- > 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+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beancount/CACGEkZs4Jocphm9DVsr5dOtYwNLN4O-%3D%3DGTVOk%2Bg1XqYneGFcg%40mail.gmail.com > <https://groups.google.com/d/msgid/beancount/CACGEkZs4Jocphm9DVsr5dOtYwNLN4O-%3D%3DGTVOk%2Bg1XqYneGFcg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhNWJsp1yDAZam_B7cY3HBL2bCf6dUPc3CrAk0UUhFzznA%40mail.gmail.com.