Hello ,

I am trying to make query like

select (a+b) from xyz;

to do this

xyz = sqlalchemy.Table('xyz',metadata)

a = sqlalchemy.Column('a', sqlalchemy.Integer)
xyz.append_column(a)
b = sqlalchemy.Column('b', sqlalchemy.Integer)
xyz.append_column(b)

column = [(a + b)]
select = sqlalchemy.select(from_obj=xyz, columns=column,distinct=True)

This works fine for me.

Now when the columns a and b are dynamic (Enter by the user in form of
string) and the operator too comes from user

columns_list = ['a','b']
operator = ['+']

like this i get the input

so i make the loop and make

for both the columns something like this
columns = []
for x in column_list :
    t  = sqlalchemy.Column(x, sqlalchemy.Integer)
    xyz.append_column(a)
    columns.append(t)

so now
how to add + to make the quer run

Thanks in the advance.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to