开发者

AppEngine Bulk Upload List Property

I have a model with a list property.

I have a csv that has each list data that looks like this.

[u'1234567']

The list has only one item each.

My bulkloader.yaml has confi开发者_开发技巧gured import_transform: transform.none_if_empty(list). It uploads the above list property as [u'[', u'u', u"'", u'1', u'2', u'3', u'4', u'5', u'6', u'7', u"'", u']']

How should I configure the import_transform in order to upload it properly?

Thanks!


Try something like this:

import_transform: lambda x: [x] if x else None


You can use json, it work for me. Like this:

import_transform: transform.none_if_empty(json.loads)
export_transform: transform.none_if_empty(json.dumps)

Remember to import json in python_preamble block.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜