Hello all

I'd like to delete Multiple objects at once by deleting their parent object. I'd expect the DB's cascade mechanics to handle the details for me, but, as it seems, SQLObject deletes related objects BEFORE passing the delete command of the parent object to the DB.

An Example:

class AB(sqlobject.SQLObject):
a = sqlobject.ForeignKey('A', cascade = True)
b = sqlobject.ForeignKey('B', cascade = True)

class A(sqlobject.SQLObject):
b = sqlobject.RelatedJoin('B', intermediateTable = AB.sqlmeta.table, createRelatedTable = False)

class B(sqlobject.SQLObject):
a = sqlobject.RelatedJoin('A', intermediateTable = AB.sqlmeta.table, createRelatedTable = False)

a = A()


--> Results in these queries:

1/Query : DELETE FROM ab WHERE a_id=17
2/Query : DELETE FROM ab WHERE a_id=17
1/Select : SELECT ab.id, ab.a_id, ab.b_id FROM ab WHERE ((ab.a_id) = (17))
2/Query : DELETE FROM a WHERE id = (17)

When in fact the last statement would suffice.

How can I persuade sqlobject to rely on the DB's cascade operation?



(And, as always, sorry for the mess following... \/ \/ \/ :-)


Diese Mitteilung ist nur fuer die Empfaengerin / den Empfaenger bestimmt.

Fuer den Fall, dass sie von nichtberechtigten Personen empfangen wird, bitten wir diese hoeflich, die Mitteilung an die ZKB zurueckzusenden und anschliessend die Mitteilung mit allen Anhaengen sowie allfaellige Kopien zu vernichten bzw. zu loeschen. Der Gebrauch der Information ist verboten.

This message is intended only for the named recipient and may contain confidential or privileged information.

If you have received it in error, please advise the sender by return e-mail and delete this message and any attachments. Any unauthorised use or dissemination of this information is strictly prohibited.