开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜