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
```


-- 
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 beancount+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20180423105416.26151.84381%40celery-worker-106.ash1.bb-inf.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to