dbt-labs/dbt-core

[Bug] Encountered an error while generating catalog: 'NoneType' object has no attribute 'lower'

hantmac opened this issue · 3 comments

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

Invoking dbt with ['docs', 'generate', '--no-compile']
07:25:00 Running with dbt=1.8.0-rc2
07:25:00 Registered adapter: databend=1.8.0-b1
07:25:00 Building catalog
07:25:01 Encountered an error while generating catalog: 'NoneType' object has no attribute 'lower'
07:25:01 dbt encountered 1 failure while writing the catalog
07:25:01 Catalog written to /private/var/folders/x5/4hndsx0x7cb5_45qgpfqx4th0000gn/T/pytest-of-hanshanjie/pytest-24/project0/target/catalog.json

Expected Behavior

dbt docs generate run ok.

Steps To Reproduce

  • run dbt run
  • run dbt docs generate

Relevant log output

14:23:52  Concurrency: 1 threads (target='default')
14:23:52  
14:23:52  1 of 2 START sql view model test17158694028081664764_test_basic.model .......... [RUN]
14:23:56  1 of 2 OK created sql view model test17158694028081664764_test_basic.model ..... [adapter response -1 in 4.08s]
14:23:56  2 of 2 START sql view model test17158694028081664764_test_basic_test.second_model  [RUN]
14:24:03  2 of 2 OK created sql view model test17158694028081664764_test_basic_test.second_model  [adapter response -1 in 6.72s]
14:24:03  
14:24:03  Finished running 2 view models in 0 hours 0 minutes and 18.87 seconds (18.87s).
14:24:03  
14:24:03  Completed successfully
14:24:03  
14:24:03  Done. PASS=2 WARN=0 ERROR=0 SKIP=0 TOTAL=2


Invoking dbt with ['docs', 'generate', '--no-compile']
14:24:03  Running with dbt=1.8.0-rc2
14:24:03  Registered adapter: databend=1.8.0-b1
14:24:03  Building catalog
14:24:05  Encountered an error while generating catalog: 'NoneType' object has no attribute 'lower'
14:24:05  dbt encountered 1 failure while writing the catalog
14:24:05  Catalog written to /private/var/folders/x5/4hndsx0x7cb5_45qgpfqx4th0000gn/T/pytest-of-hanshanjie/pytest-34/project0/target/catalog.json

venv/lib/python3.11/site-packages/dbt/tests/adapter/basic/test_docs_generate.py:438 (TestDocsGenerateDatabend.test_run_and_generate_no_compile)
self = <test_basic.TestDocsGenerateDatabend object at 0x11b535710>
project = <dbt.tests.fixtures.project.TestProjInfo object at 0x11c3f0a10>
expected_catalog = {'nodes': {'model.test.model': {'columns': {'email': {'comment': None, 'index': <dbt.tests.util.AnyInteger object at 0...e', 'id': 'has_stats', 'include': False, 'label': 'Has Stats?', ...}}, 'unique_id': 'source.test.my_source.my_table'}}}

    def test_run_and_generate_no_compile(self, project, expected_catalog):
>       start_time = run_and_generate(project, ["--no-compile"])

Environment

- OS: Mac os
- Python: python 3.11
- dbt: 1.8.0-rc2

Which database adapter are you using with dbt?

No response

Additional Context

No response

Thanks for raising this issue @hantmac !

Can you share more details how you are getting this error? i.e., if you are using a programmatic invocations Python script, could you share it along with a minimal set of dbt project files that reproduces this issue?

Looking at the logs, it looks like you are using a beta version of the dbt-databend adapter. For some reason, it looks like it is executing the TestDocsGenerateSnowflake test (inherited from here).

Thanks for raising this issue @hantmac !

Can you share more details how you are getting this error? i.e., if you are using a programmatic invocations Python script, could you share it along with a minimal set of dbt project files that reproduces this issue?

Looking at the logs, it looks like you are using a beta version of the dbt-databend adapter. For some reason, it looks like it is executing the TestDocsGenerateSnowflake test (inherited from here).

Thanks for response! I just write a test case for dbt-databend, the python code is as follows:

class TestDocsGenerateDatabend(BaseDocsGenerate):
    pass

This is the Python error that crops up any time you call lower() on a non-string object.

So one possibility is that your adapter is passing a None Relation around, and it's ending up here (or somewhere else).

BaseDocsGenerate is extended without issue by dbt-postgres, dbt-snowflake, etc. without issue.

So my belief is that this isn't an issue in dbt-core dbt-adapters, but rather that there's a bug somewhere in dbt-databend that is causing there to be a non-string Relation object, and this test is exposing it. So I'm going to close this issue as "not a bug".