> > Yes, you need to delete everything manually that is referenced by
> > anything that is to be deleted.
>
> No, you don't. .destroySelf() in SQLObject 0.7.2 was extended to
> automatically remove rows from the intermediate table. Does it work?
Maybe I'm misunderstanding you but if a foreignkey points to an object
that is deleted, the object that refers to the deleted object will not
be:
from sqlobject import *
sqlhub.processConnection = connectionForURI( 'sqlite:/:memory:' )
class city( SQLObject ):
buildings = MultipleJoin( 'building' )
class building( SQLObject ):
city = ForeignKey( 'city' )
city.createTable( )
building.createTable( )
c = city( )
b1 = building( city=c )
b2 = building( city=c )
c.destroySelf( )
print building.select( ).count( )
print b1.city
This will print 2 and then an SQLObjectNotFound exception will be
raised so you need to manually delete all buildings that refer to a
deleted city. I guess you had RelatedJoin in mind.
|