Hey Googlers,

First time poster here. I've been messing with this for hours, and I'm 
thinking it must be the simplest thing to do if you're slow like myself.

I'm trying to get into Google App Engine, so I've picked up a small task 
from a friend as a way to get my feet wet. He's put together an Access 
Database of electronic cigarette information, single table, simple stuff. 
Now I've created the following code to get it into google:

e.g.
      flavours(flavourID='7', flavourname='Spliced Lime', 
vendor='JuiceWhore', rating=7, notes='Good', Type='Desserts/Sweets').put()
      flavours(flavourID='8', flavourname='Cherry', vendor='Perfumers 
Apprentice', rating=5, notes='None', Type='Fruit').put()
      flavours(flavourID='9', flavourname='Vanilla', vendor='Perfumers 
Apprentice', rating=5, notes='None', Type='Other').put()
      flavours(flavourID='10', flavourname='Peach', vendor='Perfumers 
Apprentice', rating=7, notes='Good, goes well with menthol', 
Type='Fruit').put()

This seems to work however i've got 2 issues I can't seem to resolve.

1. Data isn't added to the database in order. In other words, the flavourID 
is incremental in nature, yet I'm not seeing "Spliced Lime" as the 7th 
entry in the datastore
2. Because of issue one I can't be sure if this is working. But I'd like to 
ORDER by flavourID ACS, in fact being about to query flavourID would be 
good to validate its working. I've been 
using secondquerytestobject.order('__key__') and query = 
db.GqlQuery("SELECT * FROM flavours Order by __key__") which seem to be 
legal commands but I can't get the ID with something like this:

for i in query.run():
        self.response.out.write(i.__key__)

Now I've been looking in a few places:
https://developers.google.com/appengine/docs/python/tools/uploadingdata
https://developers.google.com/appengine/docs/python/datastore/queries#Sort_Orders
https://developers.google.com/appengine/docs/python/datastore/gqlreference
https://developers.google.com/appengine/docs/python/datastore/queries

I think in one of these I saw, you simply cant use __key__ to query its 
value. How is everyone else doing it, is anyone else doing it? Does it have 
something to do with i.key().id()?

First time poster so let me know if I've not provided enough info!

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to