【发布时间】:2019-05-17 12:26:15
【问题描述】:
我有以下 JSON 数据。
{
"recordid":"69",
"recordTimestamp":1558087302591,
"spaceId":"space-cd88557d",
"spaceName":"Kirtipur",
"partnerId":"Kirtipur",
"eventType":"event-location-update",
"eventlocationupdate":{
"event":{
"eventid":"event-qcTUrDAThkbPsXi438rRk",
"userId":"",
"tags":[
],
"mobile":"",
"email":"",
"gender":"OTHER",
"firstName":"",
"lastName":"",
"postalCode":"",
"optIns":[
],
"otherFields":[
],
"macAddress":"55:56:81????????a4:6d"
},
"location":{
"locationId":"location-bdfsfsf6a8d96",
"name":"Kirtipur Office - wireless",
"inferredLocationTypes":[
"NETWORK"
],
"parent":{
"locationId":"location-c39ffc49",
"name":"Kirtipur",
"inferredLocationTypes":[
"vianet"
],
"parent":{
"locationId":"location-8b47asdfdsf1c6a",
"name":"Kirtipur",
"inferredLocationTypes":[
"ROOT"
]
}
}
},
"ssid":"",
"rawUserId":"",
"visitId":"visit-ca04ds5secb8d",
"lastSeen":1558087081000,
"deviceClassification":"",
"mapId":"",
"xPos":1.8595887,
"yPos":3.5580606,
"confidenceFactor":0.0,
"latitude":0.0,
"longitude":0.0
}
}
我需要使用复制命令从 s3 存储桶中加载它。我已将此文件上传到我的 S3 存储桶。
我使用过 csv 文件的复制命令,但没有使用过 JSON 文件的复制命令。我研究了通过复制命令导入 json,但没有找到可靠的有用命令示例。
我在复制命令中使用了以下代码。
COPY vianet_raw_data
from 's3://vianet-test/vianet.json'
with credentials as ''
format as json 'auto';
这没有插入任何数据。
谁能帮我处理这种 JSON 的复制命令?
感谢和问候
【问题讨论】:
-
STL_LOAD_ERRORS 表中是否有错误?
-
嘿@JohnRotenstein,没有错误。
-
我会尝试使用 jsonpath 文件映射 json 标签docs.aws.amazon.com/redshift/latest/dg/…
标签: amazon-redshift