将Array标签从.JSON文件加载到雪花中

时间:2020-02-26 01:44:09

标签: snowflake-cloud-data-platform

我有一个要加载到雪花中的json文件。文件中的键之一的值是一个数组。问题是如何将这个标签加载到雪花中ARRAY类型的单独列中?它已经是json中的数组。我仍然需要使用 array_construct(tag_name_here)函数进行加载吗?如果在随后的记录中,“ industry”标签完全丢失,会发生什么情况?请告知。

下面是json的示例...

  [
   [
    {
      "title": "Avino Silver & Gold Mines Ltd. Fourth Quarter and Year End Results to be Released on....",
      "pubDate": "Tue, 25 Feb 2020 00:49:00 +0000",
      "description": " Avino Silver & Gold Mines Ltd. plans to announce its Fourth Quarter and Year End 2019 financial results after the market closes. In addition, the Company...",
      "industry": [
                    "Mining & Metals ",
                    "Mining ",
                    "MNG",
                    "MIN"
                ],
       "subject": [
                    "Conference Call Announcements ",
                    "Earnings "
                ]
     }
    ]
   ]

1 个答案:

答案 0 :(得分:0)

在这里看看示例: https://docs.snowflake.net/manuals/user-guide/querying-semistructured.html

通常,您是在考虑提取数据而不是构造数据(只需使用value:industry来填充数组列)。而且,如果某些记录中缺少适当的标记,它将只填充NULL。