lanto03 / couchdb-python

Automatically exported from code.google.com/p/couchdb-python
Other
0 stars 0 forks source link

Error after successful db.update with CouchDB 0.8 #113

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

>>> db["_design/domain-stats"]
[traceback...]
ResourceNotFound: ('not_found', 'missing')
>>> db.update([doc])
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "python/lib/python2.5/site-packages/CouchDB-0.6.1-
py2.5.egg/couchdb/client.py", line 696, in update
    doc.update({'_id': result['id'], '_rev': result['rev']})
TypeError: string indices must be integers
>>> db["_design/domain-stats"]
<Document '_design/domain-stats'@'1308076259' ...>

To summarize version numbers:
CouchDB: 0.8.0-incubating (that's what debian lenny-backports offers)
couchdb-python: 0.6.1 (via pip install, so that's what pypi offers today)

Same code works fine with CouchDB 0.10.0 (ubuntu karmic build)

Original issue reported on code.google.com by temotor on 3 Feb 2010 at 6:07

GoogleCodeExporter commented 8 years ago
What is doc? I'm guessing it's not a dictionary-like.

Original comment by djc.ochtman on 3 Feb 2010 at 6:35

GoogleCodeExporter commented 8 years ago

>>> doc = {
...    "_id": "_design/domain-stats",
...    "language": "javascript",
...    "views": {
...        "by-name": {
...            "map": "function(doc) {\n  if (doc.Type == 'domain-stats')\n  
emit(doc.name, null);\n}"
...        },
...        "by-name-reduced": {
...            "map": "function(doc) {\n  if (doc.Type == 'domain-stats')\n  
emit(doc.name, null);\n}",
...            "reduce": "function(keys, values) {\n  return null;\n}"
...        },
...        "by-name-and-dates": {
...            "map": "function(doc) {\n  if (doc.Type == 'domain-stats')\n  
emit([doc.name, doc.date_from, doc.date_to], null);\n}"
...        },
...        "by-date_from": {
...            "map": "function(doc) {\n  if (doc.Type == 'domain-stats')\n  
emit(doc.date_from, null);\n}"
...        }
...    }
... }

Original comment by temotor on 3 Feb 2010 at 6:42

GoogleCodeExporter commented 8 years ago
Oh, wait, so you're saying the Python code (always 0.6.1) fails against CouchDB 
0.8,
but works against CouchDB 0.10? That is to be expected, since couchdb-python 
0.6.x
has been tested on 0.9.x and 0.10.x only (as the homepage states).

Original comment by djc.ochtman on 3 Feb 2010 at 9:59

GoogleCodeExporter commented 8 years ago
So what do you suggest for (lots of) Debian Lenny users?

Original comment by temotor on 3 Feb 2010 at 10:56

GoogleCodeExporter commented 8 years ago
Try an old version of couchdb-python or install CouchDB from source or some 
other
repository.

Original comment by djc.ochtman on 3 Feb 2010 at 11:03

GoogleCodeExporter commented 8 years ago
Which old version of couchdb-python should i try?

Original comment by temotor on 3 Feb 2010 at 11:09

GoogleCodeExporter commented 8 years ago
Try 0.5 or 0.4. (But you're really a lot better off upgrading CouchDB.)

Original comment by djc.ochtman on 3 Feb 2010 at 11:21

GoogleCodeExporter commented 8 years ago
I understand, but i am limited to use CouchDB version in debian packages. And 
this is 
not exceptional case, but a very common one. There are a lot of conservative 
admins, 
you know.

Original comment by temotor on 3 Feb 2010 at 11:36