Skip to content

[Bug] dbt run --empty tag doesn't work with dbt_utils.get_column_values() #1009

@Ananz2022

Description

@Ananz2022

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

We use --empty to create empty tables. If there is no record in the table, dbt_utils.get_column_values() fails with a NoneType' object is not iterable error as it does not found values to loop through.

similar issue found with

  • dbt_utils.pivot()
  • dbt_utils.get_query_results_as_dict()

Expected Behavior

Function to create some dummy records to make it pass.

  • dbt_utils.get_column_values()
  • dbt_utils.pivot()
  • dbt_utils.get_query_results_as_dict()

Steps To Reproduce

Use dbt_utils macros for empty tables

dbt_utils.get_query_results_as_dict(SELECT * FROM empty_table)

Relevant log output

Environment

dbt version: 1.9.2
python version: 3.11.1
adapter type: snowflake
adapter version: 1.9.1

Which database adapter are you using with dbt?

snowflake

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions