我创建了一个名为test3的简单表
create table if not exists test3(
Studies varchar(300) not null,
Series varchar(500) not null
);
我得到了一些json数据
{
"Studies": [{
"studyinstanceuid": "2.16.840.1.114151",
"studydescription": "Some study",
"studydatetime": "2014-10-03 08:36:00"
}],
"Series": [{
"SeriesKey": "abc",
"SeriesInstanceUid": "xyz",
"studyinstanceuid": "2.16.840.1.114151",
"SeriesDateTime": "2014-10-03 09:05:09"
}, {
"SeriesKey": "efg",
"SeriesInstanceUid": "stw",
"studyinstanceuid": "2.16.840.1.114151",
"SeriesDateTime": "0001-01-01 00:00:00"
}],
"ExamKey": "exam-key",
}
这是我的json_path
{
"jsonpaths": [
"$['Studies']",
"$['Series']"
]
}
json数据和json路径都上传到s3。
我尝试在redshift consule中执行以下复制命令。
copy test3
from 's3://mybucket/redshift_demo/input.json'
credentials 'aws_access_key_id=my_key;aws_secret_access_key=my_access'
json 's3://mybucket/redsift_demo/json_path.json'
我收到以下错误。任何人都可以帮助你坚持一段时间了。
Amazon](500310) Invalid operation: Number of jsonpaths and the number of columns should match. JSONPath size: 1, Number of columns in table or column list: 2
Details:
-----------------------------------------------
error: Number of jsonpaths and the number of columns should match. JSONPath size: 1, Number of columns in table or column list: 2
code: 8001
context:
query: 1125432
location: s3_utility.cpp:670
process: padbmaster [pid=83747]
-----------------------------------------------;
1 statement failed.
执行时间:1.58s
答案 0 :(得分:1)
Redshift的错误令人误解。问题是你的输入文件格式错误:在最后一个JSON条目之后你有一个额外的逗号。
如果您将Copy
更改为"ExamKey": "exam-key",
, "ExamKey": "exam-key"
会成功