The following gives me precisely what I need:
Ā Ā Ā select number(only("USD", sum(position)))
Ā Ā from open on 2020-10-01 close on 2020-11-01
Ā Ā where
Ā Ā Ā Ā account ~ "My:Checking" and
Ā Ā Ā Ā number(units(position)) > 0 and
Ā Ā Ā Ā findfirst("Income:Hooli", other_accounts) != NULL
EXCEPT I'd like a number in Python instead of text output in the terminal. Cribbing from Ben's examples, I came up with the following to run it from Python:
Ā Ā from beancount.query.query_compile import compile
Ā Ā from beancount.query.query_env import FilterPostingsEnvironment, FilterEntriesEnvironment, TargetsEnvironment
Ā Ā from beancount.query.query_execute import execute_query
Ā Ā from beancount.query.query_parser import Parser
Ā Ā from beancount.loader import load_file
Ā Ā entries, errors, options = load_file('my.beancount')
Ā Ā text = '... the query from above ...'
Ā Ā ast = Parser().parse(text)
Ā Ā compiled = compile(ast, TargetsEnvironment(), FilterPostingsEnvironment(), FilterEntriesEnvironment())
Ā Ā columns, results = execute_query(compiled, entries, options)
Thanks again for taking the time to help!