How to disable caching correctly in Sqlalchemy orm session?

前端 未结 4 516
执笔经年
执笔经年 2021-01-19 12:48

I have I thread in a daemon, that loops and performs the following query:

    try:
        newsletter = self.session.query(models.Newsletter).\\
                     


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-19 13:39

    don't use autocommit=True and expire_on_commit=True

    for state in self.identity_map.all_states():
        state.expire(state.dict, self.identity_map._modified)
    

    you can: after Query :db.session.commit()

提交回复
热议问题