python - How to update table row with SQLAlchemy? -


i want update row of table.

to add used,

session.add(unit) #here unit unit object of class unit session.commit() 

to update tried,

session.merge(unit) session.commit() 

however, in database there other columns, e.g. create_by, created_on, updated_on, not set in unit object, these set null upon merge.

you can modify properties of class use represent row , call session.commit(). example:

# add new user user = user(name="john", age=20) session.add(user) session.commit()  # modify user added user.age = 21 session.commit() 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -