db.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:airflow 作者: apache-airflow 项目源码 文件源码
def pessimistic_connection_handling():
    @event.listens_for(Pool, "checkout")
    def ping_connection(dbapi_connection, connection_record, connection_proxy):
        '''
        Disconnect Handling - Pessimistic, taken from:
        http://docs.sqlalchemy.org/en/rel_0_9/core/pooling.html
        '''
        cursor = dbapi_connection.cursor()
        try:
            cursor.execute("SELECT 1")
        except:
            raise exc.DisconnectionError()
        cursor.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号