pgjsonb2.py 文件源码

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

项目:saltdb 作者: davisj 项目源码 文件源码
def save_load(jid, load, minions=None):
    '''
    Save the load to the specified jid id
    '''
    with _get_serv(commit=True) as cur:

        sql = '''INSERT INTO jids
               (jid, load)
                VALUES (%s, %s)'''

        try:
            cur.execute(sql, (jid, psycopg2.extras.Json(load)))
        except psycopg2.IntegrityError:
            # https://github.com/saltstack/salt/issues/22171
            # Without this try:except: we get tons of duplicate entry errors
            # which result in job returns not being stored properly
            pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号