You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
While testing #738 in 1.5rc2, we managed to crash dbt when adding YML config to a struct, both at the parent and subfield levels at the same time.
The goal was to try:
providing constraints at the struct level in addition to the field level (e.g. the struct itself should be not null in addition to some of the subfields being not null
adding description at the struct level in addition to the subfield level
(the following was tried with and without data_type at the parent level but both failed, with different errors though. in an ideal situation, we wouldn't have to set the data_type at the parent level but still be allowed to add constraint and documentation)
- name: my_structdescription: | My overall descriptiondata_type: | struct< field_1 string, field_2 numeric>
- name: my_struct.field_1data_type: stringdescription: Desc for field_1
- name: my_struct.field_2data_type: numericdescription: Desc for field_2
We were expecting this to either work or get a config error from dbt but instead dbt crashes. The code dump is listed below.
Expected Behavior
I would expect this config not to crash but instead to:
ideally work, allowing config at both levels, parent and subfield
or at least raise an error telling me what that having config at both levels is not allowed
Steps To Reproduce
use a struct in a model
configure the struct in YML with constraints and descriptions
a. at the subfield level
b. at the struct (e.g. parent level)
Relevant log output
2023-06-20 13:39:06.733916 (Thread-34): �[0m13:39:06 Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/dbt/task/base.py", line 391, in safe_run
result = self.compile_and_execute(manifest, ctx)
File "/usr/local/lib/python3.8/dist-packages/dbt/task/base.py", line 340, in compile_and_execute
result = self.run(ctx.node, manifest)
File "/usr/local/lib/python3.8/dist-packages/dbt/task/base.py", line 439, in run
return self.execute(compiled_node, manifest)
File "/usr/local/lib/python3.8/dist-packages/dbt/task/run.py", line 291, in execute
result = MacroGenerator(
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 330, in __call__
return self.call_macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 257, in call_macro
return macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 763, in __call__
return self._invoke(arguments, autoescape)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 777, in _invoke
rv = self._func(*arguments)
File "<template>", line 108, in macro
File "/usr/local/lib/python3.8/dist-packages/jinja2/sandbox.py", line 393, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 298, in call
return __obj(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 330, in __call__
return self.call_macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 257, in call_macro
return macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 763, in __call__
return self._invoke(arguments, autoescape)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 777, in _invoke
rv = self._func(*arguments)
File "<template>", line 42, in macro
File "/usr/local/lib/python3.8/dist-packages/jinja2/sandbox.py", line 393, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 298, in call
return __obj(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 763, in __call__
return self._invoke(arguments, autoescape)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 777, in _invoke
rv = self._func(*arguments)
File "<template>", line 104, in macro
File "/usr/local/lib/python3.8/dist-packages/jinja2/sandbox.py", line 393, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 298, in call
return __obj(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 330, in __call__
return self.call_macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 257, in call_macro
return macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 763, in __call__
return self._invoke(arguments, autoescape)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 777, in _invoke
rv = self._func(*arguments)
File "<template>", line 58, in macro
File "/usr/local/lib/python3.8/dist-packages/jinja2/sandbox.py", line 393, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 298, in call
return __obj(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 330, in __call__
return self.call_macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 257, in call_macro
return macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 763, in __call__
return self._invoke(arguments, autoescape)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 777, in _invoke
rv = self._func(*arguments)
File "<template>", line 31, in macro
File "/usr/local/lib/python3.8/dist-packages/jinja2/sandbox.py", line 393, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 298, in call
return __obj(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 330, in __call__
return self.call_macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 257, in call_macro
return macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 763, in __call__
return self._invoke(arguments, autoescape)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 777, in _invoke
rv = self._func(*arguments)
File "<template>", line 62, in macro
File "/usr/local/lib/python3.8/dist-packages/jinja2/sandbox.py", line 393, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 298, in call
return __obj(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 330, in __call__
return self.call_macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 257, in call_macro
return macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 763, in __call__
return self._invoke(arguments, autoescape)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 777, in _invoke
rv = self._func(*arguments)
File "<template>", line 19, in macro
File "/usr/local/lib/python3.8/dist-packages/jinja2/sandbox.py", line 393, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 298, in call
return __obj(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 330, in __call__
return self.call_macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 257, in call_macro
return macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 763, in __call__
return self._invoke(arguments, autoescape)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 777, in _invoke
rv = self._func(*arguments)
File "<template>", line 20, in macro
File "/usr/local/lib/python3.8/dist-packages/jinja2/sandbox.py", line 393, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 298, in call
return __obj(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 330, in __call__
return self.call_macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 257, in call_macro
return macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 763, in __call__
return self._invoke(arguments, autoescape)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 777, in _invoke
rv = self._func(*arguments)
File "<template>", line 31, in macro
File "/usr/local/lib/python3.8/dist-packages/jinja2/sandbox.py", line 393, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 298, in call
return __obj(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 330, in __call__
return self.call_macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 257, in call_macro
return macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 763, in __call__
return self._invoke(arguments, autoescape)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 777, in _invoke
rv = self._func(*arguments)
File "<template>", line 20, in macro
File "/usr/local/lib/python3.8/dist-packages/jinja2/sandbox.py", line 393, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 298, in call
return __obj(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 330, in __call__
return self.call_macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/clients/jinja.py", line 257, in call_macro
return macro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 763, in __call__
return self._invoke(arguments, autoescape)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 777, in _invoke
rv = self._func(*arguments)
File "<template>", line 20, in macro
File "/usr/local/lib/python3.8/dist-packages/jinja2/sandbox.py", line 393, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 298, in call
return __obj(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dbt/adapters/bigquery/impl.py", line 280, in nest_column_data_types
return get_nested_column_data_types(columns, constraints)
File "/usr/local/lib/python3.8/dist-packages/dbt/adapters/bigquery/column.py", line 164, in get_nested_column_data_types
_update_nested_column_data_types(
File "/usr/local/lib/python3.8/dist-packages/dbt/adapters/bigquery/column.py", line 231, in _update_nested_column_data_types
assert isinstance(remaining_column_data_types, dict) # keeping mypy happy
AssertionError
Environment
- dbt-core: 1.5rc2
Additional Context
No response
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
[Bug] dbt crashes if for nested fields (e.g. struct) both the parent and subfields are defined in the YAML file
[ADAP-638] [Bug] dbt crashes if for nested fields (e.g. struct) both the parent and subfields are defined in the YAML file
Jun 21, 2023
Is this a new bug in dbt-bigquery?
Current Behavior
While testing #738 in 1.5rc2, we managed to crash dbt when adding YML config to a struct, both at the parent and subfield levels at the same time.
The goal was to try:
not null
in addition to some of the subfields beingnot null
(the following was tried with and without
data_type
at the parent level but both failed, with different errors though. in an ideal situation, we wouldn't have to set thedata_type
at the parent level but still be allowed to add constraint and documentation)We were expecting this to either work or get a config error from dbt but instead dbt crashes. The code dump is listed below.
Expected Behavior
I would expect this config not to crash but instead to:
Steps To Reproduce
a. at the subfield level
b. at the struct (e.g. parent level)
Relevant log output
Environment
- dbt-core: 1.5rc2
Additional Context
No response
The text was updated successfully, but these errors were encountered: