def save_app_info(self):
try:
# update app_info
print(self.dicts)
data = db_session.query(App_Info).filter_by(app_id=self.app_id,mall_name=self.mall_name).first()
if data:
{setattr(data, k, v) for k,v in dicts.items()}
print(data)
else:
# insert app_info
db_session.execute(App_Info.__table__.insert(), self.dicts)
db_session.commit()
except:
db_session.rollback()
other.error("save app_data is error,here are details:{}".format(traceback.format_exc()))
finally:
db_session.close()