I have been looking at the latest version of beanquery as well as messages 
here and as far as I understand, the only currently available beanquery 
document 
<https://docs.google.com/document/d/1s0GOZMcrKKCLlP29MD7kHO4L88evrwWdIO0p4EwRBE0/edit>is
 
quite out of date with the new features.


Just want to double check my understanding

The documentation says, that 

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:

SELECT <target1>, <target2>, …
FROM <entry-filter-expression>
WHERE <posting-filter-expression>;

Both filtering expressions are optional. If no filtering expressions are 
provided, all postings will be enumerated over. Note that since the 
transactions are always filtered in date order, the results will be 
processed and returned in this order by default.


As far as I can see, there are more than one tables available now (not only 
postings)

beanquery> .tables

accounts

balances

commodities

documents

entries

events

notes

postings

prices

transactions

Now the FROM statement needs to contain table, but preceded by #

e.g.

select date, narration from #transactions

If FROM is omitted, then it is assumed to be FROM #postings

Question: Is this correct?

posting has also all the transaction information, but it is called entry 
there

 beanquery> .describe postings     

table postings:

  id (str)

  type (str)

  filename (str)

  lineno (int)

  date (date)

  year (int)

  month (int)

  day (int)

  flag (str)

  payee (str)

  narration (str)

  description (str)

  tags (set)

  links (set)

  meta (dict)

  location (str)

  posting_flag (str)

  account (str)

  other_accounts (set)

  number (decimal)

  currency (str)

  cost_number (decimal)

  cost_currency (str)

  cost_date (date)

  cost_label (str)

  position (position)

  price (amount)

  weight (amount)

  balance (inventory)

  entry (transaction)

beanquery> .describe transactions

table transactions:

  meta (metadata)

  date (date)

  flag (str)

  payee (str)

  narration (str)

  tags (frozenset)

  links (frozenset)

beanquery>

So, 

select date, account, narration

Gives the same result as

select entry.date, account, entry.narration

Question: why is it done like this? What is the reason to have transaction 
information (e.g. date ) both in posting as well as in posting.entry? 

So far the only place I use it is to access transaction meta as an opposite 
to posting meta

select date, account, narration, entry.meta as transaction_meta, meta as 
posting_meta

Question: is it correct, that it is still not possible to create queries, 
which join tables with each other like in traditional SQL?

Say for every posting I want to list an account as well as the date the 
account was open.

select #postings.account,  #accounts.open where #postings.account = 
#accounts.account

I know above does not work, but is something like this possible?

-- 
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/78945a84-623c-4d29-aa4e-da25354c3c99n%40googlegroups.com.

Reply via email to