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.
精彩评论