我正在使用批量加载器将数据上传到我的App Engine数据存储中。将字典导入App Engine ndb.JsonProperty with bulkloader
我似乎无法储存字典成JsonProperty,我收到以下错误:
BadValueError: Unsupported type for property nearby_countries: <type 'dict'>
我的模型定义了这个属性作为JsonProperty:
nearby_countries = ndb.JsonProperty()
唯一的解决方法我发现似乎存储我的值的json.dumps(),但我猜这基本上存储字典的字符串表示而不是字典本身。
我对JsonProperty的理解是,它需要一个python对象作为值,我不应该对ndb将处理的JSON序列化感到困扰。我对么?
Value is a Python object (such as a list or a dict or a string) that is serializable using Python's json module; the Datastore stores the JSON serialization as a blob.
它可以接受你自己的答案,你知道的! – 2013-03-01 16:40:47