By default in Athena (probably more generally Presto/Trino) SELECT *
lowercases columns names.
I've found a workaround by explicitly specifying the columns names in the proper case SELECT SomeColumn, SomeOtherColumn, YetAnotherColumn
.
But UNLOAD
is itself lowercasing again, hence the final Parquet has lowercase columns names.
Is there a way to preserve the original casing or specify the columns names manually like with SELECT
?
Probably not. From the docs (https://docs.aws.amazon.com/athena/latest/ug/tables-databases-columns-names.html)
Athena accepts mixed case in DDL and DML queries, but lower cases the names when it executes the query. For this reason, avoid using mixed case for table or column names, and do not rely on casing alone in Athena to distinguish such names.