New issue 347: Bean-query flatten features throws error https://bitbucket.org/blais/beancount/issues/347/bean-query-flatten-features-throws-error
Trevor Davis: According to this e-mail in the beancount mailing list you suggested that the "flatten" feature in ``bean-query`` now works: https://groups.google.com/d/msg/beancount/p5_pEz3QiiA/SBk3sotfEQAJ However when I tried to use it I get the following error: ``AttributeError: 'BQLShell' object has no attribute 'do_select'`` What I was trying to do was get a version of the "holdings" report with the decimal number of the units column extended from hundredths place to the thousandths place (i.e. report 5.235 shares at a given cost instead of 5.24 shares at a given cost). I need to manually compute capital gains in my HSA account since my provider doesn't track that information at all (but California in their infinite wisdom requires that I pay taxes on them) and right now it is a little bit of trial and error figuring out what my exact cost holdings in the HSA account are since the "holdings" report truncates a digit off my holdings and my provider doesn't track that at all since it isn't a federal requirement for them to do so. ``` $ cat minimal.beancount plugin "beancount.plugins.implicit_prices" plugin "beancount.plugins.sellgains" option "operating_currency" "USD" 2018-01-01 open Assets:Brokerage 2018-01-01 open Equity:Transfer 2018-01-01 open Income:CG:ST 2018-01-01 * "" "Buy 5 Shares" Assets:Brokerage 5 SHARE {100 USD} Equity:Transfer 2018-02-05 * "" "Buy 5 Shares" Assets:Brokerage 5 SHARE {200 USD} Equity:Transfer 2018-03-05 * "" "Sell 3 Shares" Assets:Brokerage -2 SHARE {100 USD} @ 150 USD Assets:Brokerage -1 SHARE {200 USD} @ 150 USD Income:CG:ST -50 USD Equity:Transfer $ bean-check minimal.beancount $ bean-report minimal.beancount holdings Account Units Currency Cost Currency Average Cost Price Book Value Market Value ---------------- ----- -------- ------------- ------------ ------ ---------- ------------ Assets:Brokerage 3.00 SHARE USD 100.00 150.00 300.00 450.00 Assets:Brokerage 4.00 SHARE USD 200.00 150.00 800.00 600.00 ---------------- ----- -------- ------------- ------------ ------ ---------- ------------ $ bean-query minimal.beancount "select account, cost(sum(position)), value(sum(position)) where account ~ 'Assets:' group by account flatten" Traceback (most recent call last): File "/usr/lib/python3.6/cmd.py", line 214, in onecmd func = getattr(self, 'do_' + cmd) AttributeError: 'BQLShell' object has no attribute 'do_select' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/beancount-2.2.0_devel-py3.6-linux-x86_64.egg/beancount/query/shell.py", line 271, in run_parser self.dispatch(statement) File "/usr/local/lib/python3.6/dist-packages/beancount-2.2.0_devel-py3.6-linux-x86_64.egg/beancount/query/shell.py", line 251, in dispatch return method(statement) File "/usr/local/lib/python3.6/dist-packages/beancount-2.2.0_devel-py3.6-linux-x86_64.egg/beancount/query/shell.py", line 419, in on_Select self.options_map) File "/usr/local/lib/python3.6/dist-packages/beancount-2.2.0_devel-py3.6-linux-x86_64.egg/beancount/query/query_execute.py", line 380, in execute_query result_types, result_rows = flatten_results(result_types, result_rows) File "/usr/local/lib/python3.6/dist-packages/beancount-2.2.0_devel-py3.6-linux-x86_64.egg/beancount/query/query_execute.py", line 421, in flatten_results value = value[irow] if irow < len(value) else None KeyError: 0 ``` -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/20181213200035.4746.2822%40celery-worker-112.ash1.bb-inf.net. For more options, visit https://groups.google.com/d/optout.
