dbt-labs / dbt-labs-experimental-features

dbt support for database features which are not yet supported natively in dbt-core
Apache License 2.0
147 stars 43 forks source link

BigQuery Materalized view getting `'NoneType' object is not iterable` #37

Closed dannnnthemannnn closed 5 months ago

dannnnthemannnn commented 2 years ago

Here is the error I am getting by adding the default and bigquery folders to my macros folder:

07:08:25  Encountered an error:
'NoneType' object is not iterable
07:08:25  Traceback (most recent call last):
  File "/opt/homebrew/Cellar/dbt-bigquery/1.3.0/libexec/lib/python3.9/site-packages/dbt/main.py", line 135, in main
    results, succeeded = handle_and_check(args)
  File "/opt/homebrew/Cellar/dbt-bigquery/1.3.0/libexec/lib/python3.9/site-packages/dbt/main.py", line 198, in handle_and_check
    task, res = run_from_args(parsed)
  File "/opt/homebrew/Cellar/dbt-bigquery/1.3.0/libexec/lib/python3.9/site-packages/dbt/main.py", line 245, in run_from_args
    results = task.run()
  File "/opt/homebrew/Cellar/dbt-bigquery/1.3.0/libexec/lib/python3.9/site-packages/dbt/task/runnable.py", line 453, in run
    self._runtime_initialize()
  File "/opt/homebrew/Cellar/dbt-bigquery/1.3.0/libexec/lib/python3.9/site-packages/dbt/task/runnable.py", line 161, in _runtime_initialize
    super()._runtime_initialize()
  File "/opt/homebrew/Cellar/dbt-bigquery/1.3.0/libexec/lib/python3.9/site-packages/dbt/task/runnable.py", line 94, in _runtime_initialize
    self.load_manifest()
  File "/opt/homebrew/Cellar/dbt-bigquery/1.3.0/libexec/lib/python3.9/site-packages/dbt/task/runnable.py", line 81, in load_manifest
    self.manifest = ManifestLoader.get_full_manifest(self.config)
  File "/opt/homebrew/Cellar/dbt-bigquery/1.3.0/libexec/lib/python3.9/site-packages/dbt/parser/manifest.py", line 221, in get_full_manifest
    manifest = loader.load()
  File "/opt/homebrew/Cellar/dbt-bigquery/1.3.0/libexec/lib/python3.9/site-packages/dbt/parser/manifest.py", line 320, in load
    self.load_and_parse_macros(project_parser_files)
  File "/opt/homebrew/Cellar/dbt-bigquery/1.3.0/libexec/lib/python3.9/site-packages/dbt/parser/manifest.py", line 438, in load_and_parse_macros
    self.macro_depends_on()
  File "/opt/homebrew/Cellar/dbt-bigquery/1.3.0/libexec/lib/python3.9/site-packages/dbt/parser/manifest.py", line 532, in macro_depends_on
    possible_macro_calls = statically_extract_macro_calls(
  File "/opt/homebrew/Cellar/dbt-bigquery/1.3.0/libexec/lib/python3.9/site-packages/dbt/clients/jinja_static.py", line 43, in statically_extract_macro_calls
    ad_macro_calls = statically_parse_adapter_dispatch(
  File "/opt/homebrew/Cellar/dbt-bigquery/1.3.0/libexec/lib/python3.9/site-packages/dbt/clients/jinja_static.py", line 147, in statically_parse_adapter_dispatch
    macro = db_wrapper.dispatch(func_name, macro_namespace=macro_namespace).macro
  File "/opt/homebrew/Cellar/dbt-bigquery/1.3.0/libexec/lib/python3.9/site-packages/dbt/context/providers.py", line 166, in dispatch
    for package_name in search_packages:
TypeError: 'NoneType' object is not iterable
minhajpasha commented 1 year ago

+1

dongchris commented 1 year ago

+1

WesleyBatista commented 1 year ago

I am getting the same traceback when copying macros from dbt-labs/dbt-external-tables as dbt-external-tables folder into my project's macros.

This is the folder structure I have:

macros
├── add_rows_limit.sql
├── dbt-external-tables
│   ├── common
│   └── plugins
└── generate_schema_name.sql

Am I missing anything?

philipp-heinrich commented 1 year ago

Did anyone make this work?

Seems like a connected issue too: https://github.com/dbt-labs/dbt-core/issues/4596

daniel-bartley commented 1 year ago

+1

irfanmobin commented 9 months ago

in my experience, this issue is usually when you have a jinja variable in one of your models, but it does not have a default value, so when DBT tries to build the manifest, it fails.

i have no idea why it has this behaviour, but it is what it is i guess. make sure you have default values

dataders commented 5 months ago

This bug should no longer exist in the official implementation!

Materialized Views have been supported in dbt since dbt-core 1.7 (November 2023). See dbt docs: materialized views and dbt docs: Big Query configurations: materialized views for more information.

The version of materialized views in this experimental repo is is long-overdue for official deprecation -- it has not been meaningfully maintained or improved for over three years (see https://github.com/dbt-labs/dbt-labs-experimental-features/pull/11).

If you haven't already, you should try out the official implementation! Should you encounter an issue, you can then open bug or enhancement ticket on either dbt-core or the dbt-bigquery for your current data platform.