On Aug 19, 2011, at 2:10 PM, Mike Conley wrote:

> class Parent(Base):
>     __tablename__ = 'parent'
>     id = Column(Integer, primary_key=True)
> class Child(Base):
>     __tablename__ = 'child'
>     id = Column(Integer, primary_key=True)
>     p_id = Column(Integer, ForeignKey(Parent.id))
>     parent = relation(Parent, backref=backref('children', 
> cascade="save-update,merge"))
> 
> sess.add(Parent(children=[Child(),Child()]))
> sess.commit()
> p = sess.query(Parent).first()
> sess.delete(p)
> sess.commit()


Mike,

Thanks. that does indeed work.  For some reason, it didn't seem to be work in 
my schema.  I'll have to do some more testing.

Mark

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