App Engine BadValueError On Bulk Data Upload - TextProperty being construed as StringProperty

浪尽此生 提交于 2019-11-27 03:05:30

问题


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 or less. 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?


回答1:


You need to specify an import transform for the text field, like this:

- property: data
  external_name: data
  import_transform: db.Text


来源:https://stackoverflow.com/questions/3434090/app-engine-badvalueerror-on-bulk-data-upload-textproperty-being-construed-as-s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!