Reputation: 3651
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 configured 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!
Upvotes: 0
Views: 705
Reputation: 11
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.
Upvotes: 1
Reputation: 101149
Try something like this:
import_transform: lambda x: [x] if x else None
Upvotes: 1