z3z1ma / dbt-osmosis

Provides automated YAML management, a dbt server, streamlit workbench, and git-integrated dbt model output diff tools
https://z3z1ma.github.io/dbt-osmosis/
Apache License 2.0
422 stars 46 forks source link

Fix: set ENV VARS as invocation context for dbt >= 1.8 #165

Closed illia-yurtsiv-proxet closed 1 week ago

illia-yurtsiv-proxet commented 1 week ago

Rationale:

dbt_core v1.8.0 introduces dependency on dbt_common package which wasn't the thing prior to 1.8.x. In dbt_common, they introduce InvocationContext class. It's used in cli's preflight decorator that sets the context before any actual CLI operation:

Then it's used in dbt_core's SecretContext which is necessary if you use something like: CleanShot 2024-06-17 at 20 28 54@2x

Changes:

This PR tries to import set_invocation_context and get_env from dbt_common and then set ENV VARs before actual profile rendering in Jinja.

illia-yurtsiv-proxet commented 1 week ago

@z3z1ma please, pay attention, that this PR is required to support DBT 1.8