Hus*_*hin 4 sql amazon-s3 amazon-web-services amazon-s3-select
我正在尝试使用 aws 查询 JSON 对象s3-select。我的 JSON 数组结构是这样的:
[
{
"title": "s3",
"url": "https://...",
"time": "2019-07-02",
"summary": "by using s3 select..."
},
{
"title": "athena",
"url": "https://...",
"time": "2019-07-01",
"summary": "by using athena..."
},
{
"title": "mysql",
"url": "https://...",
"time": "2019-06-30",
"summary": "by using mysql..."
}
]
Run Code Online (Sandbox Code Playgroud)
数组内的所有对象都具有相同的属性。现在我想执行一个查询以返回标题等于mysql或的所有对象athena。
我在 aws 控制台中尝试了很多不同的脚本,但没有一个起作用。它返回一个空数组/对象或给出错误。例如:
select * from s3object s where s[*].title = 'athena' //NOT WORKING.
select * from S3Object[*] s where s.title = 'athena' //NOT WORKING.
Run Code Online (Sandbox Code Playgroud)
我的 JSON 数组结构是否错误(因为我的对象没有键名称)?我怎样才能实现这个目标?
小智 15
您应该选择根级别的阵列。所以首先[*]对应的是root。接下来是[*]根中的顶级数组。
尝试下面的查询,它会起作用:
select * from S3Object[*][*] s where s.title = 'athena'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4296 次 |
| 最近记录: |