首页 > 解决方案 > Python:psycopg2.OperationalError:致命:连接限制

问题描述

如何在我的 python 脚本中解决此错误:

conn=psycopg2.connect(dbname=dbname, host=host, port=port, user=rsuser, password=password)
  File "/usr/local/lib/python3.7/site-packages/psycopg2/__init__.py", line 126, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: FATAL:  connection limit "498" exceeded for non-superusers

我正在连接到 Redshift 数据库,并且我的脚本缺少连接关闭,但现在如何删除连接以便我可以继续?

标签: pythonpsycopg2

解决方案


在拨打 Redshift 时遇到了类似的问题。减少批量大小,它对我有用。尝试减少呼叫的批量大小。


推荐阅读