Amazon Redshift 自 2025 年 11 月 1 日起不再支援建立新的 Python UDF。如果您想要使用 Python UDF,請在該日期之前建立 UDF。現有 Python UDF 將繼續正常運作。如需詳細資訊,請參閱部落格文章
使用 JSON_PARSE 將資料插入 SUPER 欄
您可以使用 JSON_PARSE 函數 將 JSON 資料插入或更新到 SUPER 欄中。該函數剖析 JSON 格式的資料,並將其轉換為 SUPER 資料類型,您可以在 INSERT 或 UPDATE 陳述式中使用。
下列範例將 JSON 資料插入到 SUPER 欄。如果查詢中缺少 JSON_PARSE 函式,Amazon Redshift 會將該值視為單一字串,而不是必須剖析的 JSON 格式字串。
--Drop the table if it exists. DROP TABLE IF EXISTS test_json; --Create the table. CREATE TABLE test_json (all_data SUPER); --Populate the table. INSERT INTO test_json VALUES (JSON_PARSE(' { "name": { "first_name": "Jake", "last_name": "Smith" }, "age": 30, "hobby": "Biking" }' ) ); SELECT * FROM test_json; all_data --------- {"name":{"first_name":"Jake","last_name":"Smith"},"age":30,"hobby":"Biking"}