简体   繁体   中英

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. But I want to create a flattened table, so every json field, even nested ones are in separated columns. 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>

CREATE OR REPLACE VIEW staff_info AS
SELECT info.name as name, info.id as id
FROM staff;

SELECT * FROM staff_info limit 10

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM