I have a table in Postgres that I want to pivot from wide to long on 2 columns.
The data source is too large to be able to use Python as this would require loading to memory. Is there a function in Postgres that is able to do this?
Below is what the table looks like...
date a1_on_time a1_days b2_on_time b2_days
15-Apr-19 TRUE 1 TRUE 1
26-Apr-19 TRUE 2 FALSE 6
The output should look like this:
date metric on_time days
15-Apr-19 a1 TRUE 1
26-Apr-19 a1 TRUE 2
15-Apr-19 b2 TRUE 1
26-Apr-19 b2 FALSE 6
Any ideas would be much appreciated.