@reflection.cache
def get_unique_constraints(self, connection, table_name, schema=None, **kw):
    auto_index_by_sig = {}
    for idx in self.get_indexes(connection, table_name, schema=schema, include_auto_indexes=True, **kw):
        if (not idx['name'].startswith('sqlite_autoindex')):
            continue
        sig = tuple(idx['column_names'])
        auto_index_by_sig[sig] = idx
    table_data = self._get_table_sql(connection, table_name, schema=schema, **kw)
    if (not table_data):
        return []
    unique_constraints = []

    def parse_uqs():
        UNIQUE_PATTERN = '(?:CONSTRAINT "?(.+?)"? +)?UNIQUE *\\((.+?)\\)'
        INLINE_UNIQUE_PATTERN = '(?:(".+?")|(?:[\\[`])?([a-z0-9_]+)(?:[\\]`])?) +[a-z0-9_ ]+? +UNIQUE'
        for match in re.finditer(UNIQUE_PATTERN, table_data, re.I):
            (name, cols) = match.group(1, 2)
            (yield (name, list(self._find_cols_in_sig(cols))))
        for match in re.finditer(INLINE_UNIQUE_PATTERN, table_data, re.I):
            cols = list(self._find_cols_in_sig((match.group(1) or match.group(2))))
            (yield (None, cols))
    for (name, cols) in parse_uqs():
        sig = tuple(cols)
        if (sig in auto_index_by_sig):
            auto_index_by_sig.pop(sig)
            parsed_constraint = {'name': name, 'column_names': cols}
            unique_constraints.append(parsed_constraint)
    return unique_constraints
@reflection.cache
def get_unique_constraints(self, connection, table_name, schema=None, **kw):
    auto_index_by_sig = {}
    for idx in self.get_indexes(connection, table_name, schema=schema, include_auto_indexes=True, **kw):
        if (not idx['name'].startswith('sqlite_autoindex')):
            continue
        sig = tuple(idx['column_names'])
        auto_index_by_sig[sig] = idx
    table_data = self._get_table_sql(connection, table_name, schema=schema, **kw)
    if (not table_data):
        return []
    unique_constraints = []

    def parse_uqs():
        UNIQUE_PATTERN = '(?:CONSTRAINT "?(.+?)"? +)?UNIQUE *\\((.+?)\\)'
        INLINE_UNIQUE_PATTERN = '(?:(".+?")|(?:[\\[`])?([a-z0-9_]+)(?:[\\]`])?) +[a-z0-9_ ]+? +UNIQUE'
        for match in re.finditer(UNIQUE_PATTERN, table_data, re.I):
            (name, cols) = match.group(1, 2)
            (yield (name, list(self._find_cols_in_sig(cols))))
        for match in re.finditer(INLINE_UNIQUE_PATTERN, table_data, re.I):
            cols = list(self._find_cols_in_sig((match.group(1) or match.group(2))))
            (yield (None, cols))
    for (name, cols) in parse_uqs():
        sig = tuple(cols)
        if (sig in auto_index_by_sig):
            auto_index_by_sig.pop(sig)
            parsed_constraint = {'name': name, 'column_names': cols}
            unique_constraints.append(parsed_constraint)
    return unique_constraints