Did you already try : 
STR(ANY_META('trip')) != null ??

I think null is use by BQL to represent Python's None. 

As a sidenote, != null is not "sql"-like since in sql, IS NULL/ IS NOT NULL 
expressions are used instead. These are special since the = operator is 
strict i.e returns NULL if any of its operand is NULL. That means in a 
WHERE clause, the NULL results work like 'false'.

On Saturday, September 29, 2018 at 12:38:41 AM UTC-5, Stefano Zacchiroli 
wrote:
>
> New issue 335: BQL: None should be considered False in boolean context 
>
> https://bitbucket.org/blais/beancount/issues/335/bql-none-should-be-considered-false-in
>  
>
> Stefano Zacchiroli: 
>
> The following query: 
> ``` 
> #!bql 
>
> SELECT ANY_META('trip') AS trip, SUM(position) AS amount 
> WHERE account ~ '^Assets:Reimbursable' 
> AND ANY_META('trip') 
> GROUP BY trip 
> ``` 
> when 'trip' might be missing from some transaction fails as follows: 
> ``` 
> #!python 
>
>   File 
> "/home/zack/.local/lib/python3.6/site-packages/beancount/query/query_compile.py",
>  
> line 121, in __call__ 
>     return self.operator(self.left(context), self.right(context)) 
>   TypeError: unsupported operand type(s) for &: 'bool' and 'str' 
> ``` 
> the string in question is probably "None", i.e., the string representation 
> of Python None values. 
>
> It would be nice if missing metadata could be treated as False in boolean 
> context by BQL. 
>
>
>

-- 
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/71f2dfbc-b1d7-46a6-9355-63072600e108%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to