Mahmoud,

Oh yes, and I do want to finally populate the production site as well

Alan...

On Oct 16, 4:13 pm, Mahmoud <[EMAIL PROTECTED]> wrote:
> Are you trying to load the data in production or the local datastore?
>
> I found it much easier to load data using either one of these methods:
> 1. Write a python script that loads the data for you. For example, I
> access mine via:http://localhost:8080/load
>
> 2. Use Fixture!:
> Fixture is pretty awesome. We use it to load test data for our unit
> and functional tests. You can use the datastore file created by
> fixture with 
> dev_appserver.http://farmdev.com/projects/fixture/using-fixture-with-appengine.html
>
> -Mahmoud
>
> On Oct 16, 9:20 am, Alan <[EMAIL PROTECTED]> wrote:
>
>
>
> > I don't know if you can help but I wonder if you’ve tried doing a bulk
> > load on existing tables with a relation. I’ve tried but come up
> > against a problem . I used the bulkloader example.
> > This is my schema.
>
> > Member — Running club member
> > Race — a race event racename,date, distance
> > Runner — is child of Member and Race being the time for the race taken
> > by the member.
>
> > -- These are my models
>
> > from google.appengine.ext import webapp
> > from google.appengine.ext import db
>
> > class Member(db.Model):
> >   memberid       = db.StringProperty()
> >   name           = db.StringProperty()
> >   category       = db.StringProperty()
> >   currentMember  = db.StringProperty()
> > member = Member()
> > member.put()
>
> > class Race(db.Model):
> >   raceid   = db.StringProperty()
> >   name     = db.StringProperty()
> >   date     = db.StringProperty()
> >   distance = db.StringProperty()
> >   units    = db.StringProperty()
> > race = Race()
> > race.put()
> > class Runner(db.Model):
> >   racerunner  = db.StringProperty()
> >   raceid     = db.StringProperty()
> >   runnerid   = db.StringProperty()
> >   runnername = db.StringProperty()
> >   race       = db.ReferenceProperty(reference_class=Race)
> >   member     = db.ReferenceProperty(reference_class=Member)
> >   time       = db.StringProperty()
> >   position   = db.StringProperty()
> >   category   = db.StringProperty()
> >   WAVA       = db.StringProperty()
> >   pace       = db.StringProperty()
> >   notes      = db.StringProperty()
> > runner = Runner()
> > runner.put()
> > #This is my data to load
> > #Runner.csv
> > 00310017,0031,0017,Bil Salters,2:32:05,M40,94,59.87,9:30,NOMATCH
> > 00310016,0031,0016,Iian Sallis,2:40:26,SM,103,57.59,10:01,NOMATCH
> > 00320018,0032,0018,Jon Church,35:02,SM,67.34,6:29,2nd M40
> > 00320019,0032,0019,Sarah Church,51:39,F45,105,51.26,9:33,3rd F45
> > #member.csv
> > 0017,Bil Salters,M40,Yes
> > 0016,Iian Sallis,SM,No
> > 0018,Jon Church,SM,Yes
> > 0019,Sarah Church,F45,No
> > #race.csv
> > 0031,North Mids XC Race 3 (men) ,13-01-2007,6.5,miles
> > 0032,Bedford Half Marathon ,10-12-2006,13.1,miles
>
> > I tried to load Runner with this:
> > #myRunnerloader.py
> > from google.appengine.ext import bulkload
> > from google.appengine.api import datastore_types
> > from google.appengine.api import datastore_entities
> > from google.appengine.ext import search
> > class RunnerLoader(bulkload.Loader):
> >   def __init__(self):
> >     # Our 'Race' entity contains an id name string date distance and
> > units
> >     bulkload.Loader.__init__(self, 'Runner',
> >                          [('racerunner', str),
> >                           ('raceid', str),
> >                           ('runnerid', str),
> >                           ('runnername', str),
> >                           ('time', str),
> >                           ('position', str),
> >                           ('category', str),
> >                           ('WAVA', str),
> >                           ('pace', str),
> >                           ('notes', str),
> >                           ])
> >   def HandleEntity(self, entity):
> >     runner = datastore_entities.Runner(racerunner)
> >     runner.update(entity)
>
> >     raceid = runner['raceid']
> >     runnerid = runner['runnerid']
> >     if raceid:
> >         race = datastore.Query('Race',{'raceid': raceid}).Get(1)
> >         if not race:
> >             race = [datastore_entities.Race(raceid)]
> >             datastore.Put(race[0])
> >         runner['race'] = race[0].key()
> >     if runnerid:
> >         member = datastore.Query('Member',{'runnerid':
> > runnerid}).Get(1)
> >         if not member:
> >             member = [datastore_entities.Member(runnerid)]
> >             datastore.Put(member[0])
> > ['member'] = member[0].key()
> >     return runner
> > if __name__ == '__main__':
> >   bulkload.main(RunnerLoader())
>
> > #And this cmd command on XP
> >         runnercd C:\Google_apps
> > python "C:\Program Files\Google\google_appengine\tools
> > \bulkload_client.py"
> > --filename C:\Google_apps\data\Runnerfull.csv
> > --kind Runner
> > --urlhttp://127.0.0.1:8080/runnerload
> > And I get this error:
>
> > C:\Documents and Settings\Alan Maplethorpe>cd C:\Google_apps
> > C:\Google_apps>python "C:\Program Files\Google\google_appengine\tools
> > \bulkload_client.py" --filename C:\Google_apps\data\Runner.csv --kind
> > Runner  --url http://
> > 127.0.0.1:8080/runnerload
> > INFO     2008-10-16 14:05:35,157 bulkload_client.py] Starting import;
> > maximum 10 entities per post
> > INFO     2008-10-16 14:05:35,167 bulkload_client.py] Importing 4
> > entities in 260 bytes
> > ERROR    2008-10-16 14:05:36,178 bulkload_client.py] An error occurred
> > while importing: Received code 400: Bad Request
> > Loading from line 1...error:
> > Traceback (most recent call last):
> >   File "C:\Program Files\Google\google_appengine\google\appengine\ext
> > \bulkload\__init__.py", line 376, in LoadEntities
> >     new_entities = loader.CreateEntity(columns, key_name=key_name)
> >   File "C:\Program Files\Google\google_appengine\google\appengine\ext
> > \bulkload\__init__.py", line 235, in CreateEntity
> >     entities = self.HandleEntity(entity)
> >   File "C:\Google_apps\myrunningdata\myrunnerloader2.py", line 23, in
> > HandleEntity
>
> >       runner = datastore_entities.Runner(racerunner)
> > AttributeError: 'module' object has no attribute 'Runner'
> > ERROR    2008-10-16 14:05:36,178 bulkload_client.py] Import failed
> > C:\Google_apps>
>
> > Any ideas?
>
> > Alan...- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to