Open mdesmet opened 1 week ago
+1
Getting the same issue when trying to preview compiled SQL via ctrl+enter. Running dbt models and building works as expected, but executing SQL previews gives the no keys attribute error on the NodeInfo object.
Downgrading to v0.39.20 fixes the issue as the previous version doesn't have this problem. FYI @mdesmet
+1
We face a similar issue on >=0.40.
Running with dbt=1.8.2
dbt version: 1.8.2
python version: 3.8.18
Additional info: We use it (sometimes) in combination with the upstream_prod
package, which overrides the ref
macro https://github.com/LewisDavies/upstream-prod
Exception: Compilation Error in sql_operation t_04688e1e7d094694bd6db7270f80272d (from remote system.sql)
'dict object' has no attribute 'nodes'
> in macro find_model_node (macros/upstream_prod/find_model_node.sql)
> called by macro default__ref (../utils/macros/global/ref.sql)
> called by macro ref (../utils/macros/global/ref.sql)
> called by sql_operation t_04688e1e7d094694bd6db7270f80272d (from remote system.sql)
Downgrading to v0.39.20 fixes the issue.
@davidwitk @EFox2413 Can you please upgrade to version 0.40.2 and let us know if the issue has been fixed? Also, we no longer support version < 1.6, so please consider updating your dbt version.
@anandgupta42 I tried 0.40.2 and 0.40.3, but still the same error
Same issue here !
@anandgupta42 version 0.40.3 fix preview query execution (Ctrl + Enter)... but Compiled dbt Preview (Ctrl + ~) stills broken.
Downgrade to 0.39.20 fixes both.
@davidwitk : Can you provide the full stack trace?
@mdesmet Here you go, on 0.40.3:
Traceback (most recent call last):
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/dbt_common/clients/jinja.py", line 326, in exception_handler
yield
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/dbt_common/clients/jinja.py", line 298, in call_macro
return macro(*args, **kwargs)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/jinja2/runtime.py", line 768, in __call__
return self._invoke(arguments, autoescape)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/jinja2/runtime.py", line 782, in _invoke
rv = self._func(*arguments)
File "<template>", line 51, in macro
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/jinja2/sandbox.py", line 327, in getattr
value = getattr(obj, attribute)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/jinja2/runtime.py", line 864, in __getattr__
return self._fail_with_undefined_error()
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/jinja2/runtime.py", line 857, in _fail_with_undefined_error
raise self._undefined_exception(self._undefined_message)
jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'nodes'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/davidwitkowski/.vscode/extensions/innoverio.vscode-dbt-power-user-0.40.3/dist/dbt_core_integration.py", line 713, in _compile_node
compiled_node = self.sql_compiler.compile(self.dbt)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/dbt/task/sql.py", line 44, in compile
return self.compiler.compile_node(self.node, manifest, {}, write=False)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/dbt/compilation.py", line 533, in compile_node
node = self._compile_code(node, manifest, extra_context)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/dbt/compilation.py", line 421, in _compile_code
node.compiled_code = jinja.get_rendered(
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/dbt/clients/jinja.py", line 146, in get_rendered
rendered = render_template(template, ctx, node)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/dbt_common/clients/jinja.py", line 539, in render_template
return template.render(ctx)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/dbt_common/clients/jinja.py", line 144, in render
return self.environment.handle_exception()
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/jinja2/environment.py", line 939, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 19, in top-level template code
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/jinja2/sandbox.py", line 394, in call
return __context.call(__obj, *args, **kwargs)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/dbt/clients/jinja.py", line 84, in __call__
return self.call_macro(*args, **kwargs)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/dbt_common/clients/jinja.py", line 298, in call_macro
return macro(*args, **kwargs)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/jinja2/runtime.py", line 782, in _invoke
rv = self._func(*arguments)
File "<template>", line 12, in template
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/jinja2/sandbox.py", line 394, in call
return __context.call(__obj, *args, **kwargs)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/dbt/clients/jinja.py", line 84, in __call__
return self.call_macro(*args, **kwargs)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/dbt_common/clients/jinja.py", line 298, in call_macro
return macro(*args, **kwargs)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/jinja2/runtime.py", line 782, in _invoke
rv = self._func(*arguments)
File "<template>", line 30, in template
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/jinja2/sandbox.py", line 394, in call
return __context.call(__obj, *args, **kwargs)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/dbt/clients/jinja.py", line 84, in __call__
return self.call_macro(*args, **kwargs)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/dbt_common/clients/jinja.py", line 298, in call_macro
return macro(*args, **kwargs)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/jinja2/runtime.py", line 782, in _invoke
rv = self._func(*arguments)
File "<template>", line 2, in template
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/jinja2/sandbox.py", line 394, in call
return __context.call(__obj, *args, **kwargs)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/dbt/clients/jinja.py", line 84, in __call__
return self.call_macro(*args, **kwargs)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/dbt_common/clients/jinja.py", line 300, in call_macro
return e.value
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/lib/python3.8/contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "/Users/davidwitkowski/.pyenv/versions/3.8.18/envs/dbt-bbc/lib/python3.8/site-packages/dbt_common/clients/jinja.py", line 328, in exception_handler
raise CaughtMacroErrorWithNodeError(exc=e, node=self.macro)
dbt_common.exceptions.macros.CaughtMacroErrorWithNodeError: Compilation Error in sql_operation t_7e835b69b0844abe872beb17ada1bda3 (from remote system.sql)
'dict object' has no attribute 'nodes'
> in macro find_model_node (macros/upstream_prod/find_model_node.sql)
> called by macro default__ref (../utils/macros/global/ref.sql)
> called by macro ref (../utils/macros/global/ref.sql)
> called by sql_operation t_7e835b69b0844abe872beb17ada1bda3 (from remote system.sql)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/davidwitkowski/.vscode/extensions/innoverio.vscode-dbt-power-user-0.40.3/dist/dbt_core_integration.py", line 693, in _compile_sql
node = self._compile_node(server_node)
File "/Users/davidwitkowski/.vscode/extensions/innoverio.vscode-dbt-power-user-0.40.3/dist/dbt_core_integration.py", line 720, in _compile_node
raise Exception(str(e))
Exception: Compilation Error in sql_operation t_7e835b69b0844abe872beb17ada1bda3 (from remote system.sql)
'dict object' has no attribute 'nodes'
> in macro find_model_node (macros/upstream_prod/find_model_node.sql)
> called by macro default__ref (../utils/macros/global/ref.sql)
> called by macro ref (../utils/macros/global/ref.sql)
> called by sql_operation t_7e835b69b0844abe872beb17ada1bda3 (from remote system.sql)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/davidwitkowski/.vscode/extensions/innoverio.vscode-dbt-power-user-0.40.3/dist/dbt_core_integration.py", line 675, in compile_sql
return self._compile_sql(raw_sql, original_node)
File "/Users/davidwitkowski/.vscode/extensions/innoverio.vscode-dbt-power-user-0.40.3/dist/dbt_core_integration.py", line 697, in _compile_sql
raise Exception(str(e))
Exception: Compilation Error in sql_operation t_7e835b69b0844abe872beb17ada1bda3 (from remote system.sql)
'dict object' has no attribute 'nodes'
> in macro find_model_node (macros/upstream_prod/find_model_node.sql)
> called by macro default__ref (../utils/macros/global/ref.sql)
> called by macro ref (../utils/macros/global/ref.sql)
> called by sql_operation t_7e835b69b0844abe872beb17ada1bda3 (from remote system.sql)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/davidwitkowski/.vscode/extensions/innoverio.vscode-dbt-power-user-0.40.3/dist/node_python_bridge.py", line 104, in <module>
value = eval(_compile(data['code'], '<input>', 'eval'), _locals)
File "<input>", line 1, in <module>
File "/Users/davidwitkowski/.vscode/extensions/innoverio.vscode-dbt-power-user-0.40.3/dist/dbt_core_integration.py", line 677, in compile_sql
raise Exception(str(e))
Exception: Compilation Error in sql_operation t_7e835b69b0844abe872beb17ada1bda3 (from remote system.sql)
'dict object' has no attribute 'nodes'
> in macro find_model_node (macros/upstream_prod/find_model_node.sql)
> called by macro default__ref (../utils/macros/global/ref.sql)
> called by macro ref (../utils/macros/global/ref.sql)
> called by sql_operation t_7e835b69b0844abe872beb17ada1bda3 (from remote system.sql)
Discussed in https://github.com/AltimateAI/vscode-dbt-power-user/discussions/1225