alexb523
alexb523

Reputation: 728

athena - dynamically pivot rows to column

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?

Upvotes: 1

Views: 1193

Answers (1)

Theo
Theo

Reputation: 132872

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.

Upvotes: 2

Related Questions