开发者

when updating an object, what do I call? session.add is for adding, where is update?

开发者 https://www.devze.com 2023-01-10 02:47 出处:网络
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:

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

精彩评论

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