Hello,

I'm using RelatedJoin to specify many to many relationships and discover that 
SQLobject doesn't clean up intermediate table when the object is destroyed.

E.g.:

class User(SQLObject):
    class sqlmeta:
        table = "users" # default 'user' might cause SQL errors
    groups = RelatedJoin("Group", intermediateTable="user_group",
                         joinColumn="user_id", otherColumn="group_id")

class Group(SQLObject):
    class sqlmeta:
        table ="groups" # default 'group' might cause SQL errors
    users = RelatedJoin("User", addRemoveName='_user',
                        intermediateTable="user_group",
                        joinColumn="group_id", otherColumn="user_id")

Is it a bug or feature? So far, I had to write my custom destroySelf() method 
that looks like this:

    def destroySelf(self):
        super(Group, self).destroySelf()
        sql = "DELETE FROM user_group WHERE group_id = %d" % self.id
        self._connection.query(sql)
   # Same for User class


Is it possible to force SQLObject to do this for me? 

Thanks, 
Max.




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to