I am looking to leverage the variant capabilities in snowflake. I am new to snowflake and can't see from the docs if it supports what I want to do. I want to perform queries on a table where I do aggregations (groupings) across columns that have standard types, (varchar, int ... ...) and values extracted from a variant column. My variant column will have store a collection of objects that look like:
{ "container": [
{
"param1": "value1a",
"param2": "value2a",
"param3": "value3a"
},
{
"param1": "value1b",
"param2": "value2b",
"param3": "value3b"
},
{
"param1": "value1c",
"param2": "value2c",
"param3": "value3c"
}
]
}
In traditional sql schema to show what I am trying to do let's say i had a 1:n relationship where the container was a child on the many with a fk (parent_id) to specify the rel (say to parent). Here is a type of query i am trying to write on the variant column expressed in traditional sql/relational model:
SELECT P.column1, P.column2, C.param1, C.param2
FROM parent P
INNER JOIN Child c ON c.parent_id = p.id
GROUP BY 1, 2, 3