Hi,
I created ORM classes and can't find out a way to make an
UniqueConstraint for two columns. Do we have an example elsewhere?
When I used UniqueConstraint from sqlachemy.schema inside of ORM class
it does nothing, so it's not defined in a table. In particular here is
my class

class DASMap(Base):
    """DASMap ORM"""
    __tablename__ = 'dasmaps'
    __table_args__ = {'mysql_engine':'InnoDB'}

    id          = Column(Integer, primary_key=True)
    system_id   = Column(Integer, ForeignKey('systems.id'))
    api_id      = Column(Integer, ForeignKey('apis.id'))
    daskey_id   = Column(Integer, ForeignKey('daskeys.id'))
    primary_key = Column(String(30), nullable=False, unique=True)
    system      = relation(System, order_by=System.id)
    api         = relation(Api, order_by=Api.id)
    daskey      = relation(DASKey, order_by=DASKey.id)
    UniqueConstraint('api_id', 'daskey_id', name='uix_1')

Thank you,
Valentin.
--~--~---------~--~----~------------~-------~--~----~
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