when updating an object, what do I call? session.add is for adding, where is update?
http://www.sqlalchemy.org/docs/reference/orm/sessions.html
I don't see anything for updating an object that was just retrieved from the database using:
q = session.query(products)
for p in q:
p.blah 开发者_Python百科= 'hello'
sesion.????
session.commit()
That line p.blah = 'hello'
is updating the property (column) blah
of the object p
.
That's the power of object relational mapping in newer languages. Enjoy.
精彩评论