-1

I have about 1000 user account entities like this:

class UserAccount(ndb.Model):
    email = ndb.StringProperty()

Some of these email values contain uppercase letters like JohnathanDough@email.com. I want to select all the email values from all UserAccount entities and apply python's email.lower(). How can I do this efficiently, and most importantly, without errors?

Note: The email values are important for login, so I cannot afford to mess this up. Is there a way to backup this data in case of the event that I do make a mistake?

Thank you.

hyang123
  • 1,208
  • 1
  • 13
  • 32

2 Answers2

1

Yes, off course. Even if Datastore Administration is an experimental feature we can backup and restore data without coding. Follow this instruction for the backup flow: Backing up data. To processing your data instead, the most efficient way is to use the MapReduce library.

Gianni Di Noia
  • 1,577
  • 10
  • 25
0

Mapreduce works but its an excesive complication if youve never done it before.
Use task queues, each can handle a query result page, store the next pageToken and start another taskqueue for the next page.
Slower than mapreduce if you run the taskqueues secuentially. 1000 entries ia not much. Maybe in one minute it will be done.

Zig Mandel
  • 19,571
  • 5
  • 26
  • 36
  • you are right - Map Reduce is quite complex for a beginner. Would it be an imposition to ask you to write an example of how a task queue is used in this very particular example? I would be grateful for perhaps the minimal code to get this done; I have never worked with Task Queue yet. – hyang123 Jun 30 '14 at 17:54
  • please try to write the code first, and post a separate S.O question if you encounter issues. – Zig Mandel Jun 30 '14 at 18:01
  • see this answer for example: http://stackoverflow.com/questions/21638552/how-to-update-400-000-gae-datastore-entities-in-parallel/21640143#21640143 – Zig Mandel Jun 30 '14 at 18:04
  • Thank you, Zig Mandel. I have read the answer link and other resources, and I've learned a lot. I am still unclear about some things like the cursor. I have created a separate SO question like you suggested. Please have a look here: http://stackoverflow.com/questions/24761801/google-app-engine-modifying-1000-entities-using-taskqueue. Thank you so much again. – hyang123 Jul 15 '14 at 15:12