This is not a direct answer to your question, but bean-downloads 
needs-update, available here 
<https://github.com/redstreet/beancount_reds_importers> (which your 
original thread finally nudged me to do) is what I use, and it solves 
several other annoyances that a BQL approach had for me, including easy 
configurability. It filters out 
<https://github.com/redstreet/beancount_reds_importers/blob/b60e97fb80ca1d14cb1e65321b896721f0277da1/beancount_reds_importers/util/needs_update.py#L41-L42>
 
closed accounts as well. See below for the man page:
Usage: bean-download needs-update [OPTIONS] BEANCOUNT_FILE Show a list of 
accounts needing updates, and the date of the last update (which is defined 
as the date of the last balance assertion on the account). Only accounts in 
the included list which are not in the excluded list are considered. Both 
lists are specified as regular expressions. These can be used to include 
only accounts existing in the real world, and filter out those that are not 
interesting (eg: accounts known to not be used often). Commodity leaf 
accounts are ascribed to their parent. The parent's last updated date is 
considered to be the latest date of a balance assertion on any child. 
Closed accounts are filtered out. Accounts matching the criteria above with 
zero balance entries are also printed out, since by definition, they don't 
have a (recent) balance assertion. The BEANCOUNT_FILE environment variable 
can optionally be set instead of specifying the file on the command line. 
The (optional) configuration for this utility is to be supplied as a custom 
directive like the following example in your beancount file: 2010-01-01 
custom "reds-importers" "needs-updates" "{ 'included_account_pats' : 
['^Assets:Banks', '^Assets:Investments', '^Liabilities:Credit-Cards'], 
'excluded_account_pats' : ['.*Inactive', '.*Closed'] }}" Default values for 
the configuration are: 2010-01-01 custom "reds-importers" "needs-updates" 
"{ 'included_account_pats' : ['^Assets:', '^Liabilities:'], 
'excluded_account_pats' : [] }}" Options: --recency INTEGER How many days 
ago should the last balance assertion be to be considered old [default: 15] 
--sort-by-date Sort output by date (instead of account name) --all-accounts 
Show all account (ignore include/exclude in config) --help Show this 
message and exit. 
​


On Monday, September 2, 2024 at 8:42:27 PM UTC-7 [email protected] wrote:

> I found a query to help remind me which accounts need attention from this 
> conversation 
> <https://groups.google.com/g/beancount/c/MJYbx6Au7TM/m/yw-sr3PJAQAJ> last 
> year:
>
>     SELECT account, max(date) as date FROM #balances GROUP BY account 
> ORDER BY date
>
> Is there any "WHERE not close"d option? I tried the postings-table 
> close_date function, but...
>
>     SELECT account, max(date) as date FROM #balances WHERE NOT 
> close_date(account) GROUP BY account ORDER BY date
> error: 
> ...
> AttributeError: 'Balance' object has no attribute 'open_close_map'
>
> I wasn't sure if this "implement balances ... where syntax 
> <https://github.com/beancount/beanquery/issues/180>" issue was related. 
> It's not terrible to script picking balances out of the directives list in 
> python, but seems so close to a simple query-based solution.
>
> Thanks,
> Paul
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/a5e223b1-15df-4044-92df-34d5a6f2ec86n%40googlegroups.com.

Reply via email to