On Oct 19, 2011, at 3:55 AM, Fabien Ribes wrote:

>> 
>> usually relationship() with cascade="all, delete-orphan" is used for this 
>> use case, so that SQLAlchemy can maintain knowledge about the link between 
>> Peripheral and Actuator.  The other alternative is to use "ON DELETE 
>> CASCADE" on the foreign key; this is part of the schema you'd generate in 
>> the database.
>> 
>> Relevant docs:
>> 
>> http://www.sqlalchemy.org/docs/orm/tutorial.html#configuring-delete-d...http://www.sqlalchemy.org/docs/core/schema.html#on-update-and-on-deletehttp://www.sqlalchemy.org/docs/orm/collections.html#using-passive-del...
>> 
>> 
>> 
>>> Regards,
> 
> I forgot to mention I'm using SQLite, so ondelete="CASCADE" is not a
> option.
> Mike's suggestion is OK so far, I'll stick to it.

Oh you know I totally missed that Actuator and Peripheral are related via 
inheritance, so yes everything I said about relationship() is not correct in 
this case.     So yes this is kind of an unfortunate limitation of 
query.delete() in that it can only delete from one table at a time, when given 
a joined inh object.  It should possibly emit some kind of warning for that.


-- 
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