How to partition a datetime column when creating Athena table

3.8k Views Asked by At

I have some log files in S3 with the following csv format (sample data in parenthesis):

userid (15678),
datetime (2017-09-14T00:21:10),
tag1 (some random text),
tag2 (some random text)

I want to load into Athena tables and partition the data based on datetime in a day/month/year format. Is there a way to split the datetime on table creation or do I need to run some job before to separate the columns and then import?

1

There are 1 best solutions below

0
On BEST ANSWER

Athena supports only External tables of Hive. In external tables to partition the data you data must be in different folders.

There are two ways in which you can do that. Both are mentioned here.