Thankx nick...

i did it in batch of 25 entities at a time....



i migrated using where clause in query

On Jun 4, 9:01 pm, "Nick Johnson (Google)" <nick.john...@google.com>
wrote:
> Hi Ankur,
>
> The easiest way to decrease your runtime is to decrease the number of round
> trips. .fetch() on a query only makes one roundtrip (instead of potentially
> many in the case of iterating over it), and you can accumulate results and
> put them in a single operation, like so:
>
> ---
> users = db.GqlQuery("SELECT * FROM UserProfile")
> updated = []
> for cur_user in users.fetch(100):
>   up = UserProfile1()
>   up.user = cur_user.user
>   up.fname = cur_user.name
>   up.lname = cur_user.lname
>   updated.append(up)
> db.put(up)
> ---
>
> Several caveats, though:
> - If you still have more records than can be processed in one request,
> you'll need to shard this and process a bit in each request.
> - Since you're not using key names or any other deduplication mechanism,
> running this multiple times will create multiple sets of UserProfile1
> records.
> - Since all the updates aren't in a single transaction (and indeed, can't
> be), your timed out attempts from earlier will have likewise created
> duplicates.
>
> You may be better considering how you can migrate your existing records
> rather than creating new ones. That way, you can determine if a record has
> been migrated when you retrieve it from the query, and only update it if it
> hasn't.
>
> -Nick Johnson
>
> On Thu, Jun 4, 2009 at 8:37 AM, Ankur <stiitan...@gmail.com> wrote:
>
> > hi,
>
> > I am using simple code to copy my database table data to another table
>
> > code used is
>
> >  users = db.GqlQuery("SELECT * FROM UserProfile")
>
> >    for cur_user in users:
> >      up=UserProfile1()
> >      up.user=cur_user.user
> >      up.fname=cur_user.name
> >      up.lname=cur_user.lname
> >      up.completed=bool()
> >      up.put()
>
> > my first table has 100 records only
>
> > but whenever i start back up process i always get timeout error.
>
> > Any idea how can i do this...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to