Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Athena partition locations

I can view all the partitions on my table using

show partitions my_table

and I can see the location of a partition by using

describe formatted my_table partition (partition_col='value')

but I have a lot of partitions, and don't want to have to parse the output of describe formatted if it can be avoided.

Is there a way to get all partitions and their locations, in a single query?

like image 794
Kirk Broadhurst Avatar asked Jan 28 '23 18:01

Kirk Broadhurst


1 Answers

There's no built in or consistent way to get this information.

Assuming you know your partition column(s), you can get this information with a query like

select distinct partition_col, "$path" from my_table
like image 61
Kirk Broadhurst Avatar answered Feb 22 '23 22:02

Kirk Broadhurst