Dear all,

Coming back to this question about the traditional vs #table syntax for the 
SELECT query

On Tuesday, May 6, 2025 at 4:12:28 PM UTC+2 [email protected] wrote:


> In this mode all the additional perks like JOURNAL, OPEN ON, CLOSE ON, 
> BALANCES do not seem to be available. 

Unless there is a bug somewhere, OPEN ON and CLOSE ON are supported also 
when using the new syntax (although they do no always make sense). 
JOURNAL and BALANCES can be thought as macros that expand to a regular 
SELECT query. What do you mean when you write that the new mode does not 
support them? 



If I check at the *beanquery/parser/bql.ebnf 
<https://github.com/beancount/beanquery/blob/master/beanquery/parser/bql.ebnf>* 
language definition file


Then for me it looks, that it is designed so, that OPEN ON, CLOSE ON and 
CLEAR only work in the traditional (not #table) format


select::Select
    = 'SELECT' ['DISTINCT' distinct:`True`] targets:(','.{ target }+ | 
asterisk)
      ['FROM' from_clause:(_table | subselect | from)]
      ['WHERE' where_clause:expression]
      ['GROUP' 'BY' group_by:groupby]
      ['ORDER' 'BY' order_by:','.{order}+]
      ['PIVOT' 'BY' pivot_by:pivotby]
      ['LIMIT' limit:integer]
    ;

subselect
    = '(' @:select ')'
    ;

from::From
    =
    | 'OPEN' ~ 'ON' open:date ['CLOSE' ('ON' close:date | {} close:`True`)] 
['CLEAR' clear:`True`]
    | 'CLOSE' ~ ('ON' close:date | {} close:`True`) ['CLEAR' clear:`True`]
    | 'CLEAR' ~ clear:`True`
    | expression:expression ['OPEN' 'ON' open:date] ['CLOSE' ('ON' 
close:date | {} close:`True`)] ['CLEAR' clear:`True`]
    ;

_table::Table
    =
    | name:/#([a-zA-Z_][a-zA-Z0-9_]*)?/
    | name:quoted_identifier
    ;

Or am I missing something?
 

-- 
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 visit 
https://groups.google.com/d/msgid/beancount/2841dcda-a808-429a-9744-3de433e039cdn%40googlegroups.com.

Reply via email to