I have a ‘Calculation’ entity in my datastore with say, 7 million objects under that entity. It has the following properties (python runtime):
class Calculation(db.Model):
question = db.StringProperty(required=True)
answer = db.StringProperty()
suppose examples of the ‘question’ property are things like ‘1+1’, ‘2+2’, ‘3+3’ (not really important). All the calculation objects start out with empty answer properties.
When a user connects to the app, an ajax call is made and my app is supposed to [1] fetch a Calculation object with an empty answer property and send it to the user’s browser. The user’s browser then evaluates the question and sends it back to a different server handler.
How do I update that specific Calculation object’s answer property[2]?
If someone could provide me with code for [1] and [2] that would be great. Not really experienced with App Engine and the query stuff is confusing. What is the best solution for this if I want to conserve as much server-CPU as possible?
Thanks!
I don’t know if i have really understand. But you simply need to return for your first ajax call the key of the entity Calculation and the
question. When the user makes a response you firstly get the entity by the key and update the propertyanswer.Step 1, The ajax call return a question in JSON (for example):
Step 2, You update the entity by the key: