snowflake-cloud-data-platform - 如何将 .jsonl 加载到雪花表变体中?
问题描述
如何将 .jsonl 作为雪花的 json 加载到表变体中
create or replace table sampleColors (v variant);
insert into
sampleColors
select
parse_json(column1) as v
from
values
( '{r:255,g:12,b:0} {r:0,g:255,b:0} {r:0,g:0,b:255}')
v;
select * from sampleColors;
Error parsing JSON: more than one document in the input
解决方案
如果您希望每个 RGB 值在其自己的行中,则需要使用如下表函数将 JSONL 拆分为每个 JSON 一行的表:
insert into
sampleColors
select parse_json(VALUE)
from table(split_to_table( '{r:255,g:12,b:0} {r:0,g:255,b:0} {r:0,g:0,b:255} {c:0,m:1,y:1,k:0} {c:1,m:0,y:1,k:0} {c:1,m:1,y:0,k:0}', ' '));
推荐阅读
- angular - 在科尔多瓦中使用 facebook 连接插件后,Angular 应用程序中断
- python - 插入排序的实现不正确,还是对时间复杂度的理解不正确?
- ruby-on-rails - 两个命名空间模型上的 ActiveRecord::StatementInvalid
- matlab - 如何在 MATLAB 中正确使用 ode45 函数用于差动驱动机器人?
- python - Python 2to3 不会改变 #!/usr/bin/python
- vba - VBA 向下列检查字符串值?
- javascript - Safari webkitAudioContext.createBuffer API 引发 NotSupportedError 异常
- java - 有没有办法在不显示任何内容(GUI、进度条、...)的情况下运行 -.jar 文件(使用 javaFx 创建)?
- google-plus - Google tokeninfo 正在返回已弃用的 Google Plus 范围,即使在提供新范围时也是如此。该怎么办?
- angular - Angular Material 表数据源不显示数据