Closed gnilrets closed 3 years ago
Haven't heard back from PR comments, closing PR.
@MartinGuindon - What PR comments? Did I fail to respond to something?
Hmmm.... I'm not seeing any comments when I click that link:
Mmm that's really odd, but might explain why you never answered.. lol.
here's what I had written:
@gnilrets Thank you for your contribution!
Is there a reason why you went with generating the SQL queries in warehouse using a case when and concats, rather than simply retrieving the list of tables/views as a dict and creating those queries directly in your for loop in Jinja?
Not particularly, that's just how this started before it was all wrapped up into a macro, and my SQL is better than my jinja
In our dbt implementation, we have two production databases: PROD_RAW and PROD_WH. PROD_RAW houses all of the raw source data and PROD_WH is where dbt builds models. These production database are owned by a PROD_TRANSFORMER role. dbt developers use the DEVELOPER role. When we try using the simple
create database dev_wh clone prod_wh
as a DEVELOPER, all of the tables are still owned by the PROD_TRANSFORMER role and thus the developer cannot run dbt in the DEV_WH database.In order to overcome this limitation, I've modified the
clone_schema
macro to clone each table/view individually, which ends up creating tables owned by the DEVELOPER role.