Hello, I’m trying to build a macro and am stuck on a specific problem.
Is there a dbt macro that allows me to get the columns list from a query set result (e.g. CTE)? I am looking for something similar to this function without the requirement for the input to be a relation. The reason being that I am trying to one-shot a macro and do not want to persist the intermediate steps.
For example, I want to be able to do this:
WITH cte 1 AS (
SELECT * FROM table
)
,cte 2 AS (
SELECT ...
FROM some_table LEFT JOIN cte1 ON
{ for col in cte1}
some_table.{{ col }} = cte1.{{ col }}
{ endfor }