[英]Is it possible to create flat table from nested json object in AWS Athena?
I know, it's possible to create <struct>
from nested JSON, and then query it with SELECT to access nested fields.我知道,可以从嵌套的 JSON 创建<struct>
,然后使用 SELECT 查询它以访问嵌套字段。 But I want to create a flattened table, so every json field, even nested ones are in separated columns.但我想创建一个扁平表,所以每个 json 字段,甚至嵌套的字段都在单独的列中。 Can't find proof that it's possible.找不到证据证明这是可能的。
Glue Tables are representation of underlying data structure and I believe, the table structure has to represent exactly how it is stored.胶水表是底层数据结构的表示,我相信,表结构必须准确地表示它是如何存储的。
However, we can easily create a view and use it但是,我们可以轻松地创建一个视图并使用它
lets say table staff
has a struct info
as struct<name:string,staffid:string,email:string>
假设表staff
的结构info
为struct<name:string,staffid:string,email:string>
CREATE OR REPLACE VIEW staff_info AS
SELECT info.name as name, info.id as id
FROM staff;
SELECT * FROM staff_info limit 10
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.