ValueError: Key() must have an even number of positional arguments.
When I try:
class MyStorage(ndb.Model):
my_attr = ndb.StringProperty()
my = MyStorage(parent=ndb.Key('mylist'), key_name='myattr', my_attr = 'hello')
What am I doing wrong?
My aim is to store a few MyStorage entities under a parent entity with key ‘mylist’. I don’t want to attach anything to the parent itself, and neither have I instantiated it, but from the docs I didn’t get the impression that was necessary.
How do I persist MyStorage entities the way I describe above correctly?
The
ndb.Key()constructuctor expects pairs ofkindandidvalues, not one string:The pairs can be specified in different ways, or you need to provide a
urlsafeargument (which is a websafe-base64-encoded serialized reference).