[SQLObject] Re: Re: Question about multiple deletes
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Chris G. <ch...@il...> - 2004-02-19 22:45:31
|
> > There's nothing in SQLObject right now that does this, but you could add > > your own method pretty easily... > > > > Just add a function to the SQLObject class called .multiDelete() or > > something, which works the same as .select().. (i.e. takes in the same > > parameters... obviously it would do something quite different. ;) > > Oops, guess I missed this message. > > It's a little more complicated than that, because a delete should really > go through the SQLObject instances. Selects should be extended so you > can retrieve IDs instead of full objects, then there should be a way to > fetch an object only if it already exists in Python. Then you'd iterate > over the select results and call destroySelf on any objects that > existed, and then do another SQL statement to delete any rows that > didn't have Python instances. Wow, yeah, I didn't think about object-to-database consistency. What a bitch. :) Object databases are hard! Hmmm.. couldn't you have a simpler method though, where the object was ignorant of its being deleted until it actally tried to sync itself with the database? I mean, what's the reason for using destroySelf to kill objects? Is it to keep the cache clean? |