@dispatch(sa.sql.elements.Label)
def get_inner_columns(label):
 name = label.name
 inner_columns = get_inner_columns(label.element)
 assert (len(inner_columns) == 1)
 return [lower_column(c).label(name) for c in inner_columns]

@ dispatch ( sa . sql . elements . Label ) def get_inner_columns ( label ) : name = label . name inner_columns = get_inner_columns ( label . element ) assert ( len ( inner_columns ) == 1 ) return [ lower_column ( c ) . label ( name ) for c in inner_columns ]
notes this should only ever return a list of length 1 this is because we need to turn scalarselects into an actual column .