Note that there are some explanatory texts on larger screens.

plurals
  1. POAre mapreduce yield datastore mutation operations compatible with NDB models
    primarykey
    data
    text
    <p>In my Python AppEngine application, I have an ndb class which I am running a MapReduce job over in order to remove some old objects that are no longer needed. </p> <p>The class is as follows: </p> <pre><code>class UserModel(ndb.Model): is_backup_object = ndb.BooleanProperty(default=False) etc. </code></pre> <p>And the MapReduce job is as follows:</p> <pre><code>from mapreduce import operation as op # Note: userobject is an instantiation of UserModel def mapreduce_update_userobject(userobject): # This will remove "backup" userobjects from the database, while leaving # "normal" userobjects alone if userobject.is_backup_object: yield op.db.Delete(userobject) </code></pre> <p>When I run the MapReduce job, I have many <code>userobject</code>s that I want to delete (<code>is_backup_object = True</code>), and some of these objects are not being deleted even though the <code>is_backup_object value</code> is <code>True</code>. </p> <p>Questions:</p> <ol> <li>Are the mapreduce yield datastore mutation operations functions <code>operation.db.Put</code> and <code>operation.db.Delete</code> designed to work with NDB objects?</li> <li>Would the NDB automatic caching interfere with the removal of the yielded objects (or perhaps show outdated objects in the datastore viewer)?</li> <li>Is there a specific way that we should be yielding NDB objects that is different than standard database objects?</li> <li>Is there any other possible explanation for this strange behaviour that I have witnessed?</li> <li>If I am doing something incorrectly, then what is the best way to efficiently batch process NDB database entities with mapreduce? </li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload