I have a few dbt models where I need to replace a string value of one column with the result from another query. i.e. a renamed object, the old source still has the old name, but we want to replace the name outputted in the model with the current name. The subquery requires a recursive CTE. This is on Snowflake. Some of the models are only views, so we’re not persisting data in a table (thus post hooks to update values after the model is built are not always an option either). Anyone have any ideas on the best way to do that? Can you use cursors to iterate over records in a dbt model?
[quote=“Proton, post:1, topic:5939, full:true”]
I have a few dbt models where I need to replace a string value of one column with the result from another query. i.e. a renamed object, the old source still has the old name, but we want to replace the name outputted in the model with the current name. The subquery requires a recursive CTE. This is on Snowflake. Some of the models are only views, so we’re not persisting data in a table (thus post hooks to update values after the model is built are not always an option either). Anyone have any ideas on the best way to do that? Can you use cursors to iterate over records in a dbt model?
[/quote]. Have been able to slice it