Tenho uma tabela no Snowflake que se parece com isso:
+------+------+------+------------------------------------------------------------------+
| Col1 | Col2 | Col3 | Col4 |
+------+------+------+------------------------------------------------------------------+
| 1 | foo | 32 | [{"id":"1", "category":"black"}] |
| 2 | bar | 22 | [{"id":"1", "category":"black"}, {"id":"4", "category":"white"}] |
| 3 | smeg | 2 | null |
+------+------+------+------------------------------------------------------------------+
Gostaria de transformar os dados em outra tabela parecida com esta:
+------+------+------+------+----------+
| Col1 | Col2 | Col3 | id | category |
+------+------+------+------+----------+
| 1 | foo | 32 | 1 | black |
| 2 | bar | 22 | 1 | black |
| 2 | bar | 22 | 4 | white |
| 3 | smeg | 2 | null | null |
+------+------+------+------+----------+
Já fiz isso no SQL Server antes de usar JSON_VALUE
o e OPENJSON
, mas estou com dificuldades para encontrar um equivalente no Snowflake.