Moved to using peewee for simpler ORM operation. This also made it easier to access the sqlite PRAGMA at the right point to turn off journalling, which absolutely kills performance.