def get_key_columns(self, cursor, table_name):
        key_columns = []
        try:
            cursor.execute("""
                SELECT column_name, referenced_table_name, referenced_column_name
                FROM information_schema.key_column_usage
                WHERE table_name = %s
                    AND table_schema = DATABASE()
                    AND referenced_table_name IS NOT NULL
                    AND referenced_column_name IS NOT NULL""", [table_name])
            key_columns.extend(cursor.fetchall())
        except (ProgrammingError, OperationalError):
            # Fall back to "SHOW CREATE TABLE", for previous MySQL versions.
            # Go through all constraints and save the equal matches.
            cursor.execute("SHOW CREATE TABLE %s" % self.connection.ops.quote_name(table_name))
            for row in cursor.fetchall():
                pos = 0
                while True:
                    match = foreign_key_re.search(row[1], pos)
                    if match == None:
                        break
                    pos = match.end()
                    key_columns.append(match.groups())
        return key_columns
Returns a list of (column_name, referenced_table_name, referenced_column_name) for all
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/db/backends/mysql/introspection.py/DatabaseIntrospection.get_key_columns