I have a model in Google App Engine that has 50,000+ entities. I would like to create a mapreduce or other operation to iterate over all 50,000+ entities and export the results of a method on the model to a text file. Then once I’m done, I want to download the text file.
What is the easiest way to do this in Google App Engine? I just need to iterate though all the entities and write out the results of expert_data() to a common file.
#Example model
class Car(db.Model):
color = db.StringProperty()
def export_data(self):
return self.color
Use the mapreduce API: https://developers.google.com/appengine/docs/python/dataprocessing/. It also has a BlobstoreOutputWriter which you can use to create a blob and then download that blob.
As per suggestion by Dave, here is an example: http://code.google.com/p/appengine-mapreduce/source/browse/trunk/python/demo/main.py#264