andreasgerstmayr / fava-dashboards

Custom Dashboards for Beancount in Fava
MIT License
143 stars 17 forks source link

Query issue: no function matches "ymonth(date)" name and argument types #72

Open pallavg opened 3 days ago

pallavg commented 3 days ago

I upgraded to latest fava-dashboards version. I'm seeing this error on my dashboard now:

error processing panel "Essentials MoM 🍔": failed to execute query SELECT YMONTH(date) AS date, CONVERT(SUM(position), 'USD') AS value WHERE account ~ '^Expenses:Food:Groceries': no function matches "ymonth(date)" name and argument types

I'm using beancount 2.3.6. If I run the exact same query on the query editor in fava I get a result. Any idea how to resolve this?

Not sure which package is the issue coming from.

andreasgerstmayr commented 2 days ago

I recently switched from beancount.query to beanquery, which is actively maintained and the successor of the BQL engine in beancount. See https://groups.google.com/g/beancount/c/iTdRuvZnE4E/m/o9V91WfgFQAJ for the deprecation notice.

beanquery is almost a drop-in replacement, but the function ymonth() you're using in your query got renamed to yearmonth(). Can you confirm that with this change the query works again?

pallavg commented 2 days ago
  1. That works OK now.

  2. But another query is failing but works OK on editor:

SELECT year, CONVERT(SUM(position), 'USD', LAST(date)) AS value WHERE account ~ "^Assets:US:Fidelity:401K:Cash" and 'XXX Payroll' in narration GROUP BY year: operator "in(str, str)" not supported

andreasgerstmayr commented 1 day ago

I've seen the IN operator only used to check if value X is in a set Y.

afaics the correct query in this case is

SELECT year, CONVERT(SUM(position), 'USD', LAST(date)) AS value WHERE account ~ "^Assets:US:Fidelity:401K:Cash" and narration ~ 'XXX Payroll' GROUP BY year