I'm posting this for one of my coworkers whos email isn't showing up.

---------- Forwarded message ----------
From: Kevin Yoo <[email protected]>

I am writing a Django app with sqlite. I am using Django’s database
hook framework to perform certain actions on sqlite’s db file: namely,
whenever any modification is made to the database, be it an
INSERT/UPDATE/DELETE, the db file is copied to a backup drive.

On INSERTs and UPDATEs, the copied db file contains the new or
modified records. On DELETEs, the deleted items are in the copied db
file (but shouldn't be).

It would appear that sqlite3 does not immediately write DELETEs to
disk. I have confirmed this behavior by pausing my Django app
immediately upon entrance into my database hook callback, running
sqlite in another process and examining the .db file on disk – the
deleted record is still present. Further, after the deletion but
before pausing the Django app I run a SELECT query within Django and
it does not see the deleted item.

Is there a way of forcing sqlite to write to disk after deletion? Is
my premise correct that deletions are treated differently?

The PRAGMA SYNCHRONOUS is set to 2 (FULL).

Doing a VACUUM also causes changes to be flushed to disk, but takes 5
seconds, so doesn't work for us.

Is there some other call we can make to cause DELETEs to be flushed to
disk? Any suggestions on whats happening?
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to