def __init__(self, parent, metadata):
        self._processors = processors = []

        # We do not strictly need to store the processor in the key mapping,
        # though it is faster in the Python version (probably because of the
        # saved attribute lookup self._processors)
        self._keymap = keymap = {}
        self.keys = []
        context = parent.context
        dialect = context.dialect
        typemap = dialect.dbapi_type_map
        translate_colname = context._translate_colname
        self.case_sensitive = dialect.case_sensitive

        # high precedence key values.
        primary_keymap = {}

        for i, rec in enumerate(metadata):
            colname = rec[0]
            coltype = rec[1]

            if dialect.description_encoding:
                colname = dialect._description_decoder(colname)

            if translate_colname:
                colname, untranslated = translate_colname(colname)

            if dialect.requires_name_normalize:
                colname = dialect.normalize_name(colname)

            if context.result_map:
                try:
                    name, obj, type_ = context.result_map[
                        colname if self.case_sensitive else colname.lower()]
                except __HOLE__:
                    name, obj, type_ = \
                        colname, None, typemap.get(coltype, sqltypes.NULLTYPE)
            else:
                name, obj, type_ = \
                    colname, None, typemap.get(coltype, sqltypes.NULLTYPE)

            processor = context.get_result_processor(type_, colname, coltype)

            processors.append(processor)
            rec = (processor, obj, i)

            # indexes as keys. This is only needed for the Python version of
            # RowProxy (the C version uses a faster path for integer indexes).
            primary_keymap[i] = rec

            # populate primary keymap, looking for conflicts.
            if primary_keymap.setdefault(
                    name if self.case_sensitive
                    else name.lower(),
                    rec) is not rec:
                # place a record that doesn't have the "index" - this
                # is interpreted later as an AmbiguousColumnError,
                # but only when actually accessed.   Columns
                # colliding by name is not a problem if those names
                # aren't used; integer access is always
                # unambiguous.
                primary_keymap[name
                               if self.case_sensitive
                               else name.lower()] = rec = (None, obj, None)

            self.keys.append(colname)
            if obj:
                for o in obj:
                    keymap[o] = rec
                    # technically we should be doing this but we
                    # are saving on callcounts by not doing so.
                    # if keymap.setdefault(o, rec) is not rec:
                    #    keymap[o] = (None, obj, None)

            if translate_colname and \
                    untranslated:
                keymap[untranslated] = rec

        # overwrite keymap values with those of the
        # high precedence keymap.
        keymap.update(primary_keymap)

        if parent._echo:
            context.engine.logger.debug(
                "Col %r", tuple(x[0] for x in metadata))
dataset/ETHPy150Open RoseOu/flasky/venv/lib/python2.7/site-packages/sqlalchemy/engine/result.py/ResultMetaData.__init__