Il 04/08/11 21.27, Aviv Giladi ha scritto:
Hey,

Tried adding cascade to Rating's backref call like so:

     subrating = relationship("SubRating", backref=backref("rating",
cascade="all, delete-orphan"
uselist=False))

This unfortunately doesn't work - when I delete a Rating, the
according Subratings are NOT removed.
What am I doing wrong? (Testing with SQLite)

Are you sure about the position of 'cascade' keyword?
I think the right way to do that could be:

subrating = relationship("SubRating",
                         cascade="all, delete-orphan",
                         backref=backref("rating", uselist=False))


Regards,
Stefano.

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to