On Mar 26, 2012, at 5:14 PM, Michael Bayer wrote:

> To avoid loading in the rows, another way is to do what you're doing but just 
> use an event, see a similar recipe here:
> 
> http://stackoverflow.com/questions/9234082/setting-delete-orphan-on-sqlalchemy-relationship-causes-assertionerror-this-att/9264556#comment12407940_9264556

correction, that question isn't quite the same thing - you can use a 
before_delete event on this to run similar queries to what you have, see:

http://docs.sqlalchemy.org/en/latest/orm/events.html#sqlalchemy.orm.events.MapperEvents.before_delete

so:

@event.listens_for(SkillTag, "before_delete")
def del_assoc(mapper, connection, target):
    
connection.execute(learn_tags.delete().where(learn_tags.c.skill_tag_.pk==target.pk))



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