Using filename in Athena queries

AWS Athena ([https://prestodb.io/](Presto DB) underneath) can be used as a good ETL tool, as long as the data is structured enough. Sometimes, it may also be that the filename where the data resides is also important piece of information that should go into transformation.

It turns out, since this is PrestoDB, it is possible1 to use $path as a pseudo column.

SELECT "$path" AS filename FROM table;

This has since been added to AWS knowledge base too2.



Recent articles