Skip to content

Validate require-dbt-version before validating dbt_project.yml schema #2638

@clrcrl

Description

@clrcrl

Describe the feature

In the rare occasion that we change the spec of dbt_project.yml, the errors around this can be pretty confusing. We should consider changing the order of validation to make this nicer.

Example

At the moment if you have:

required-dbt-version: ">0.17.1"
config-version: 2

And your run this with 0.16.1, you get back:

Encountered an error while reading the project:
  ERROR: Runtime Error
  at path []: Additional properties are not allowed ('config-version' was unexpected)
Encountered an error:
Runtime Error
  Could not run dbt

I think it would be a very small, but nice touch, if instead we checked the require-dbt-version first, and then the schema, so this is the error you get:

Running with dbt=0.16.1
Encountered an error while reading the project:
  ERROR: Runtime Error
  This version of dbt is not supported with the 'acme' package.
    Installed version of dbt: =0.16.1
    Required version of dbt for 'acme': ['>=0.17.1']
  Check the requirements for the 'acme' package, or run dbt again with --no-version-check

Encountered an error:
Runtime Error
  Could not run dbt

I feel that the second error is way easier to understand. Obviously not everyone will have a require-dbt-version config, but it’s a nice behavior for those that are doing the right thing 🙂

Describe alternatives you've considered

Doing nothing :)

Additional context

I think the config-version error comes from the initial read of dbt_project.yml, which precedes our ability to check the dbt version. So maybe a little gnarlier to do this than expected.

Who will this benefit?

Anyone working on dbt in a team, that needs to keep dbt versions in sync across many computers

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgood_first_issueStraightforward + self-contained changes, good for new contributors!

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions