1

I am trying to turn the values in a column into separate columns with the value coming from another column, similar to this post, except dynamically. In other words, I'm trying to turn a table form long to wide format, similar to the functionality of spread in r or pivot in python.

Is there a way to pivot a table in athena dynamically -- without having to hard code the columns to pull?

alexb523
  • 718
  • 2
  • 9
  • 26
  • Does this answer your question? [AWS Athena (Presto) how to transpose map to columns](https://stackoverflow.com/questions/62717002/aws-athena-presto-how-to-transpose-map-to-columns) – Theo Jul 23 '20 at 08:16

1 Answers1

2

No, there is no way to write a query that results in different number of columns depending on the data. The columns must be known before query execution starts.

Theo
  • 131,503
  • 21
  • 160
  • 205