Online tool to decode/encode a Datastore Key

810 views
Skip to first unread message

dele...@gmail.com

unread,
Jul 30, 2014, 7:41:58 AM7/30/14
to google-a...@googlegroups.com
Hello
Having used the AppEngine services for a few months, I experienced the following facts concerning the NoSQL Datastore primary keys :
- the exact nature of a Key is not obvious to everyone (although documented in each language-specific online doc).
- the creation/modification of a Key is not trivial when it comes to AppIds and Namespaces, depending on what is exposed or not in each language-specific API.

FWIW, I've deployed the following page to help data extracting from, or encoding to a Key : http://datastore-key.appspot.com/
Example : http://datastore-key.appspot.com/?keystring=ag9zfmRhdGFzdG9yZS1rZXlyNQsSEk15UGFyZW50RW50aXR5VHlwZSIIZXVyb3BlLTQMCxIPTXlTdWJFbnRpdHlUeXBlGCoM

It answers to two questions for debug and understanding purpose :
- "What entity is refered to by this huge string dangling in my querystring/json/logs/hardcoded constants ?"
- "What would be the string representation of a key of an entity in my application with specific id ?"

The keys themselves are luckily language-independent, like all the Datastore content and the admin console pages.
This online tool also provides nice links to the Datastore Viewer, and two browser search engines taking a Key string as search term.

dele...@gmail.com

unread,
Aug 7, 2014, 4:39:25 AM8/7/14
to google-a...@googlegroups.com
In case someone needs to automate a conversion, the services /decode and /encode (used by the page as ajax calls) return JSON data.

Although in order to process hundreds of keys in a batch, remote services calls + JSON decoding might not be the most practical solution, so I plan to release a command-line tool for decoding, encoding and conversion.
Reply all
Reply to author
Forward
0 new messages