def delete_all_dems(): while 1: print 'Deleting another 500' try: db.delete(DEMDataFile.all().fetch(500)) except: print 'Caught error, continuing...'
def copy_and_delete_dem(b): if b.key().name() == None: bn = DEMDataFile.get_or_insert(str(b.x)+'_'+str(b.y),x=b.x,y=b.y,contents=b.contents) if bn: b.delete() else: raise 'Could not create key based entity for '+b.to_xml()
def update_insert_dem(input): startByte = input[0] if int(startByte)==0: # ignore first line..its a header return; line = input[1] fields=line.split(',') print line, fields x=int(fields[1]) y=int(fields[0]) contents=db.Blob(base64.b64decode(fields[2])) e=DEMDataFile.get_or_insert(fields[1]+'_'+fields[0]) e.x=x e.y=y e.contents=contents e.put()
def do_delete_named_dem(id): b=DEMDataFile.get_by_key_name(str(id)) if b: b.delete()
def do_all_copy_and_delete_dem(count): earray = DEMDataFile.all().fetch(count) if len(earray)==0: return for e in earray: copy_and_delete_dem(e)