couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <paul.joseph.da...@gmail.com>
Subject Re: quick python / couch question
Date Sun, 15 Feb 2009 18:26:19 GMT
Adam,

This should be as simple as:

import couchdb
server = couchdb.Server("http://127.0.0.1:5984")
db = server.create("test_db")
data = create_my_data_object()
db.save(data)
# or with a specified docid
db["my_docid"] = data

HTH,
Paul Davis

On Sat, Feb 14, 2009 at 9:31 PM, Adam Petty <adamjpetty@gmail.com> wrote:
> My appologies if this isn't the right place...and yes I'm a neub at things
> both python and couch so I'll be greatly appreciative for any info
> available.
>
> I'm currently trying to get a python object to convert to a couch document
> to submit to the DB - but can't seem to find a good way to do it.
>
> for example:
>
> Id like to convert the following python document:
>
> {'username':'johnsmith','date'":(2009, 1, 1, 0, 0, 0, 3, 1, -1), 'names':
> {'lname':'smith','birtdate':(1974, 1, 20, 0, 0, 0, 3, 1, -1),
> 'fname':'tim'}}
>
> I'd like to write this directly to a couchDB - and I've tried jsonpickle,
> and looked all through couchdb.schema, but again am new at python and couch.
>
>
>
> I can see the dicts, and I know I can convert from a couchdoc to python
> automatically -- what am I missing.
>
> Again - thanks,
>
> Adam
>

Mime
View raw message