All I have followed the code to bulk Upload a CSV file into a table in
GAE. It worked great. I am now 6 months down the line and want to add
a few thousand more records to the table and also to update many of
the records in the table.

The original code only deals with loading data afresh, I have not
written any code to check if the records in the CSV file should be
added into the GAE table new or if records in the table should be
updated.

Can anyone point me in the right direction on how to achieve an upload
that does add or update? What is the process?

My code is

import datetime
from google.appengine.ext import db
from google.appengine.tools import bulkloader

class location_locationsearch(db.Model):
    location_name = db.StringProperty(required=True)
    location_load = db.GeoPtProperty(required=True, indexed=False)
    longitude_search_distance = db.FloatProperty(required=True,
indexed=False)
    latitude_search_distance = db.FloatProperty(required=True,
indexed=False)


class LocationSearchLoader(bulkloader.Loader):
  def __init__(self):
    bulkloader.Loader.__init__(self, 'location_locationsearch',
                               [('location_name', str),
                                ('location_load', str),
                                ('latitude_search_distance', float),
                                ('longitude_search_distance', float),
                               ])

  def HandleEntity(self, entity):
     key = entity['key']
     entity = db.get(db.Key(key))
     if entity:
       entity.delete()
     return []

loaders = [LocationSearchLoader]

-- 
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-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to