== Why I don't use relational databases in practice I started out planning to write an entry I was going to title 'when I reach for a relational database'. The problem with this implicit question is that in practice the answer is 'when [[the system I'm building on ../python/DjangoORMDesignPuzzle]] basically insists on it'. Otherwise I basically don't use one, even when the problem more or less naturally fits into a relational world. On a purely logical basis, this is crazy; using a relational database for relational things is much easier than the alternatives and [[SQLite makes this trivial SQLiteAttraction]]. In thinking about it, I've come around to the idea that my problem with relational databases is that using a database makes my data relatively opaque and as a result complicates my life. The easy option for a relational database is an SQL based database, probably SQLite, and all of those store my data in unreadable and uneditable binary files. In order to get at my data I need to use the database server's tools (or write code). The direct consequence of this is that I can't inspect and go through my data by firing up _less_ or _grep_ or any number of other things and I can't (if I want to) put things under version control in any easy way. The slightly more indirect consequence is that I need to write more tools. When my data is in plain text files I can modify my data with an editor or other simple Unix programs; add something, delete something, modify something, shuffle things around, it's all something that gets done with existing Unix programs and maybe some thin scripts. When my data is in a SQLite database I have to manipulate the data through SQLite in some way, either in more complicated shell scripts that drive the SQLite shell or through actual little utility programs that I write. In practice the latter is much safer and so what I'm likely to wind up with. Either way it's more work and more dedicated tools that I have to keep track of in various ways. For me all of this adds friction to using a real relational database, enough friction that I'll endure some level of pain from hacking things together with plain text files instead. This is not completely rational, but evidently I put a high premium on being able to see things with _less_ and edit them with _vi_. (Note that some people have violent objections to relational databases, either in general or for uses where they aren't 'needed' in some sense. I'm not one of them; I don't have any strong feelings that they're inelegant or consume too many resources or whatever.)