psycopg2 OperationalError: invalid connection option
psycopg2 OperationalError: invalid connection option
我正在使用 records 库连接到 redshift 数据库。我的 db_url 类似于
postgresql://xxxxx.us-east-1.redshift.amazonaws.com:5439/customer?user=xxxxx&password=xxxxx
我正在使用这段代码连接到数据库。在我的本地机器上它工作得很好。
import records
>>> conn_url = 'postgresql://xxxxx.us-east-1.redshift.amazonaws.com:5439/customer?user=xxxxx&password=xxxxx'
>>> db = records.Database(conn_url)
但是在服务器机器上它给我这个错误
File "<stdin>", line 1, in <module>
File "/opt/extractor/virtualenv/hge/lib/python2.7/site-packages/records.py", line 177, in __init__
self.db = psycopg2.connect(self.db_url, cursor_factory=RecordsCursor)
File "/opt/extractor/virtualenv/hge/lib/python2.7/site-packages/psycopg2/__init__.py", line 164, in connect
conn = _connect(dsn, connection_factory=connection_factory, async=async)
psycopg2.OperationalError: invalid connection option "postgresql://xxxxx.us-east-1.redshift.amazonaws.com:5439/customer?user"
两台机器都安装了相同版本的库
psycopg2==2.6.1
records==0.3.0
唯一不同的是 OS。我的本地有 Mac OX 而服务器在 CentOS 6.7
我无法修复此错误。
我已将我的记录库升级到 records==0.4.3
并且成功了
我正在使用 records 库连接到 redshift 数据库。我的 db_url 类似于
postgresql://xxxxx.us-east-1.redshift.amazonaws.com:5439/customer?user=xxxxx&password=xxxxx
我正在使用这段代码连接到数据库。在我的本地机器上它工作得很好。
import records
>>> conn_url = 'postgresql://xxxxx.us-east-1.redshift.amazonaws.com:5439/customer?user=xxxxx&password=xxxxx'
>>> db = records.Database(conn_url)
但是在服务器机器上它给我这个错误
File "<stdin>", line 1, in <module>
File "/opt/extractor/virtualenv/hge/lib/python2.7/site-packages/records.py", line 177, in __init__
self.db = psycopg2.connect(self.db_url, cursor_factory=RecordsCursor)
File "/opt/extractor/virtualenv/hge/lib/python2.7/site-packages/psycopg2/__init__.py", line 164, in connect
conn = _connect(dsn, connection_factory=connection_factory, async=async)
psycopg2.OperationalError: invalid connection option "postgresql://xxxxx.us-east-1.redshift.amazonaws.com:5439/customer?user"
两台机器都安装了相同版本的库
psycopg2==2.6.1
records==0.3.0
唯一不同的是 OS。我的本地有 Mac OX 而服务器在 CentOS 6.7
我无法修复此错误。
我已将我的记录库升级到 records==0.4.3
并且成功了