

def lower_column(col):
    " Return column from lower level tables if possible\n\n    >>> metadata = sa.MetaData()\n\n    >>> s = sa.Table('accounts', metadata,\n    ...              sa.Column('name', sa.String),\n    ...              sa.Column('amount', sa.Integer),\n    ...              sa.Column('id', sa.Integer, primary_key=True),\n    ...              )\n\n    >>> s2 = select([s])\n    >>> s2.c.amount is s.c.amount\n    False\n\n    >>> lower_column(s2.c.amount) is s.c.amount\n    True\n\n    >>> lower_column(s2.c.amount)\n    Column('amount', Integer(), table=<accounts>)\n    "
    old = None
    while ((col is not None) and (col is not old)):
        old = col
        if ((not hasattr(col, 'table')) or (not hasattr(col.table, 'froms'))):
            return col
        for f in col.table.froms:
            if (f.corresponding_column(old) is not None):
                col = f.corresponding_column(col)
    return old

dataset/ETHPy150Open blaze/blaze/blaze/compute/sql.py lower_column/VarMisuse@87/314 `col`->`old`