def update_schema_task(cursor=None, num_updated=0, batch_size=100):
 reload(models_v2)
 query = models_v2.Picture.query()
 (pictures, next_cursor, more) = query.fetch_page(batch_size, start_cursor=cursor)
 to_put = []
 for picture in pictures:
  picture.num_votes = 1
  picture.avg_rating = 5
  to_put.append(picture)
 if to_put:
  ndb.put_multi(to_put)
  num_updated += len(to_put)
  logging.info('Put {} entities to Datastore for a total of {}'.format(len(to_put), num_updated))
 if more:
  deferred.defer(update_schema_task, cursor=next_cursor, num_updated=num_updated)
 else:
  logging.debug('update_schema_task complete with {0} updates!'.format(num_updated))

def update_schema_task ( cursor = None , num_updated = 0 , batch_size = 100 ) : reload ( models_v2 ) query = models_v2 . Picture . query ( ) ( pictures , next_cursor , more ) = query . fetch_page ( batch_size , start_cursor = cursor ) to_put = [ ] for picture in pictures : picture . num_votes = 1 picture . avg_rating = 5 to_put . append ( picture ) if to_put : ndb . put_multi ( to_put ) num_updated += len ( to_put ) logging . info ( 'Put {} entities to Datastore for a total of {}' . format ( len ( to_put ) , num_updated ) ) if more : deferred . defer ( update_schema_task , cursor = next_cursor , num_updated = num_updated ) else : logging . debug ( 'update_schema_task complete with {0} updates!' . format ( num_updated ) )
task that handles updating the models schema .