On 10/01/25 07:31, E wrote:
I was able to get the aggregate by passing the resulting rows to numberify_results, though I really don't understand why that was necessary, as an API it makes it quite confusing, so maybe I'm still not fully grasping how beanquery works, but at least I got past that

That's not how things should work. You must be doing something wrong somewhere. Here your example works just fine:

>>> import beanquery
>>> conn = beanquery.connect('beancount:tests/test52.beans')
>>> curs = conn.execute('''
...   SELECT sum(position)
...   WHERE date <= 2024-04-01 AND account ~ "Assets:MyAsset"
... ''')
>>> curs.fetchall()
[((3.0 TEST),)]

where tests/test52.beans is this:

plugin "beancount.plugins.auto_accounts"

2024-01-01 * "Test"
  Assets:MyAsset  1.0 TEST
  Expenses:Test

2024-01-02 * "Test"
  Assets:MyAsset  1.0 TEST
  Expenses:Test

2024-01-03 * "Test"
  Assets:MyAsset  1.0 TEST
  Expenses:Test

I don't think there has been any point in time where this did not work in exactly this way in beanquery. Can you please show which unexpected result you obtain?

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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/beancount/18142564-7668-4672-b282-cdb3b706e1b8%40grinta.net.

Reply via email to