dbt related question:
Anyone have an idea on creating a pivot chart using a second column as the value for the first in dbt? Tried dbt.utils.pivot but not finding any evidence that the macro supports this function and will return anything other than boolean or aggregates.
Thought of creating my own macro that queries the second column data but stuck on how to use a case statement to pivot, rename, and set the data type (needs to be varchar).
In layman’s terms -
I have columns: redcord_id, field_names, field_values, export_date and need to pivot so the the values in the column field_names will be the columns on the new table along with record_id, and export_date, and each value from field_names will be filled with data from field_values.
There are more than 20 values for field_names so avoiding cast and trying for a more dynamic approach that follows the get_column_values pattern.