def cols_between(col1, col2, inclusive=True): c1 = _interpret_as_column_or_from(col1) c2 = _interpret_as_column_or_from(col2) if c1.table.name != c2.table.name: raise ValueError( "cols_between needs both columns to be from the same table") return get_column_list(c1, from_=c1.name, to=c2.name, inclusive=inclusive)
def all_but(cols): dropped_cols = [_interpret_as_column_or_from(col) for col in cols] first_col = dropped_cols[0] if not all(col.table.name == first_col.table.name for col in dropped_cols): raise ValueError('all_but arguments need to all be from the same table') dropped_names = [col.name for col in dropped_cols] return [c for c in first_col.table.columns if c.name not in dropped_names]
def cols_to(col, inclusive=True): c = _interpret_as_column_or_from(col) return get_column_list(c, to=c.name, inclusive=inclusive)