Hi,
Is there a way to update a large number of objects without looping
through each one, using SA's ORM?

E.g.
I want to achieve the following:

for o in session.query(MyClass).filter_by(prop='some value'):
    o.prop = 'new value'
    session.update(o)

Without fetching and saving each object from the database. I.e.
something which would produce SQL like this:

UPDATE `my_class` SET `prop`='new value' WHERE `prop` = 'some value'

If not, am I safe mixing and matching ORM operations with SQL
operations like:
u = my_classes.update(my_class.c.prop=='some value'), values=
{'prop':'new value'})?

Thanks!
James
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to