On Sep 10, 2012, at 10:53 AM, Ladislav Lenart wrote: > Hello. > > Is there any performance (plus communication) difference between > > # bulk insert of several rows > new_rows = [] > for i in range(10): > new_rows.append({'foo': i, 'bar': i}) > cls.__table__.insert().execute(new_rows) > > and > > for i in range(10): > ins = cls.__table__.insert().values({ > 'foo': i, > 'bar': i > }) > session.execute(ins) > > I guess there is. If so, can the second example be written more efficiently > (but > still using session)?
use this style please: new_rows = [{"foo":i, "bar":i} for i in range(10)] session.execute(ins, new_rows) -- 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.