【发布时间】:2016-04-19 11:06:04
【问题描述】:
我正在使用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
唯一不同的是操作系统。我的本地有 Mac OX,而服务器在 CentOS 6.7
我无法修复此错误。
【问题讨论】:
标签: python amazon-redshift psycopg