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
425 stars 46 forks source link

Bug: DBT_INVOCATION_CONTEXT_VAR error after upgrading to dbt-osmosis 0.13.2 and dbt-core 1.8.3 #169

Open brandonpeebles opened 1 week ago

brandonpeebles commented 1 week ago

Experiencing a similar issue to the one described in #161. Upon upgrading dbt versions after dbt-osmosis was updated to support dbt 1.8, I'm now getting this error whenever running any dbt-osmosis commands.

dbt-osmosis yaml document models/staging/my_source --use-unrendered-descriptions 
INFO     🌊 Executing dbt-osmosis                                                                                                                                                                                         main.py:551

01:11:00  [WARNING]: Deprecated functionality
The `tests` config has been renamed to `data_tests`. Please see
https://docs.getdbt.com/docs/build/data-tests#new-data_tests-syntax for more
information.
INFO     ...building project structure mapping in memory                                                                                                                                                               osmosis.py:548
INFO     👉 Processing model: model.my_project.my_model                                                                                                                                          osmosis.py:852
INFO     🙇 No valid schema file found for model model.my_project.my_modelosmosis.py:857
INFO     👉 Processing model: source.my_project.my_source.my_table                                                                                                                                              osmosis.py:852
INFO     🔍 Resolving columns in database                                                                                                                                                                              osmosis.py:863
ERROR    Error occurred while processing model source.my_project.my_source.my_table: <ContextVar name='DBT_INVOCATION_CONTEXT_VAR' at 0xffffb99c61b0>                                                           osmosis.py:995

Running Python 3.12.4 and the following dbt packages:

dbt-adapters==1.3.1
dbt-common==1.4.0
dbt-core==1.8.3
dbt-osmosis==0.13.2
dbt-snowflake==1.8.3
brandonpeebles commented 6 days ago

Update: It appears I'm able to circumvent the error by using --catalog-file target/catalog.json, which I guess makes sense given it's not having to invoke dbt in the command execution. The issue still persists under the default operation, however.