Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CT-1317] Validate source config enabled flag #6030

Closed
gshank opened this issue Oct 7, 2022 · 1 comment · Fixed by #6038
Closed

[CT-1317] Validate source config enabled flag #6030

gshank opened this issue Oct 7, 2022 · 1 comment · Fixed by #6038

Comments

@gshank
Copy link
Contributor

gshank commented Oct 7, 2022

There is no validation of the "enabled" config flag for sources, whether in dbt_project.yml or in a schema file. This means that people can set the flag to strange things such as "False and False" and it will be saved with no error message.

@github-actions github-actions bot changed the title Validate source config enabled flag [CT-1317] Validate source config enabled flag Oct 7, 2022
@emmyoop
Copy link
Member

emmyoop commented Oct 10, 2022

There doesn't seem to be validation for the enabled config for metrics and exposures either. Exposures seem to behave like sources. Metrics will fail, but with a misleading error message.

This schema.yml

version: 2

metrics:

  - name: number_of_people
    label: "Number of people"
    description: Total count of people
    model: "ref('people')"
    calculation_method: count
    expression: "*"
    timestamp: created_at
    time_grains: [day, week, month]
    dimensions:
      - favorite_color
      - loves_dbt
    meta:
        my_meta: 'testing'

  - name: collective_tenure
    label: "Collective tenure"
    description: Total number of years of team experience
    model: "metric('number_of_people')"
    calculation_method: sum
    expression: tenure
    config:
      enabled: False and False
    timestamp: created_at
    time_grains: [day]
    filters:
      - field: loves_dbt
        operator: 'is'
        value: 'true'

results in

Compilation Error in metric collective_tenure (models/metric_y.yml)
  Metric 'metric.basic_dbt.collective_tenure' (models/metric_y.yml) depends on a metric named 'number_of_people' which is disabled

When in fact collective_tenure has an invalid config and number_of_people is enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants