How to rename AWS Athena columns with parquet file source?

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-28 09:28:59

问题


I have data loaded in my S3 bucket folder as multiple parquet files. After loading them into Athena I can query the data successfully.

What are the ways to rename the Athena table columns for parquet file source and still be able to see the data under renamed column after querying?

Note: checked with edit schema option, column is getting renamed but after querying you will not see data under that column.


回答1:


There is as far as I know no way to create a table with different names for the columns than what they are called in the files. The table can have fewer or extra columns, but only the names that are the same as in the files will be queryable.

You can, however, create a view with other names, for example:

CREATE OR REPLACE VIEW a_view AS
SELECT
  a AS b,
  b AS c
FROM the_table


来源:https://stackoverflow.com/questions/54558973/how-to-rename-aws-athena-columns-with-parquet-file-source

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!