Thank you for looking into this
I think there is the slight difference in that I am adding costs to the
transactions
Here is my minimal repro file:
plugin "beancount.plugins.auto_accounts"
2024-01-01 * "Test"
Expenses:Test
Assets:MyAsset 1.0 TEST {1.0 USD}
2024-01-02 * "Test"
Expenses:Test
Assets:MyAsset 1.0 TEST {1.0 USD}
2024-01-03 * "Test"
Expenses:Test
Assets:MyAsset 1.0 TEST {1.0 USD}
And my test script:
import beanquery
path = "path/to/file.beancount"
conn = beanquery.connect('beancount:' + path)
curs = conn.execute('''
SELECT sum(position)
WHERE date <= 2024-04-01 AND account ~ "Assets:MyAsset"
''')
print(curs.fetchall())
Result:
[((1.0 TEST {1.0 USD, 2024-01-01}, 1.0 TEST {1.0 USD, 2024-01-02}, 1.0 TEST
{1.0 USD, 2024-01-03}),)]
On Friday, January 10, 2025 at 1:12:05 AM UTC-8 [email protected] wrote:
> 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/014f1176-3f0f-497f-a562-bad8008df81cn%40googlegroups.com.