dbt-labs / dbt-labs/dbt

[1.x Bug] Disabled ref not reported for analyses in packages that use disabled models.

Open
#15,415 0 comments 0 reactions 0 assignees View on GitHub
engine:v1 status:triage type:bug
Dominant language
Rust
Stars
13.8k
Forks
2.6k
Avg merge
21h 31m
Merged PRs (30d)
56

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

This is an analysis SQL file, not a model:
*analyses/my_analysis.sql*
```sql
select x + 1 as y from {{ ref('A') }}
```

The model A is disabled. `my_analysis` is not disabled.

If this analysis file is inside a package in the `dbt_packages` folder, when dbt goes to parse, it will not error about the disabled ref `A`.

### Expected Behavior

When dbt parses, it should error about the disabled ref `A`.

### Steps To Reproduce

Create a simple dbt project that contains nothing other than `dbt_project.yml`.
Then create another new simple dbt project as a package that gets referenced by the first dbt project. This dbt project will contain one analysis and one model.

*dbt_packages/my_package/analyses/my_analysis.sql*
```sql
select x + 1 as y from {{ ref('A') }}
```

*dbt_packages/my_package/models/A.sql*
```sql
select 1 as x from id
```

Then in the root project's (not the package) `dbt_project.yml`, add:
```yml
models:
my_package:
+enabled: false
```

Then run `dbt parse` . We should expect to get an error in dbt-core about the disabled ref, but we do not.

### Relevant log output

```shell

```

### Environment

```markdown
- OS:
- Python:
- dbt:
```

### Which database adapter are you using with dbt?

_No response_

### 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.