dbt-coverage icon indicating copy to clipboard operation
dbt-coverage copied to clipboard

Error parsing manifest file with list-type values in YAML config

Open DimitriSam opened this issue 1 year ago • 1 comments

Description

I encountered an issue with the dbt-coverage package where the manifest file cannot be parsed properly. The error occurs in a specific function handling column names.

Steps to Reproduce

  • Command run: dbt-coverage compute doc --model-path-filter model/test.sql
  • Relevant code snippet:
│ 241 │ if not column_name: │
│ 242 │ continue │
│ 243 │ │
│ 244 │ column_name = column_name.lower() │
│ 245 │ table_tests = tests.setdefault(table_id, {}) │
│ 246 │ column_tests = table_tests.setdefault(column_name, []) │
│ 247 │ column_tests.append(node)
  • Error Message: AttributeError: 'list' object has no attribute 'lower'

Expected Behavior

Ideally, the function should be able to handle column names defined as lists without throwing an error.

Environment

  • dbt-coverage version: "0.3.5"
  • dbt version: "1.6.6"
  • Python version: "3.8.12"

Additional Context

The issue arises when defining values as lists in YAML configuration. Example:

snapshots:
  - name: example_snapshot
    tests:
      - custom_test:
          column_name: [modified_column]
          unique_key: example_key

DimitriSam avatar Dec 18 '23 17:12 DimitriSam