Hello

I am trying to make the insert statement in using sqlalchemy.

Assuming that i get columns in cols and values in vals variable, i did
like

cols = [col1, col2, col3]
vals = ['val1', 'val2', 'val3']
tbl = Table('xyz',metadata)

d = dict(zip(cols,vals))

ins = tbl.insert(d)

engine.execute(ins)

------------------------- I guess ths works

Now if qry is like "insert into xyz select * from xyz_clone"

I made

tbl = Table('xyz',metadata)
tblc = Table('xyz_clone',metadata)
sel = select()
sel.append_from(xyz)
select.append_column("*")

ins = tblc.insert([sel])

engine.execute(ins)

This insert one blank row with default value :(.

I didnt get why :(

Can anyone pls help.

Thanks






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

Reply via email to