Dear all,
I have a question about the so called two-level filtering syntax on the "traditional" beanquery. Under the traditional beanquery I mean the beanquery which does not use
the FROM #<table_name> form
For this reason, we modify the SQL SELECT syntax to provide a two-level filtering syntax: since we have a single table of data, we replace the table name in FROM by a filtering expression which applies over transactions, and the WHERE clause applies to data pulled from the resulting list of postings:
If however one compares the .help FROM and .help WHERE then one can find, that all of the fields available in the .help FROM are also available in the .help WHERE, which makes one wonder whether the FROM clause filtering in needed at all in this two-level filtering?
I am just guessing, that this may be a historical thing, where originally may be there was a separation of the fields, but later on all of the FROM fields where also made available for WHERE filtering.
Or am I missing something?
================================
beanquery> .help FROM
A logical expression that consist of columns on directives (mostly
transactions) and simple functions.
Columns
-------
id: str
Unique id of a directive.
type: str
The data type of the directive.
filename: str
The filename where the directive was parsed from or created.
lineno: int
The line number from the file the directive was parsed from.
date: date
The date of the directive.
year: int
The year of the date year of the directive.
month: int
The year of the date month of the directive.
day: int
The year of the date day of the directive.
flag: str
The flag the transaction.
payee: str
The payee of the transaction.
narration: str
The narration of the transaction.
description: str
A combination of the payee + narration of the transaction, if present.
tags: set
The set of tags of the transaction.
links: set
The set of links of the transaction.
meta: dict
accounts: set[str]
beanquery> .help WHERE
A logical expression that consist of columns on postings and simple
functions.
Columns
-------
type: str
id: str
Unique id of a directive.
date: date
The date of the directive.
year: int
The year of the date year of the directive.
month: int
The year of the date month of the directive.
day: int
The year of the date day of the directive.
filename: str
The ledger where the posting is defined.
lineno: int
The line number in the ledger file where the posting is defined.
location: str
The filename:lineno location where the posting is defined.
flag: str
The flag of the parent transaction for this posting.
payee: str
The payee of the parent transaction for this posting.
narration: str
The narration of the parent transaction for this posting.
description: str
A combination of the payee + narration for the transaction of this posting.
tags: set
The set of tags of the parent transaction for this posting.
links: set
The set of links of the parent transaction for this posting.
posting_flag: str
The flag of the posting itself.
account: str
The account of the posting.
other_accounts: set
The list of other accounts in the transaction, excluding that of this posting.
number: decimal
The number of units of the posting.
currency: str
The currency of the posting.
cost_number: decimal
The number of cost units of the posting.
cost_currency: str
The cost currency of the posting.
cost_date: date
The cost currency of the posting.
cost_label: str
The cost currency of the posting.
position: position
The position for the posting. These can be summed into inventories.
price: amount
The price attached to the posting.
weight: amount
The computed weight used for this posting.
balance: inventory
The balance for the posting. These can be summed into inventories.
meta: dict
entry: transaction
accounts: set[str]