嗨,我正在尝试用4层嵌套数组来flatten json。扁平化这些数据的最好方法是什么,而不需要扁平化4次?
数据示例,已暂存:
{
"sample": {
"someitem": {
"thesearecool": [
{
"neat": "wow"
},
{
"neat": "tubular"
}
]
}
}
}我认为这适用于第一个展平,但有没有办法再展平它两次,以便每个值都在不同的列中?
select src:sample::string, src:someitem::string, value
from
raw_source
, lateral flatten( input => src:sample )来源:https://community.snowflake.com/s/article/How-To-Lateral-Join-Tutorial
发布于 2020-01-08 22:03:18
是否要列出整型值的值?
with raw_source as (select parse_json('{
"sample": {
"someitem": {
"thesearecool": [
{
"neat": "wow"
},
{
"neat": "tubular"
}
]
}
}
}') c)
select f.value:neat as neat
from
raw_source
, lateral flatten( input => c, path => 'sample.someitem.thesearecool' ) f;在这种情况下,您可以使用path参数。
https://stackoverflow.com/questions/59639085
复制相似问题