Skip to content

SQLite

Bengfort requested to merge sqlite into main

I finally managed to fix SQLite support. The big blocker initally was JSONField, which gained support in django 3.1. In !1464 (closed) back then I mentioned what was still missing:

  • timedelta multiplication
  • geodjango

Geodjango was simple because the spatialite backend has existed for a long time (I just hadn't realized).

Timedelta multiplication turned out to be a bigger issue. There is an upstream issue but I doubt there will be a fix anytime soon. I am not entirely sure why this is not supported. This is not an issue of SQLite itself. It's just that django does not implement the required mapping for some reason. My workaround is certainly hacky.

There are two main benefits of using SQLite:

  • The development setup is much simpler. Docker is no longer required. You just need to delete two files to reset the databases.
  • Tests are faster (because they can use in-memory sqlite). Every test session uses a fresh database, so --reuse-db has no effect (see !1840 (merged)). But it is still faster (~33s instead of ~36s)

On the other hand this would mean that we use a completely different database for development and production. Therefore I think we should stick with postgres in gitlab-CI.

Edited by Bengfort

Merge request reports