Hi Stefano, Thanks! The code is just like this:
subrating_subratingproperty_association = Table('subrating_subratingproperty_association', Base.metadata, Column('subrating_id', Integer, ForeignKey('subratings.id')), Column('subrating_property_id', Integer, ForeignKey('subrating_properties.id'))) class SubRatingProperty(Base): __tablename__ = 'subrating_properties' id = Column(Integer, primary_key=True) name = Column(Unicode(32), unique=True) subratings = relationship("SubRating", secondary=subrating_subratingproperty_association, backref="subrating_properties") class SubRating(Base): __tablename__ = 'subratings' id = Column(Integer, primary_key=True) name = Column(Unicode(32), unique=True) class Rating(Base): __tablename__ = 'ratings' id = Column(Integer, primary_key=True) name = Column(Unicode(32), unique=True) subrating_id = Column(Integer, ForeignKey('subratings.id')) subrating = relationship("SubRating", backref=backref("rating", cascade="all, delete-orphan", uselist=False)) I create and add a Rating and Subrating (both end up in the DB no problem). Then, I call session.delete(rating_obj) and commit it. I look at the DB, and the Rating is gone, but the SubRating is still there. The DB shows that the Rating has the correct Subrating's ID.. On Aug 5, 11:45 am, Stefano Fontanelli <s.fontane...@asidev.com> wrote: > Il 05/08/11 20.38, Aviv Giladi ha scritto: > > > Hey Stefano, > > > I tried that, but when I did, this is the error I got while inserting > > a new rating: > > > InterfaceError: (InterfaceError) Error binding parameter 0 - probably > > unsupported type. u'SELECT subratings.id AS subratings_id \nFROM > > subratings \nWHERE subratings.id = ?' (<symbol 'NEVER_SET>,) > > I need the whole code to help you :) > I think it is not related with cascade set. > > Regards, > Stefano. > > -- > Ing. Stefano Fontanelli > Asidev S.r.l. > Via Osteria Bianca, 108/A 50053 Empoli (Firenze) > Tel. (+39) 333 36 53 294 Fax. (+39) 0571 1 979 978 > E-mail: s.fontane...@asidev.com Web:www.asidev.com > Skype: stefanofontanelli -- 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.