Unpack data values that are dictionaries.
Example 1

Example Input 1
dim_A | dim_B | metric_1 | structure_1 |
AAA | DDD | 111 | [3, 4, 5, 6] |
BBB | EEE | 222 | ([1, 2, 3], [3, 2, 1]) |
CCC | FFF | 333 | {'jack': 4098, 'sape': 4139} |
Example Output 1
dim_A | dim_B | metric_1 | structure_1 | jack | sape |
AAA | DDD | 111 | [3, 4, 5, 6] | missing | missing |
BBB | EEE | 222 | ([1, 2, 3], [3, 2, 1]) |
missing | missing |
CCC | FFF | 333 | {'jack': 4098, 'sape': 4139} | 4098 | 4139 |
Example 2

Example Input 2
dim_A | dim_B | metric_1 | structure_1 |
AAA | DDD | 111 | {‘key_1’: ‘aaa’, ‘key_2’:’BBB’} |
BBB | EEE | 222 | ([1, 2, 3], [3, 2, 1]) |
CCC | FFF | 333 | {'jack': 4098, 'sape': 4139} |
Example Output 2
dim_A | dim_B | metric_1 | structure_1 | key_1 | key_2 |
AAA | DDD | 111 | {‘key_1’: ‘aaa’, ‘key_2’:’BBB’} | aaa | BBB |
BBB | EEE | 222 | ([1, 2, 3], [3, 2, 1]) |
missing | missing |
CCC | FFF | 333 | {'jack': 4098, 'sape': 4139} | missing | missing |
I Ain't Afraid of No Code!
Example 1[
[
"unpackdict",
{
"field": "structure_1",
"include_original": true,
"samplesize": 50000,
"keys": [],
"subtable": null,
"_comment": null
}
]
]
Example 2
[
[
"unpackdict",
{
"field": "structure_1",
"include_original": true,
"samplesize": 50000,
"keys": [
"key_1",
"key_2"
],
"subtable": null,
"missing": "missing",
"_comment": null
}
]
]
param str field: Name of field containing a dictionary.
param boolean include_original: Retain source field.
param int samplesize: Number of rows used to find keys if no keys are defined.
param list keys: Keys whose values shall be extracted from source_field. By default keys will be searched for automatically.
param str missing: Values for missing fields.
param str comment: A comment that will appear in the Transformation UI.
Comments
0 comments
Article is closed for comments.