def copy_and_delete_bathy(b): if b.key().name() == None: bn = BathymetryDataFile.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 do_all_copy_and_delete_bathy(count): earray = BathymetryDataFile.all().fetch(count) if len(earray)==0: print 'No more to convert' return for e in earray: copy_and_delete_bathy(e) print 'Converted %d'%count
def update_insert_bathy(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=BathymetryDataFile.get_or_insert(fields[1]+'_'+fields[0]) e.x=x e.y=y e.contents=contents e.put()
def do_delete_named_bathy(id): b=BathymetryDataFile.get_by_key_name(str(id)) if b: b.delete()