将 JSON 数据插入 VARIANT 列时出现无效表达式错误

Got invalid expression error , while inserting JSON data into VARIANT column

正在尝试将 多行 行插入雪花 table

insert into sample_table  (a, b, c) values ('foo','bar',parse_json($${"def": 1}$$)),('doo','bam',parse_json($${"def": 1}$$));

已尝试用单引号替换“$$”

获取错误:

SQL compilation error: Invalid expression [PARSE_JSON('{"def":1}')] in VALUES clause

我做错了什么?

您不能在值部分使用 PARSE_JSON。但是你可以做一个

create table sample_table(a text, b text, c variant);
insert into sample_table 
  select column1, column2, parse_json(column3) from values
    ('foo', 'bar', '{"def": 1}'),
    ('doo', 'bam', '{"def": 1}');
number of rows inserted
2