I've got a many to many relationship with the association table. The issue I am running into is that a given pesticide entry may have a pest or pests already in the pest table. I don't want to add the pest since it will be a duplicate, however I still want the association of that pest to the pesticide done.
I've looked at the Unique Object wiki, however I am not sure that solves my issue. Is there a way that SQLAlchemy can handle this, or do I need to manually build the entries in the PestToPesticide association table? Thanks! Dan PestToPesticide = Table('pest_to_pesticide', Base.metadata, Column('pesticide_id', Integer, ForeignKey('pesticide.row_id')), Column('pest_id', Integer, ForeignKey('pest.row_id')) ) class Pesticide(Base): __tablename__ = 'pesticide' row_id = Column(Integer,primary_key=True) name = Column(String(64), unique=True) pestList =relationship("Pest", secondary=PestToPesticide, backref="pesticide") class Pest(object): row_id = Column(Integer,primary_key=True) name = Column(String(), unique=True) -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.