[sqlalchemy] Re: insert statment

2009-06-09 Thread Mike Conley
The insert is looking for a list of dictionaries. What you would like to do is enter column names once along with lists representing rows of data to insert. Here is some code I use to simplify setting up the dictionaries when inserting a large number of rows. I'm sure others have come up with othe

[sqlalchemy] Re: insert statment

2009-06-09 Thread Michael Bayer
"normal" SQL includes named bind parameters. you might be looking for a raw execution, i.e.: conn.execute("insert into table (a, b, c) values (?, ?, ?)", [(1,2,3), (4,5,6)]) that will take you right through to the DBAPI but your code will not be database agnostic. Ashish Bhatia wrote: > > yea

[sqlalchemy] Re: insert statment

2009-06-08 Thread Ashish Bhatia
yeah thnks for the help. one more dbt. do i have to provide values as dict always ie. with column name. Can i give direct values like we do in normal sql.? thnks in advance On Jun 9, 9:02 am, Michael Bayer wrote: > you need to use the executemany form described > athttp://www.sqlalchemy.org/do

[sqlalchemy] Re: insert statment

2009-06-08 Thread Michael Bayer
you need to use the executemany form described at http://www.sqlalchemy.org/docs/05/sqlexpression.html#executing-multiple-statements . On Jun 8, 2009, at 11:54 PM, Ashish Bhatia wrote: > > Sorry, Its my typing mistake :( . I put : insted , . But still my > question yeat remained unanswered

[sqlalchemy] Re: insert statment

2009-06-08 Thread Ashish Bhatia
Sorry, Its my typing mistake :( . I put : insted , . But still my question yeat remained unanswered. :( On Jun 8, 7:50 pm, Didip Kerabat wrote: > You have Syntax Error here: > > ('sdsd':'sdsds') > > That one should be tuple right? > > - Didip - > > > > On Mon, Jun 8, 2009 at 6:14 AM, Ash wrote:

[sqlalchemy] Re: insert statment

2009-06-08 Thread Didip Kerabat
You have Syntax Error here: ('sdsd':'sdsds') That one should be tuple right? - Didip - On Mon, Jun 8, 2009 at 6:14 AM, Ash wrote: > > Hello , > > I am trying to insert in the table using two ways in the values which > i show below > > engine = sqlalchemy.create_engine() > metadata = MetaData(