I want to create a scalar by concatenating multiple columns. If the list of columns were static I could do:
sa.select([table.c.col1 + table.c.col2 + 'done']).as_scalar()
But, my list is dynamic. Is there a way to do this without using eval()?
I want to create a scalar by concatenating multiple columns. If the list of columns were static I could do:
sa.select([table.c.col1 + table.c.col2 + 'done']).as_scalar()
But, my list is dynamic. Is there a way to do this without using eval()?
 
    
     
    
    You almost never need eval() — it can be evil. In this case just use functools.reduce() on your list of columns / expressions:
sa.select([reduce(operator.add, [table.c.col1, table.c.col2, 'done'])])
