You would likely want to filter on the ID, and then do a get. See examples here: http://code.google.com/appengine/docs/python/datastore/queryclass.html
<http://code.google.com/appengine/docs/python/datastore/queryclass.html>See also the Python Memcache API instructions here: http://code.google.com/appengine/docs/python/memcache/ <http://code.google.com/appengine/docs/python/memcache/>Memcache will also be generally cheaper than datastore queries, if you ever go over quota on your app and need to enable billing. I highly recommend checking it out. - pamela On Mon, Dec 14, 2009 at 5:25 AM, eng.ma2m...@gmail.com < eng.ma2m...@gmail.com> wrote: > Thanks but actually I use Python not Java. > > Maybe it is the query I execute, and you might help me in this. If I > have two fields stored in datastore, whats the best query to be > executed to return one record, i.e. > the fields: > > language || UserID > French || x...@googlewave.com > Spanish || y...@googlewave.com > > If I want to fetch the language for the user x, how can I do it and > should I use fetch() or get() method ? > > > Thanks > > On Dec 13, 6:09 pm, "pamela (Google Employee)" <pamela...@gmail.com> > wrote: > > Right, exactly. When you're writing the data, you store it in the > datastore > > and memcache. When you're retrieving the data, you query memcache first, > and > > if it's not there, you query the datastore and re-set the memcache with > the > > value. > > See:http://code.google.com/appengine/docs/java/memcache/ > > > > For a more Wave-y datastore, you can use data documents: > http://wave-api-faq.appspot.com/#datadocs > > > > <http://code.google.com/appengine/docs/java/memcache/>- pamela > > > > On Sun, Dec 13, 2009 at 7:43 PM, Brett Morgan <brett.mor...@gmail.com > >wrote: > > > > > > > > > Memcache is possibly a better match for global vars without having to > hit > > > the db... but do remember memcache (like the running instance itself) > can > > > and will go away eventually. The DB is the only true non volatile > storage > > > you have on AppEngine... > > > > > On Sun, Dec 13, 2009 at 7:33 PM, cmdskp <cmd...@gmail.com> wrote: > > > > >> If you're using Java, you could try loading a synchronized static > > >> global object from an AppEngine database in a global static block. > > >> This will trigger only when the servlet is first loaded by any server > > >> and so you get both the speed of simple variables for requests without > > >> having to call the database again for each. > > > > >> For a static block, put your code inside your AbstractRobotServlet > > >> extending class like so: > > > > >> public class YourRobotServlet extends AbstractRobotServlet { > > > > >> static { > > >> //add database value retrieving code here and set your > > >> synchronized static variables up > > >> } > > > > >> ... > > > > >> } > > > > >> On Dec 11, 9:19 pm, "eng.ma2m...@gmail.com" <eng.ma2m...@gmail.com> > > >> wrote: > > >> > Thanks Pamela, > > > > >> > It is a great option indeed but I found it quite slow. I compared it > > >> > with the old global variables version and this one is slower. > > > > >> > Is thee another way to do it? does normal storing to separate > classes > > >> > work in this case or it is similar to global variables (got reset > > >> > after sometime). > > > > >> > On Dec 10, 1:08 pm, "pamela (Google Employee)" <pamela...@gmail.com > > > > >> > wrote: > > > > >> > > Hi Maamoun - > > > > >> > > This is an App Engine issue. App Engine runs your app from > different > > >> > > servers at different times, and this resets the value of global > > >> > > variables. If you need to store something to persist across > events, > > >> > > then use the datastore or a data document. > > > > >> > > - pamela > > > > >> > > On Thu, Dec 10, 2009 at 12:14 AM, eng.ma2m...@gmail.com > > > > >> > > <eng.ma2m...@gmail.com> wrote: > > >> > > > Please could someone confirm this as it really got on my nerves. > > > > >> > > > My Wave Robot Was working perfectly 3 days ago > > >> > > > (transla...@appspot.com). I use global variables to set the > > >> language I > > >> > > > want to translate to, and those variable are set by user at the > > >> > > > begining of the robot creation. > > > > >> > > > Since 3 days, I have noticed that if I leave the robot idle for > 5 > > >> > > > minutes, the global variables reset the values by themselves and > the > > >> > > > user becomes unable to translate to his pre-chosen language. > > > > >> > > > I am 100% that I haven't changed the code during last week, but > I > > >> have > > >> > > > noticed that it happened when my robot started getting load > > >> (although > > >> > > > less the 50% of the dedicated loads). > > > > >> > > > I have cloned the code to another ID, got same results. Tried it > on > > >> > > > Chrome and FF, same results. > > > > >> > > > Can someone give a relief please since I am working on new > robot, > > >> and > > >> > > > this newly raised problem stopped me from doing so. > > > > >> > > > Regards. > > >> > > > Maamoun > > > > >> > > > -- > > > > >> > > > You received this message because you are subscribed to the > Google > > >> Groups "Google Wave API" group. > > >> > > > To post to this group, send email to > > >> google-wave-...@googlegroups.com. > > >> > > > To unsubscribe from this group, send email to > > >> google-wave-api+unsubscr...@googlegroups.com<google-wave-api%2bunsubscr...@googlegroups.com> > <google-wave-api%2Bunsubscribe@ googlegroups.com> > > >> . > > >> > > > For more options, visit this group athttp:// > > >> groups.google.com/group/google-wave-api?hl=en. > > > > >> -- > > > > >> You received this message because you are subscribed to the Google > Groups > > >> "Google Wave API" group. > > >> To post to this group, send email to google-wave-api@googlegroups.com > . > > >> To unsubscribe from this group, send email to > > >> google-wave-api+unsubscr...@googlegroups.com<google-wave-api%2bunsubscr...@googlegroups.com> > <google-wave-api%2Bunsubscribe@ googlegroups.com> > > >> . > > >> For more options, visit this group at > > >>http://groups.google.com/group/google-wave-api?hl=en. > > > > > -- > > > Brett Morganhttp://domesticmouse.livejournal.com/ > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Google Wave API" group. > > > To post to this group, send email to google-wave-...@googlegroups.com. > > > To unsubscribe from this group, send email to > > > google-wave-api+unsubscr...@googlegroups.com<google-wave-api%2bunsubscr...@googlegroups.com> > <google-wave-api%2Bunsubscribe@ googlegroups.com> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/google-wave-api?hl=en. > > -- > > You received this message because you are subscribed to the Google Groups > "Google Wave API" group. > To post to this group, send email to google-wave-...@googlegroups.com. > To unsubscribe from this group, send email to > google-wave-api+unsubscr...@googlegroups.com<google-wave-api%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/google-wave-api?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-...@googlegroups.com. To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en.