

def get_foreign_keys(self, table, schema='public'):
    sql = "\n            SELECT\n                kcu.column_name, ccu.table_name, ccu.column_name\n            FROM information_schema.table_constraints AS tc\n            JOIN information_schema.key_column_usage AS kcu\n                ON (tc.constraint_name = kcu.constraint_name AND\n                    tc.constraint_schema = kcu.constraint_schema)\n            JOIN information_schema.constraint_column_usage AS ccu\n                ON (ccu.constraint_name = tc.constraint_name AND\n                    ccu.constraint_schema = tc.constraint_schema)\n            WHERE\n                tc.constraint_type = 'FOREIGN KEY' AND\n                tc.table_name = %s AND\n                tc.table_schema = %s"
    cursor = self.execute_sql(self, (table, schema))
    return [ForeignKeyMetadata(row[0], row[1], row[2], table) for row in cursor.fetchall()]

dataset/ETHPy150Open coleifer/peewee/peewee.py PostgresqlDatabase.get_foreign_keys/VarMisuse@26/252 `sql`->`self`