incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Sebastian <hnsb...@gmail.com>
Subject Re: [ANN] CouchDB-Python 0.6
Date Fri, 03 Jul 2009 16:07:28 GMT
Hi Christopher,

Thanks for the new release. I've been using your package and I have a
question, a basic question. This may not be related to using your package so
anybody who can help, please help me. I really appreciate it.

If I have this format for my document
{
  "metadata": "metadatavalue",
  "data": [object1, object2, object3, ...]
}

where each object is like
{
  "name": "value for name",
  "status": "value for status"
}

Currently, this is what I do:

server = Server("http://localhost")
db = server["database-1"]
doc = db["document-1"]
data = doc["data"]

i = 0
while i < 10:
  data.append({ "name": "value for name", "status": "value for status"})
  db.update([Document(doc)])

What I am trying to do is to update the document by inserting elements at
the end in the "data" array.

My problem is that this is not working and when the loop is huge, data gets
huge as well.

What is the best way to do this?

Thank you. I appreciate any help.
-hans


On Thu, Jul 2, 2009 at 2:33 PM, Christopher Lenz <cmlenz@gmx.de> wrote:

> Hey all,
>
> at long last, a new release of CouchDB-Python has become available today:
> 0.6
>
>
> This is the release that was *supposed* to be released around the time
> CouchDB 0.9 got released, but alas, other things got in the way. Anyway,
> this release comes with a number of fixes and improvements that should
> hopefully benefit anyone using this library, including:
>
> * `schema.DictField` instances no longer need to be bound to a `Schema`
> (issue 51).
> * Added a `config` property to the `client.Server` class (issue 67).
> * Added a `compact()` method to the `client.Database` class (issue 37).
> * Changed the `update()` method of the `client.Database` class to simplify
> the handling of errors. The method now returns a list of `(success, docid,
> rev_or_exc)` tuples. See the docstring of that method for the details.
> * `schema.ListField` proxy objects now support the `__contains__()` and
> `index()` methods (issue 77).
> * The results of the `query()` and `view()` methods in the
> `schema.Document` class are now properly wrapped in objects of the class if
> the `include_docs` option is set (issue 76).
> * Removed the `eager` option on the `query()` and `view()` methods of
> `schema.Document`. Use the `include_docs` option instead, which doesn't
> require an additional request per document.
> * Added a `copy()` method to the `client.Database` class, which translates
> to a HTTP COPY request (issue 74).
> * Accessing a non-existing database through `Server.__getitem__` now throws
> a `ResourceNotFound` exception as advertised (issue 41).
> * Added a `delete()` method to the `client.Server` class for consistency
> (issue 64).
> * The `couchdb-dump` tool now operates in a streaming fashion, writing one
> document at a time to the resulting MIME multipart file (issue 58).
> * It is now possible to explicitly set the JSON module that should be used
> for decoding/encoding JSON data. The currently available choices are
> `simplejson`, `cjson`, and `json` (the standard library module). It is also
> possible to use custom decoding/encoding functions.
> * Add logging to the Python view server. It can now be configured to log to
> a given file or the standard error stream, and the log level can be set
> debug to see all communication between CouchDB and the view server (issue
> 55).
> * The replication_helper script now uses pull instead of push replication
> (issue 46).
> * The replication_helper script allows providing authentication credentials
> using the http://username:password@server format (issue 47).
> * The replication_helper wait threshold no longer defaults to 0 seconds
> thus pegging the CPU (issue 48)
> * Also, replication_helper can now optionally log to a file, and the
> command-line syntax has been cleaned up.
>
>
> It can be downloaded from PyPI here:
>
>  <http://pypi.python.org/pypi/CouchDB>
>
> To report bugs, join the mailing list, etc, start with the project
> homepage:
>
>  <http://code.google.com/p/couchdb-python/>
>
>
> Many thanks to everyone who contributed patches and bug reports!
>
> Cheers,
> --
> Christopher Lenz
>  cmlenz at gmx.de
>  http://www.cmlenz.net/
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message