[google-appengine] Re: pattern for getting one record and updating it...

2009-11-17 Thread Tim Hoffman
Hi Is there any particular reason why the api_key and scriptid couldn't be used to make a entity key ? ie obj = WorkTracker(key_name = "%s:%s" % (api_key,scriptid)) Then you can retrieve it by key using Model.get_by_key_name(key_names, parent=None) e.g. obj = WorkTracker.get_by_key_name( "%s:%

[google-appengine] Re: pattern for getting one record and updating it...

2009-11-17 Thread Tim Hoffman
db.get is a function of the google datastore api (google.appengine.ext.db) and it will fetch any entity from the datastore given its key. Have a read of api docs specifically http://code.google.com/appengine/docs/python/datastore/functions.html And its probably worth looking at the getting start

[google-appengine] Re: pattern for getting one record and updating it...

2009-11-14 Thread deostroll
If u r looking for a scenario...I have a table called WorkTracker define like this: class WorkTracker(db.Model): api_key = db.StringProperty() scriptid = db.StringProperty() status = db.StringProperty() trials = db.IntegerProperty() There is a scheduled task which

[google-appengine] Re: pattern for getting one record and updating it...

2009-11-14 Thread deostroll
Don't understand the db.get(some_key) part...why is it possible to do such a call in the first place...? I mean wht is so special in the db model we've defined which allows us to do a db.get()...? --deostroll -- You received this message because you are subscribed to the Google Groups "Google A

[google-appengine] Re: pattern for getting one record and updating it...

2009-11-13 Thread Tim Hoffman
Hi You probably need to give us a lot more info about what you are trying to do (how you get the records etc..) as the naive response is myobj = db.get(some_key) myobj.some_parameter = some_new_value myobj.put() No loop there ;-) But I assume you have some more requirements than this. For insta