本文介绍了App Engine BadValueError在批量数据上传 - TextProperty被解释为StringProperty的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
bulkoader.yaml: 变形金刚:
- kind:ExampleModel
连接符:csv
property_map:
- property:__key__
external_name:key
export_transform:transform.key_id_or_name_as_string
- property:data
external_name:data
- property:键入
external_name:键入
model.py:
class ExampleModel(db.Model):
data = db.TextProperty(required = True)
type = db.StringProperty(required = True )
一切看起来都很好,但是当我上传时,我得到这个错误:
BadValueError:属性数据长度为24788字节;它必须少于500美元或
。考虑使用文本,它可以存储任意长度的字符串。
出于某种原因,它认为数据是一个字符串属性。
任何一个人都知道我可以如何解决这个问题?
解决方案
您需要指定如下所示:
- property:data
external_name:data
import_transform :db.Text
bulkoader.yaml:
transformers:
- kind: ExampleModel
connector: csv
property_map:
- property: __key__
external_name: key
export_transform: transform.key_id_or_name_as_string
- property: data
external_name: data
- property: type
external_name: type
model.py:
class ExampleModel(db.Model):
data = db.TextProperty(required=True)
type = db.StringProperty(required=True)
Everything seems to be fine, yet when I upload I get this error:BadValueError: Property data is 24788 bytes long; it must be 500 orless. Consider Text instead, which can store strings of any length.
For some reason, it thinks data is a string property.
Any one know how I can fix this?
解决方案
You need to specify an import transform for the text field, like this:
- property: data
external_name: data
import_transform: db.Text
这篇关于App Engine BadValueError在批量数据上传 - TextProperty被解释为StringProperty的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!