Issue #285: Query result should be empty string instead of None so ORDER BY can work (blais/beancount)

11 views
Skip to first unread message

Martin Michlmayr

unread,
Apr 23, 2018, 6:54:18 AM4/23/18
to bean...@googlegroups.com
New issue 285: Query result should be empty string instead of None so ORDER BY can work
https://bitbucket.org/blais/beancount/issues/285/query-result-should-be-empty-string

Martin Michlmayr:

I'm trying to do an `ORDER BY` query but I get an error because some results don't have values:

```
beancount> select account, any_meta('who'), sum(position) WHERE account ~ 'Assets:Receivable' GROUP BY 1, 2
account any_me sum_positi
----------------- ------ ----------
Assets:Receivable Martin 100.00 EUR
Assets:Receivable 100.00 EUR
beancount>
```

With `ORDER BY 2`:

```
beancount> select account, any_meta('who'), sum(position) WHERE account ~ 'Assets:Receivable' GROUP BY 1, 2 ORDER BY 2
Traceback (most recent call last):
File "/usr/lib/python3.5/cmd.py", line 214, in onecmd
func = getattr(self, 'do_' + cmd)
AttributeError: 'BQLShell' object has no attribute 'do_select'
...
File "/home/tbm/.local/lib/python3.5/site-packages/beancount/query/query_execute.py", line 328, in execute_query
reverse=(query.ordering == 'DESC'))
TypeError: unorderable types: NoneType() < str()
```

Test case:

```
plugin "beancount.plugins.auto"

2018-04-22 * "Test 1"
Assets:Receivable 100.00 EUR
who: "Martin"
Assets:Bank -100.00 EUR

2018-04-22 * "Test 2"
Assets:Receivable 100.00 EUR
Assets:Bank -100.00 EUR
```


Reply all
Reply to author
Forward
0 new messages