python - Parse nbd.Key(urlsafe=string) externally -


i bit further. getting key representatation in google apps script of key created nbd.key() in python.

when decode key, incomplete set of data:

agxzfm92zxitc2lnahryjwsscen1c3rvbwvyighzexnhzg1pbgwlegldb25kaxrpb24ypjwbda 

when convert back, readable entities, miss id. base64decoded:

"js~over-sightr'customer"sysadmin   condition��" 

is there way without needing python?

old post:

in google datastore, set of scores saved datastore nbd.jsonproperty.

i can parse in google apps script, , set of data. find each element following structure:

[  {"not_applicable":false,   "key":"aghxxxxxxxxxxiuxvlc3rpb24ygicagpjchaom",   "given_score":0  },  ... ] 

the key here, can base64decode. see find related question information (the key points entity). shows

char+datastoreid+char+kind+?i expect key here?

exept, how can last part? base64 decoder gives stange characters last part, suspect there id number in there.

i using google apps script. can id encoded string? cannot post whole string, last part of byte array [-128, -128, -128, -8, -62, -124, 10, 12] , suspect represents id.

any ideas or experience?

the urlsafe keys (specific python client library) base64 encoded version of internal protobuf v1 representation of entity key. not designed decoded externally.

i don't think apps script has easy way consume protobuf messages, theoretically implement looking @ ndb implementation combined understanding of how protocol buffers encodes data.


Comments