Skip to content

[Bug] Cannot run unit test with duckdb as database #10292

@sogunsemi

Description

@sogunsemi

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

When I run the unit tests:

dbt test --select test_type:unit

I get back this error:

Compilation Error in model model_a (models/source_a/sources.yml)
Not able to get columns for unit test 'model_a' from relation "dev"."source_a"."model_a"

> in macro get_fixture_sql (macros/unit_test_sql/get_fixture_sql.sql)
> called by model model_a (models/source_a/source.yml)

Unit test:

unit_tests:
  - name: test_type_conversions
    description: "Check type conversion logic"
    model: model_a
    given:
      - input: source('source_a', 'model_a')
        rows:
          - {year: '2015', value: '2.9'}
    expect:
      rows:
      - {year: 2015, absence_rate_total: 2.9}

Expected Behavior

The unit test runs to completion.

Steps To Reproduce

  1. Configure duckdb as the warehouse using the dbt-duckdb adapter version 1.8.1
  2. Create a unit test for a model
  3. Run it using the command: dbt test --select test_type:unit

Relevant log output

No response

Environment

- OS: MacOS Monterey 12.4
- Python: 3.11.9
- dbt: 1.8.2

Which database adapter are you using with dbt?

other (mention it in "Additional Context")

Additional Context

Using dbt-duckdb 1.8.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingunit testsIssues related to built-in dbt unit testing functionalitywontfixNot a bug or out of scope for dbt-core

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions