1.在网上可能找的方案如下:
try: cur.execute(sql_1) conn.commit() except Exception as e: print(e) print("jira数据无法同步至数据库") conn = pg_conn() cur = conn.cursor().execute(sql_1) conn.commit()
出错以后再次进行链接,也许可以解决问题。但是直接pass掉
2.
地址:https://www.postgresql.org/docs/9.3/libpq-connect.html (文章底部) # 获取pg数据库对象 def pg_conn(): conn = psycopg2.connect( database='xxxx', user='xxxx', password='xxxx', host='xxxx', port='xxxx', keepalives=1, keepalives_idle=30, keepalives_interval=10, keepalives_count=5 ) return conn
标签:terminated,xxxx,means,server,unexpectedly,pg,keepalives,conn From: https://www.cnblogs.com/meipu/p/16620881.html