簡體   English   中英

將多個 JSON 文件從舞台加載到雪花中的表

[英]Load multiple JSON files from stage to table in Snowflake

我在內部命名階段中有幾百個文件,我需要將它們移動到雪花表。 處於階段的文件名稱中有一個模式,

file1.json
file2.json
file3.json
...

我正在嘗試創建一個查詢,該查詢將一次加載目標表中的所有文件,因為我們可以在 snowSQL 中使用帶有 * 的 PUT 命令。 我正在嘗試將以下副本運行到查詢中,但結果顯示為

復制執行,處理了 0 個文件。

我正在嘗試的查詢是

copy into test_table (file_name, load_date, data) from (
    select
        metadata$filename,
        current_timestamp,
        f.$1
    from @stagename/file*.json f
)
    file_format = (
        type = json
            strip_outer_array = true
        )
    force=true ;

對此有何建議? 謝謝

您沒有正確使用該模式,它需要是這樣的:

select metadata$filename, current_timestamp, f.$1 from @stagename (file_format => 'myformat', pattern=>'file.*[.]json') f;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM