Very Nice!

I will help testing this in my production couchdb mirror tomorrow,

any news for mongodb?

2010/12/7 mdipierro <[email protected]>

> forget it. it works. The mistake is in what I am printing. This now
> runs fine!
>
> from sql import DAL, Field
> db=DAL('couchdb://127.0.0.1:5984')
> db.define_table('person',Field('name'))
> id=db.person.insert(name='Jim')
> print id
> row=db.person(id)
> print row
> print db(db.person.id==id).update(name="john")
> print db.person(id)
> del db.person[id]
>
> On Dec 6, 11:19 pm, mdipierro <[email protected]> wrote:
> > I just added a partial and experiment support for couch in the new
> > DAL.
> >
> > I have a problem and perhaps some of you may help me.
> >
> > 1) am running couchdbx on mac (download and click, starts couchdb, no
> > questions asked)
> >
> > 2) I am running the following python script
> >
> > from sql import DAL, Field
> > db=DAL('couchdb://127.0.0.1:5984')
> > db.define_table('person',Field('name'))
> > id=db.person.insert(name='Jim')
> > print id
> > row=db.person(id)
> > print row #0
> > print db(db.person.id==id).update(name="john") #1
> > print db.person(id) #2
> > print row
> > del db.person[id]
> > print db.person(id)
> >
> > It works, except that #1 returns 1 (update done) but #2 returns Jim,
> > not John.
> > What am I doing wrong?
> >
> > You can only for one record by id.
> > Once this works fine, extending to more complex queries should be
> > easy.
> >
> > I have not tried it with web2py sqlforms but it should work fine.
> >
> > Notice the code of the adapter (ChouchDBAdapter) is very small. It can
> > be easily be extended to other NoSQL.
>



-- 

Bruno Rocha
http://about.me/rochacbruno/bio

Reply via email to