@declared_attr
def sometable_id(cls):
    return Column(Integer, ForeignKey('sometable.id'))

@declared_attr
def __table_args__(cls):
    return UniqueConstraint('sometable_id', 'ttime'), {}
Reusing SQLAlchemy models across projects