This is one example... session.query(YourClass).update(values = dict(tag = "a"))
the previous one modifies field named tag to "a" for every record. You can filter before doing update. For example... from sqlalchemy.sql import and_ session.query(YourClass).filter(and_(YourClass.field1 == "any value", YourClass.otherfield == None ))update(values = dict(tag = "a")) On Feb 17, 4:23 pm, mando <mandol...@gmail.com> wrote: > Hi to alls, > > still now I use this method to update values in my table: > > table.update(table.c.table_name, 'id_table' == 1').execute({'field_1': > 'new_value'})) > > But now I want to use session. I look around the web and this list but > I don't understand how to do it. > > Session = sessionmaker(bind=self.engine, autoflush=True, > autocommit=True) > session = Session() > session.query(MYTABLECLASS).update( 'id_table' == > 1').execute({'field_1': 'new_value'}) > > This is wrong, but where I can see somes examples? I read the official > sqlalchemy documentation, but I didn't find nothing that help me. > > Sorry 8 ) and thanks a lot for any suggestions!!! > > luca -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@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.