Suppose we have source tabular data in this format
Service,Time,Metric
where time column has duplicate timestamp entries for different service metrics collected at same time. As such over time, there's repeating values under service, time, host, and metric (if it doesn't change much).
How might one transform or transpose the table into this format, normalizing against time. I know time might not match up across all service metrics, but let's naively assume it does.
Time,ServiceAMetric,ServiceBMetric,ServiceCMetric,etc.
where the header field will list the service names, the rest of the rows contain the metric values
Is this something that can be done with SQL? Or one has to transform with scripting? If the latter, how might I do so? Most any scripting language will do for me.
In this particular case, the data is from CSV file and not tables in DB. For transformation, can keep output as a new CSV file.