Here is the same in the shortcut syntax from trunk:

#move to existing
db.posts[4] = db.posts[5] #copy to existing
del db.posts[5] #delete

# move to new (proposal)
db.posts[0] = db.posts[5] #copy to new
-> 6
del db.posts[5] # delete

It is not atomic on GAE, but should be on SQL.

Robin

On Jan 31, 4:54 pm, BearXu <bearx...@gmail.com> wrote:
> Why can't we invent a "move" command :)
>
> 2009/1/31 mdipierro <mdipie...@cs.depaul.edu>
>
>
>
> > define:
>
> > def cleanup(record,fields):
> >    return dict([(k,v) for k,v in record.items() if k in fields and
> > not k=='id'])
>
> > then copy it
>
> > db.b.insert(**cleanup(db(db.a.id==id).select()[0],db.b.fields))
>
> > then delete the old one
>
> > db(db.a.id==id).delete()
>
> > On Jan 31, 4:30 pm, BearXu <bearx...@gmail.com> wrote:
> > > Now I want to move a record from A table to B table
> > > do we have an easier way?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to