lightdash / dbt2looker

Generate lookml for views from dbt models
https://lightdash.com
MIT License
177 stars 46 forks source link

Different target environments - workaround #13

Open sisu-callum opened 3 years ago

sisu-callum commented 3 years ago

When trying to figure out how I'd create the LookML files for production environments as opposed to development, I realized that this process is built off the artifacts. So all you need to do is overwrite the artifacts with the correct information and then re-run. This workaround is dbt docs generate --target production and then run dbt2looker. It creates the LookML that references the right DB's and Schema's.

This still introduces issues when creating new models that are not materialized in the production environment. I wonder if there is a better way to parse through the manifest and then replace the schema and database references. The issue is that these are generated at runtime in dbt. So not sure how to best handle this one.

owlas commented 3 years ago

Hey @sisu-callum - this is a great idea! I hadn't thought about it. The reason we need the materialised views is to get all the column types (we can substitute the database and table in prod no problem).

But actually when pushing to production, we should already have locked in these types when materialising the dev tables.

I'm thinking either:

Not sure what that second option would look like yet