How to unnest a variant(array) column in Snowflake into multiple columns
column name: user; table name: event; the column name is a variant format
[
{
"key": "user_id",
"value": {
"set_timestamp_micros": 1621804433449213,
"string_value": "auth0|6094a88b602505006f20fc0e"
}
},
{
"key": "env",
"value": {
"set_timestamp_micros": 1621804433445213,
"string_value": "staging"
}
},
{
"key": "first_open_time",
"value": {
"int_value": 1620248400000,
"set_timestamp_micros": 1620245124142213
}
}
]
My objectives are to transpose like
| user_id | env |
|---|---|
| auth0|6094a88b602505006f20fc0e | staging |
I tried FLATTEN function, but it is not working as I expected.