dbt-labs / dbt-labs/dbt-autofix

Update `require-dbt-version` when `config.get` / `require` is migrated to `meta_get` / `meta_require`

Open
#265 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
88
Forks
19
Avg merge
1d 1h
Merged PRs (30d)
13

Description

### What

Whenever `config.get` / `require` is migrated to `meta_get` / `meta_require` (via https://github.com/dbt-labs/dbt-autofix/pull/250), then the [`require-dbt-version`](https://docs.getdbt.com/reference/project-configs/require-dbt-version) should also be bumped at the same time.

### Why

@jtcohen6 said the following in https://github.com/dbt-labs/dbt-core/issues/13743#issuecomment-3616042831 (emphasis mine):
> 4. Versioning / Rollout
> - ...
> - Packages using `config.get` / `config.require` to access custom configs should update to more-defensive code (`config.meta_get(...) or config.get(...)`), and **update `require-dbt-version` to >=1.10.x** (where x is the next patch release including these methods)

### How

Within `dbt_project.yml`:

```yaml
require-dbt-version: [">=1.10.18", "<3.0.0"]
```

### Consequence

If this autofix is applied to a dbt package, then users that install that package will only be able to use versions of dbt that align with `require-dbt-version`, and they will get an error otherwise.

💥 Using the autofix in https://github.com/dbt-labs/dbt-autofix/pull/250 will already raise errors like the following for dbt versions less than `1.10.18`:

```
'dbt.context.providers.RuntimeConfigObject object' has no attribute 'meta_get'
'dbt.context.providers.RuntimeConfigObject object' has no attribute 'meta_require'
```

⚠️ Package maintainers that want to support dbt versions **less** than `1.10.18` will **not** be able to use this autofix.

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.