Il 09/08/11 02.42, Aviv Giladi ha scritto:
Dear Stefano,
First of all, thank you. Allow me to express how much I appreciate
your time and assistance - you and your colleagues are making the
technology world this much better by being so attentive and helpful!
Thank you.
Therefore I chose the second option - adding the cascade="all,
delete-orphan" to the backref call. This definitely got rid of the
problem, however, now the cascade isn't working - when I delete a
Rating object, its ProductsRating and the according ProductsProperty
persist. It is all illustrated in the attached script.
It is the right behaviour, for 'cascade' setting not for your app :)
The 'cascade' is setted up on the OneToMany side, in ProductsRating.
In your case, you have:
Rating -< ProductsRating
You can cascade from ProductsRating to Rating (symbol '<' identify
'Many' side) not the contrary, unless you use 'single_parent=True'.
It is the same behaviour of ONUPDATE and ONDELETE of SQL, the difference
is that in SQL you put the setting in FK ('One' side of relationship),
in SQLA you put the setting in 'Many' side of relationship. In both case
you can propagate updates and deletes from 'Many' side to 'One' side of
relationships.
Regards,
Stefano.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.