Up!
2012/3/23 Christian Démolis <[email protected]>
> Hi all,
>
> class A(Base):
> __tablename__ = 'a'
> IdA = Column('IdA', Integer, primary_key=True)
> AllTheB = association_proxy("many_to_many_relation", "relation_b")
>
> class ManyToManyRelation(
> __tablename__ = 'many_to_many_relation'
> IdA = Column(Integer, ForeignKey('A.IdA'), primary_key=True)
> IdB = Column(Integer, ForeignKey('B.IdB'), primary_key=True)
>
> relation_a = relationship(A, backref=backref("tarifer_dossier",
> cascade="all, delete-orphan"))
> relation_b = relationship(B, backref=backref("tarifer_dossier",
> cascade="all, delete-orphan"))
>
> class B(Base):
> __tablename__ = 'b'
> IdB = Column('IdB ', Integer, primary_key=True)
> AllTheA = association_proxy("many_to_many_relation", "relation_a")
>
> x_a is instance of A
> x_b is instance of B
>
> x_a.AllTheB returns me all the objects B relative to x_a
>
> When i want to append new element e (instance of A)
> x_a.AllTheB.append(e)
>
> I have an error due to create mechanism of association_prox
>
> How can i have the same (simple) behaviour of classical many to many
> relationship ?
>
> Thanks in advance
>
> Chris
>
--
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.