
30 Jun
2009
30 Jun
'09
5:49 p.m.
Hi Marc Weber
Another example: Updating the age of a pupil:
row = SELECT * FROM pupils where age = 13; UPDATE pupils SET age = 14 WHERE id = <the id you got above>
p = session.query(Pupil).filter(Pupil.age==13).one().age=14 session.commit()
difference? You don't have to care about ids. you just assign a new value and tell the engine that it should commit. So again less chances to get something wrong.
Could you not do in SQL: UPDATE pupils SET age = 14 WHERE age = 13 That is, without using ids. Greetings, Mads Lindstrøm