19
Jan
0

Uploading bulk data to data store

The documentation on how to upload bulk data to Google App Engine's data store: http://code.google.com/intl/es/appengine/docs/python/tools/uploadingdata.html

How to express relationships between models? How to support utf-8 in the bulk load?
Here is my loader.py

 
from appengine_django import InstallAppengineHelperForDjango
InstallAppengineHelperForDjango()
 
import datetime
from google.appengine.ext import db
from google.appengine.tools import bulkloader
 
from myapp.models import *
 
class MyLoader(bulkloader.Loader):
  def __init__(self):
    bulkloader.Loader.__init__(self, 'MyModel',
                               [('country',
                                  lambda x: Country.get_by_key_name(x)),
                                ('code',
                                  lambda x: unicode(x, 'utf-8')),
                                ('name',
                                  lambda x: unicode(x, 'utf-8'))
                               ])
 
loaders = [MyLoader]
 

The cvs:
ES, someCode, someName

The command line to upload the data:
.google_appengine/appcfg.py upload_data --config_file=loaders.py --filename=bulkdata.csv --kind=MyModel .

Problems I had: http://groups.google.com/group/google-appengine-python/browse_thread/thread/b524b5ad2cbecb30

Enjoyed reading this post?
Subscribe to the RSS feed and have all new posts delivered straight to you.
Post your comment



Celadon theme by the Themes Boutique
teeth bleaching
baldness treatment