from typing import OrderedDict


def get_query_columns(engine, query):
    """ Extract columns names and python typos from query

    Args:
        engine: SQLAlchemy connection engine
        query: SQL query

    Returns:
        dict with columns names and python types
    """
    con = engine.connect()
    result = con.execute(query).fetchone()
    values = list(result)
    cols_names = result.keys()
    cols = OrderedDict()
    for i in range(len(cols_names)):
        cols[cols_names[i]] = type(values[i]).__name__
    return cols