【问题标题】:Rename Column Name in Athena AWS在 Athena AWS 中重命名列名
【发布时间】:2021-07-21 12:05:17
【问题描述】:

我尝试了几种方法来重命名 athena 表中的某些列名。

看完下面的文章

https://docs.aws.amazon.com/athena/latest/ug/alter-table-replace-columns.html

但我运气不好。

我试过了

ALTER TABLE "users_data"."values_portions" REPLACE COLUMNS ('username/teradata' 'String', 'username_teradata' 'String') 

遇到错误

no viable alternative at input 'alter table "users_data"."values_portions" replace' (service: amazonathena; status code: 400; error code: invalidrequestexception; request id: 23232ssdds.....; proxy: null)

【问题讨论】:

    标签: amazon-web-services hive amazon-athena


    【解决方案1】:

    您可以参考this 文档,其中讨论了重命名列。您尝试运行的查询将用提供的列列表替换现有表中的所有列。

    重命名列的一种策略是基于相同的基础数据创建一个新表,但使用新的列名。 link 中提到的示例创建了一个名为 orders_parquet_column_renamed 的新 orders_parquet 表。该示例将列 o_totalprice 名称更改为 o_total_price,然后在 Athena 中运行查询。

    另一种更改列名的方法是转到AWS Glue -> Select database -> select table -> edit schema -> double click on column name -> type in new name -> save

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-30
    • 1970-01-01
    • 2022-11-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多