Hi! I'm trying to use this query in Fava:
SELECT
year, month, root(account, 1) as account, sum(position) as total
WHERE
account ~ "Expenses" OR
account ~ "Liabilities" OR
account ~ "Income"
GROUP BY year, month, account
ORDER BY year, month, account
FLATTEN
but it's throwing this error:
Traceback (most recent call last):
File "C:\Python\Python39\lib\cmd.py", line 214, in onecmd
func = getattr(self, 'do_' + cmd)
AttributeError: 'QueryShell' object has no attribute 'do_SELECT'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python\Python39\lib\site-packages\beancount\query\shell.py", line 271, in run_parser
self.dispatch(statement)
File "C:\Python\Python39\lib\site-packages\beancount\query\shell.py", line 251, in dispatch
return method(statement)
File "C:\Python\Python39\lib\site-packages\fava\core\query_shell.py", line 106, in on_Select
rtypes, rrows = execute_query(c_query, self.entries, self.options_map)
File "C:\Python\Python39\lib\site-packages\beancount\query\query_execute.py", line 381, in execute_query
result_types, result_rows = flatten_results(result_types, result_rows)
File "C:\Python\Python39\lib\site-packages\beancount\query\query_execute.py", line 422, in flatten_results
value = value[irow] if irow < len(value) else None
KeyError: 0
If I remove the FLATTEN operator it works fine, but it's not the result I expect so I would rather use it cause it's really useful for me. Any ideas?