Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From what I understand you are doings something like the following:</p> <pre><code>for i in range(0,100): ent = My_Entity() # create and save entity db.put(ent) ent = db.get(ent.key()) # get, modify and save the entity ent.property = 'foo' db.put(ent) ent.get(ent.key()) # get and delete the entity db.delete(my_ent) </code></pre> <p>with some error checking to make sure you have entities to delete, modify, and you are running into a bunch of errors about finding the entity to delete or modify. As you say, this is because the calls aren't guaranteed to be executed in order.</p> <blockquote> <p>However, I want to understand how to handle these kind of situation where concurrent operation is being done with a Entity.</p> </blockquote> <p>You're best bet for this is to batch any modifications you are doing for an entity persisting. For example if you are going to be creating/saving/modifying/savings or modifying/saving/deleting where ever possible try to combine these steps (ie create/modify/save or modify/delete). Not only will this avoid the errors you're seeing but it will also cut down on your RPCs. Following this strategy the above loop would be reduced to... </p> <pre><code>prop = None for i in range(0,100): prop = 'foo' </code></pre> <p>Put in other words, for anything that requires setting/deleting that quickly just use a local variable. That's GAE's answer for you. After you figure out all the quick stuff you can't persist that information in an entity.</p> <p>Other than that there isn't much you can do. <a href="https://developers.google.com/appengine/docs/python/datastore/transactions" rel="nofollow">Transactions</a> can help you if you need to make sure a bunch of entities are updated together but won't help if you're trying to multiple things to one entity at once.</p> <p>EDIT: You could also look at the <a href="http://code.google.com/p/appengine-pipeline/" rel="nofollow">pipelines API</a>.</p>
    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.
 

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