dbt-labs / dbt-labs/dbt-utils

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

Open
#1,009 10 comments 2 reactions 0 assignees View on GitHub
bug triage
Dominant language
Makefile
Stars
1.8k
Forks
632
PR merge metrics
No merged PRs in 30d

Description

### Is this a new bug in dbt-core?

- [x] I believe this is a new bug in dbt-core
- [x] 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

```shell

```

### Environment

```markdown
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_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.