On 9/28/14 10:02 PM, Martin Blais wrote:
The ideas are a little bit fresh, so this proposal might feel a bit...
"stream of consciousness" and needs a bit more polishing.
https://docs.google.com/document/d/1d88MkHqxiVdF8XSQBT1QQpOKEOt6OC1P9ZoF3u86DwI/edit?usp=sharing
I haven't much to add today, except this is a very nice discussion - thanks.
Your "Gmail-style" query language describes hledger's current query language well.
A more powerful SQL-ish query language does seem like a good idea, especially one based on the nice Google Charts api linked in your comments.
Thu, 2 Oct 2014 23:37:09 <CAK21+hMx7wgt0imEtHp_WTFuYaqLTPJ+OwFHM+wjPS_77s...@mail.gmail.com>
Martin Blais <bl...@furius.ca> wrote...
[not sub'd to hledger so dropped from ng list]
It's always important to me to state the reasons why this is not possible
as a regular table: filtering has to be operable on complete transactions
(with all legs), and operations on inventories of commodities have to be
possible. These are the reasons that we cannot just spit out the data to
some SQLite table and then use that (I'd like to see someone argue the
opposite).
Given that you seem to write your thoughts out I've missed the doc where you say what the reasons are it can't be done in SQLite (or postgres or mysql) tables. Bear in mind that GnuCash uses any of the 3 mentioned dbs as storage methods alongside XML (cf plain text file).
Your own recently mentioned implementation (bean-sql) creates multiple tables but it could actually be done in one table if you simply regard SQLite3 (the overhead and fuss to new users mitigates against the others) as a very efficient storage method and just take it from there.
Within a few minutes you will start seeing your data and wanting to make some impression on it like "I want to put the transaction and transaction lines seperately" ... which is what you did :)
--
Wm...
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/tLKufVTCdqQUFwvv%40tarrcity.demon.co.uk.
Sat, 18 Oct 2014 13:30:15 <CAK21+hOon=Aph+bBTSMwxw-5p08-GyrTC8sOXJZdmOpWZL8MSA@mail.gmail.com>
Martin Blais <bl...@furius.ca> wrote...
On Sat, Oct 18, 2014 at 12:45 PM, Wm... <tcn...@tarrcity.demon.co.uk> wrote:
Thu, 2 Oct 2014 23:37:09 <CAK21+hMx7wgt0imEtHp_WTFuYaqLTPJ+OwFHM+wjPS_
77s...@mail.gmail.com>
Martin Blais <bl...@furius.ca> wrote...
[not sub'd to hledger so dropped from ng list]
It's always important to me to state the reasons why this is not possible
as a regular table: filtering has to be operable on complete transactions
(with all legs), and operations on inventories of commodities have to be
possible. These are the reasons that we cannot just spit out the data to
some SQLite table and then use that (I'd like to see someone argue the
opposite).
Given that you seem to write your thoughts out I've missed the doc where
you say what the reasons are it can't be done in SQLite (or postgres or
mysql) tables. Bear in mind that GnuCash uses any of the 3 mentioned dbs
as storage methods alongside XML (cf plain text file).
I'm not so much interested in the storage method; a relational database of
XML can represent the internals of Beancount alright, that's easy,
ok
the
issue is making simple queries on tree-structured data that produces
reports suitable for accounting, with operations on inventories of
positions.
I'm not sure I'm getting this. Surely most of the objects (point in time, something, amount of that something, who had it before and who had it afterwards) are easily defined and represented with a bit of glue saying that-one-over-there and this-one-here belong together, let's call it a transaction ?
sqlite> select account, sum(number), currency from postings where id in (select distinct t.id from transactions as t join postings where account glob 'Assets:US:Vanguard:*') and account glob "Income:*" group by account, currency;
Did you know that on a gnucash stored db
===
Select
Sum(splits.value_num),
Sum(splits.quantity_num)
From
splits
===
gives me 0, 0 ?
[1] see below
that *is* the simplest balance sheet
what is it you are struggling to represent ?
surely, in spite of what you say, it is complexity you want rather than simplicity ?
Your own recently mentioned implementation (bean-sql) creates multiple
tables but it could actually be done in one table if you simply regard
SQLite3 (the overhead and fuss to new users mitigates against the others)
as a very efficient storage method and just take it from there.
No you can't.
How would you represent the two-level tree structure of "transactions <-
1:N -> postings" with
- a single relational table, and
- no duplication (otherwise it's a derived form and not suitable for
representation)
?
exactly as beancount and ledger-cli do now with line numbers as a kludge to represent a transaction if you want to be perverse, otherwise you put them next to each other or blob them, your choice, but not a problem that says only a plain text file makes this better because I haven't thought about it enough
contemporary dbs can easily split out stuff from a blob better than you spending years refining some transactional thing that only you care about, promise
If you have multiple tables, you end up having to do joins and
deduplication.
joins yes, deduplication no
why do you think deduplication would be necessary? genuinely puzzled
With a single table, you have duplication of information.
nope, a single table could be just as simple as a plain text file
At the moment I output separate tables for transactions and postings, which
can be joined, but it still doesn't allow you to make great queries that
involve the kind of filtering that is convenient for generating, e.g.
balance sheets.
as above [1] , you are incorrect
The Beancount Query Language will specifically address these issues by:
- allowing filtering to occur at two levels in a single query:
* filtering at the entries level (with predicates on postings allowed),
plus
free with SQL
* filtering at the postings level
- support inventory arithmetic and aggregation functions on inventory
objects and rendering functions (e.g., COST()).
- support flattening of multiple lots (to produce lists of holdings each
with their cost basis)
free with SQL if you know what you are doing
- explicitly support the "close" operation as syntax, that inserts
transactions to clear income statement accounts to equity and removes past
history
Ah, now you see, I disagree with that from an accounting and mathematical POV. I explicitly don't want that. Transactions are a continuum over time, reporting on them may be necessary because one or other government says so but does what actually happened change because I have to state a position on a date to an authority ? I say that is a report not a transaction, my accounts close when I die.
I claim that with the features above you can explicitly model all the
queries being done in Ledger, HLedger and Beancount.
I've read you say things like that before. Ho hum.
Within a few minutes you will start seeing your data and wanting to make
some impression on it like "I want to put the transaction and transaction
lines seperately" ... which is what you did :)
I don't understand this sentence.
What is unclear?
you wrote bean-sql to represent a plain text beancount file as more than one table, why ? because it represented the data well is my suggestion.