by TZubiri · 1mo ago · 0 comments
Has anyone ever gone through a phase (or is in a phase), of just writing and reading from files instead of cajoling everything into SQL databases and wrangling stringy queries?
I find you can just make files with your own file formats and be fine, as long as your magic numbers make a cool mnemonic when read as hex.
I'm sure I'll face a huge wall at some point in my development career, or I'll be forced to adopt SQL when inheriting a codebase, but I don't quite know what the main issue with this approach is with this. For the time being, whenever I read articles or Readmes like this it feels like my approach at least has the pro of not needing "yet another Python SQlite wrapper"
For your consideration (I'll add that I used to think similarly as you, and I still wouldn't use sqlite for everything, but it's shockingly effective):
https://www.sqlite.org/transactional.html
https://www.sqlite.org/fasterthanfs.html
https://www.sqlite.org/atomiccommit.html
https://www.sqlite.org/aff_short.html
That forced me to use a database, because now I could use triggers to automatically save off old values, and views to use them nicely.
There were many Python SQLite wrappers at the time, but I didn't like them. So I wrote another one :)
https://www.rogerbinns.com/blog/20-years-of-apsw.html
(I am the APSW maintainer)
On the cons, you have sql injections, which can kill your company's reputation.
It only became less common by shifting the issue to the supply chain, now you need orms and yet another wrangling library. So I'm not convinced the security issue is "fixed", let alone the code complexity introduced by these things just to effectively do one of the most fundamental operations in computing, writing() to disk