我想更新表格的一行。如何使用SQLAlchemy更新表格行?
要添加我使用的,
session.add(unit) #here unit is unit object of class unit
session.commit()
要更新我尝试,
session.merge(unit)
session.commit()
然而,在数据库中有其它列,例如create_by
,created_on
,updated_on
,它们未在单位对象中设置,所以在合并时将它们设置为NULL。