使用 python 查询 Cloudant (couchdb)(错误 500,未知查询语言)

querying Cloudant (couchdb) with python (error 500, unknown query language)

我对 Python 和 Cloudant/couchdb 还很陌生,因此请指导我了解您认为可能有帮助的任何资源。

我知道有一个类似的问题,但我会发布这个问题,以防看到这个问题的人有大量使用 Cloudant 的经验(而且我的错误消息不同)。我正在尝试查询存储在 cloudant 上的一堆 JSON 文档。为了在 python 中创建视图,我安装了 couchpy。我正在使用 Mining Social Web O\\'Reilly Book 中的代码。如果我正在查询我的本地 couchdb 服务器,而不是 cloudant 服务器,则我正在使用的代码有效。

我已收到此错误消息:

1
2
3
4
5
6
7
8
9
10
db.view('index/entity_count_by_doc', group=True)],
File"build/bdist.macosx-10.6-intel/egg/couchdb/client.py", line 984, in __iter__
File"build/bdist.macosx-10.6-intel/egg/couchdb/client.py", line 1003, in rows
File"build/bdist.macosx-10.6-intel/egg/couchdb/client.py", line 990, in _fetch
File"build/bdist.macosx-10.6-intel/egg/couchdb/client.py", line 880, in _exec
File"build/bdist.macosx-10.6-intel/egg/couchdb/http.py", line 393, in get_json
File"build/bdist.macosx-10.6-intel/egg/couchdb/http.py", line 374, in get
File"build/bdist.macosx-10.6-intel/egg/couchdb/http.py", line 419, in _request
File"build/bdist.macosx-10.6-intel/egg/couchdb/http.py", line 310, in request
couchdb.http.ServerError: (500, ('unknown_query_language', 'python'))

关于在 cloudant 上使用 python 进行查询的替代方法有什么想法吗?我对其他解决方案持开放态度。我确定我忽略了一些明显的东西。


您很可能会收到错误,因为在多租户安装中,Cloudant 上没有安装/不可用 couchpy

需要在 JavaScript 或 Erlang 中创建视图(或者您需要注册他们的专用安装,在那里他们可能允许 Python——联系他们)。

Cloudant 建议使用 CouchDBKit 或 Requests(根据他们的常见问题解答)。