Settings

Theme

Ask HN: Best option for lightweight data persistence for simple local program?

3 points by Hammerhead12321 2 years ago · 8 comments · 1 min read


Hey everyone, I want to build a simple program that will allow me to track my financial “net worth” month to month. It will essentially just take a few numbers from various banking and brokerage accounts every month and compare with the month prior.

It’ll probably just be a script I run locally every month. I’m wondering what the best option might be for saving the account values. A full blown db (sqlite or postgres) sort of seems like overkill, and saving to a text file seems to…fragile? Just wondering if anyone can think of some better options for this use case.

rhelz 2 years ago

Reading from sqlite databases can be as fast(or even faster under some conditions) than just reading in files. It's hard to beat for lightweight applications, and should you find you need a little less lightweight storage as your ap evolves, well, you are already using SQL to there is a clear upgrade path.

philipswood 2 years ago

Text files are fine.

Check out plain text accounting:

https://plaintextaccounting.org/

hello_computer 2 years ago

It was once written on the SQLite site:

"SQLite is not designed to replace Oracle. It is designed to replace fopen()."

I recommend it because: A) I never know how far a program is going to go. No point limiting myself to CSV dumps when sqlite is so easy to integrate. B) Less likely to trash my own data using something that has already had so much engineering & QA poured into it. C) It's a standard file format, so it's easier to integrate other programs into the workflow if I ever need to.

But for quick-and-dirty, it's hard to beat plain CSV.

DeathArrow 2 years ago

A file should be good. Why do you think a file is more fragile? DBMS are saving data in files. If you are worried about long term data reliability you can use some error correcting codes such as Hamming or Reed-Solomon. If I do something like this I would use something simple like JSON or CSV.

RetroTechie 2 years ago

Spreadsheet?

  • beardyw 2 years ago

    Yes, that's what I do. Banks will export your statements as CSV or even spreadsheet. I copy paste year to date into a sheet and I get all the analysis I need.

pestatije 2 years ago

csv file

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection