On May 9, 7:18 pm, Thadeus Burgess <thade...@thadeusb.com> wrote:
> Not sure. I have a production database that I take csv snapshots of
> periodically using db.export_to_csv. I then use these and re-import
> them into a local sqlite instance, so I can work off live data without
> messing with live data :)
>
> Usually the sqlite database works fine for a couple of days, and then
> develops **this problem**, whereas my postgres production database
> never has this issue.
>
> I would first try to determine the problem record.... You can do this
> be iterating through every record, and making sure its references are
> in tact  by determining if those records exist... if not, flag the
> record.
>
> Then look at your code to see if there is a hole that is letting this
> problem happen.
>
> Then you need to figure out what to do to repair it, its a big issue
> because something belongs there, but you don't have any idea as to
> what.
>
> --
> Thadeus
>
> On Sun, May 9, 2010 at 3:34 PM, Joe Barnhart <joe.barnh...@gmail.com> wrote:
> > Hmmm...  Good point.  It's a production database and probably has developed
> > some cruft over time.  What's the best way to clean it up?  Export it all to
> > sql, edit it (or process it with a program) and re-import?  Or is there an
> > easier way?
>
> > On Sun, May 9, 2010 at 12:52 PM, Thadeus Burgess <thade...@thadeusb.com>
> > wrote:
>
> >> I have seen this quite a bit with my sqlite databases as well...
>
> >> Basically, this is what is happening.
>
> >> The referential integrity of your database is failing (IE: a FK links
> >> to a record that does not exist).
>
> >> This has happened many many times, and when I do a csv export of my
> >> database, sure enough there are records referencing non-existant
> >> records.
>
> >> I have had this happen mostly on tables that contain self-references.
>
> >> The problem is that SQLITE does not enforce referential integrity, so
> >> there is a bug somewhere in the code that allows you to link to
> >> non-existant records.
>
> >> --
> >> Thadeus
>
> >> On Sun, May 9, 2010 at 1:25 PM, Joe  Barnhart <joe.barnh...@gmail.com>
> >> wrote:
> >> > or when I try to view them in database admin!
>
> >> > This is all using the built-in sqllite database and standard automatic
> >> > "auth" tables.  Here is an example of one of my own tables that now
> >> > fails to view in databas
>
>

Reply via email to