Got it, thanks! On Friday, December 23, 2016 at 12:11:12 PM UTC-8, Brian Clark wrote: > > Is there an update equivalent of this insert statement? > > inserts = [{"name": "jon", "age": 20"}, {"name": "ashley", "age": 22"}] > session.execute( > People.__table__.insert().values( > inserts > ) > ) > > I have this right now but it's still slower than I'd like because it's > using executemany, hoping to have it be one big query > > updated_people = [{"b_id": 1, "b_name": "jon", "b_age": 21"}, {"b_id": 2, > "b_name": "ashley", "b_age": 25"}] > stmt = People.__table__.update().\ > where(People.id == bindparam('b_id')).\ > values(name=bindparam('b_name'), age=bindparam('b_age')) > session.execute(stmt, updated_people) > > Thanks! >
-- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.