Appengine has a nice "datastore viewer" - you can browse your data, but if you want to find a specific row you need to run a query. The syntax is not obvious from the documentation if you're selecting by primary key:
SELECT * FROM DeviceInfo WHERE __key__ = Key('DeviceInfo', 'my_key')
I have a DeviceInfo table, with a primary key called 'name'. You can find about __key__ and Key in the docs, but I had to try many combinations to find that the first param is actually the type and the key name doesn't matter.
Of course, this doesn't work from java JDO - which is smart and uses the actual key name. And it doesn't use AND but &&. But it has as useless error messages as GQL, so at least there is some similarity.
Why use the primary key ? According to the docs and some presentations, the actual data is stored in the 'primary' entity table, using the primary key. All other indexes involve 2 lookups ( sorf of a JOIN ). And some use cases - like simple store by key - fit better in the 'bigtable' model than in the rich SQL.
Technical stuff
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment