How to add a timestamp column to an existing table in Athena?

Viewed 58

According to Athena docs, I can not add the date column to an existing table, so I am trying to use the workaround they propose with the timestamp datatype.

But when I run the ALTER TABLE my_table ADD COLUMNS (date_column TIMESTAMP) query, I still get the following error :

Parquet does not support date. See HIVE-6384

Is there any option to add date or timestamp columns to an existing table?

Thanks

UPD: I found out that I can still add timestamp columns with glue UI interface/API

UPD 2: The issue occurs only with one specific table, but it works for others.

1 Answers

You can use the following query to add a timestamp column to an existing table:

ALTER TABLE my_table ADD COLUMNS (date_column TIMESTAMP);

This should work for both Parquet and ORC tables.

Related