3 ms·
I've tried using ledger in the past. I ended up moving all the data to a database. Ultimately it is much easier/flexible to work with SQL, than arbitrary comman
by megous 9y ago
I've tried using ledger in the past. I ended up moving all the data to a database. Ultimately it is much easier/flexible to work with SQL, than arbitrary command line tools. Also it's easier to manipulate and process the data from anywhere (psql, cli app, web app, ...), without fear of corruption.
- matthiasv 9y agoHow do you model double-entry book-keeping in your relational database? And where comes the fear of corruption if .ledger files are merely text?
- megous 9y agoCorruption not in a sense of storage issues, but in a sense of a fragile text format made for human editing, but not entire pleasant for that. I wanted more pleasant entry. It became tedious/error prone to search for similar entries with vim and copy pasting. I could have made a specialized tool with nice autocomplete on top of ledger, but then why not drop the entire thing and use a database, where you don't need to re-invent groupping, sorting, filtering, summing, date interval operations and all the mundane stuff. I also wanted to import data from a bank, and keep all the info associated with the entries. Easy to do in a database, not so in ledger text format.
- megous 9y agoI can't share everything here, but basics are this. Three tables: accounts, transactions, entries. Entries have amount, unit, notes. Accounts have name, parent_account. Transactions have subject, notes, date. That's the data. Then I have a view that flattens accounts tree, so that each has name and fullname. Name being Fun, fullname a full path to that account, eg. Expenses:Fun. With that base structure, you can start answering any questions by just summing entries groupped by accounts filtered by a regexp on fullname and fitler on date. What is my cashflow for any time period, what is my equity, what is my balance sheet, what I actually have, what changed recently, how any of this develops over time...