1updated_rows = (
2 session.query(YourTable)
3 .filter(YourTable.your_field.like('%est%'))
4 .update({YourTable.your_field: func.replace(YourTable.your_field, 'from_str', 'to_str')},
5 synchronize_session=False)
6 )
7print("Updated {} rows".format(updated_rows))