from typing import Dict

from sqlalchemy import Tuple


class Row(object):
    def __init__(self, row: Tuple, col_names: Dict[str, int]):
        self.items = row
        self.col_names = col_names

    def get_entry(self, column):
        if isinstance(column, str):
            column = self.col_names[column]

        if self.items[column] is None:
            return None

        return str(self.items[column]).encode("utf-8")
