Hi,

I would like to use an association object with two tables derived from
two declarative base classes.
What would be (if one may say) the "right" way to access (get and set)
the additional values in the association object?

When I set the 2 entities from the base classes and associate them I
get the 2 association values automatically populated in the
association table (and hence the DB). Do I need to manually set the
additional values in the association table?

Example: What is the proper way to set and get the "data" entry in the
assoc table

class Left(Base):
    __tablename__='left'
        id = Column(Integer, primary_key=True)
        right = relation("Right", secondary=assoc, backref="left")

class Right(Base):
    __tablename__='right'
        id = Column(Integer, primary_key=True)

assoc = Table('association', Base.metadata,
    Column('left_id', Integer, ForeignKey('left.id'),
primary_key=True),
    Column('right_id', Integer, ForeignKey('right.id'),
primary_key=True),
    Column('data', String(50))
    )

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

Reply via email to