Hi, I am developing application on app-engine-path and I would like to upload some data to datastore. For example I have a model
models/places.py:
class Place(db.Model):
name = db.StringProperty()
longitude = db.FloatProperty()
latitude = db.FloatProperty()
If I save this in view, kind() of this entity is "models_place". All is ok, Place.all() in view work fine.
But:
If I upload some next row using appcfg.py upload_data, the kind() of this entities is Place.
loader.py look like this:
import datetime, os, sys
from google.appengine.ext import db
from google.appengine.tools import bulkloader
libs_path = os.path.join("/home/martin/myproject/src/")
if libs_path not in sys.path:
sys.path.insert(0, libs_path)
from models import places
class AlbumLoader(bulkloader.Loader):
def __init__(self):
bulkloader.Loader.__init__(self, 'Place',
[('name', lambda x: x.decode('utf-8')),
('longitude', float),
('latitude', float),
])
loaders = [AlbumLoader]
and command for uploading:
python /usr/local/google_appengine/appcfg.py upload_data --config_file=places_loader.py --kind=models_place --filename=data/places.csv --url=http://localhost:8000/remote_api /home/martin/myproject/src/