

def get_indexes(self, table, schema='public'):
    query = "\n            SELECT\n                i.relname, idxs.indexdef, idx.indisunique,\n                array_to_string(array_agg(cols.attname), ',')\n            FROM pg_catalog.pg_class AS t\n            INNER JOIN pg_catalog.pg_index AS idx ON t.oid = idx.indrelid\n            INNER JOIN pg_catalog.pg_class AS i ON idx.indexrelid = i.oid\n            INNER JOIN pg_catalog.pg_indexes AS idxs ON\n                (idxs.tablename = t.relname AND idxs.indexname = i.relname)\n            LEFT OUTER JOIN pg_catalog.pg_attribute AS cols ON\n                (cols.attrelid = t.oid AND cols.attnum = ANY(idx.indkey))\n            WHERE t.relname = %s AND t.relkind = %s AND idxs.schemaname = %s\n            GROUP BY i.relname, idxs.indexdef, idx.indisunique\n            ORDER BY idx.indisunique DESC, i.relname;"
    cursor = self.execute_sql(query, (table, 'r', table))
    return [IndexMetadata(row[0], row[1], row[3].split(','), row[2], table) for row in cursor.fetchall()]

dataset/ETHPy150Open coleifer/peewee/peewee.py PostgresqlDatabase.get_indexes/VarMisuse@33/358 `schema`->`table`