Closed jefersonmsantos closed 2 months ago
Thanks for your PR. Could you please address the flake8 issue? Everything else looks good to me!
Thanks for your PR. Could you please address the flake8 issue? Everything else looks good to me!
Addressed.
Fix 405
On new dbt 1.8 version there is error LookupError: <ContextVar name='DBT_INVOCATION_CONTEXT_VAR' at 0x10c4889f0> when using function "Run query" or "Run diff". This happens because class DbtAdapter sets the invocation context with function set_invocation_context({}) when dbt version is 1.8, but on tasks/query.py file the default_context is regenererated before calling function generate_sql from DbtAdapter.
To fix this, added a new call of set_invocation_context({}) on start of function generate_sql if dbt version is greater or equal than 1.8.
PR checklist
What type of PR is this? Bug fix
What this PR does / why we need it: Added a new call of set_invocation_context({}) on start of function generate_sql if dbt version is greater or equal than 1.8 to fix the issue described below.
With the fix,
Run Diff
works fine with dbt version 1.8:Tests:
Which issue(s) this PR fixes: Fix 405 When using new dbt 1.8 version,
Run Diff
feature will throw errorLookupError: <ContextVar name='DBT_INVOCATION_CONTEXT_VAR' at 0x10c4889f0>
This happens because class DbtAdapter sets the invocation context with function set_invocation_context({}) when dbt version is 1.8, but on tasks/query.py file the default_context is regenererated before calling function generate_sql from DbtAdapter.
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
"NONE"