def _model_unique ( ins ) : unique = [ ] for t in ins . tables : for c in t . constraints : if isinstance ( c , UniqueConstraint ) : unique . append ( tuple ( col . key for col in c . columns ) ) return unique
how to get unique constraints from a msssql table in python
Get unique constraints info
def _model_unique(ins):
    """ Get unique constraints info

    :type ins: sqlalchemy.orm.mapper.Mapper
    :rtype: list[tuple[str]]
    """
    unique = []
    for t in ins.tables:
        for c in t.constraints:
            if isinstance(c, UniqueConstraint):
                unique.append(tuple(col.key for col in c.columns))
    return unique