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

Adding descriptions to tests no longer possible with 0.20.0 #3599

Closed
1 of 5 tasks
mirosval opened this issue Jul 20, 2021 · 1 comment
Closed
1 of 5 tasks

Adding descriptions to tests no longer possible with 0.20.0 #3599

mirosval opened this issue Jul 20, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@mirosval
Copy link

Describe the bug

In 0.19 the following would work (in a Model or Source):

     columns:
      - name: user_cohort
        tests:
          - not_null:
              severity: warn
              description: "severity reduced pending further investigation"

In 0.20 I get:

Runtime Error
  Compilation Error in test not_null_<test_name> (<model_yaml>)
    macro 'dbt_macro__test_not_null' takes no keyword argument 'description'

    > in macro test_not_null (macros/schema_tests/not_null.sql)

Steps To Reproduce

Add description: aaa under a test in a model or source.

Expected behavior

No compilation error

System information

Which database are you using dbt with?

  • postgres
  • redshift
  • bigquery
  • snowflake
  • other (specify: ____________)

The output of dbt --version:

installed version: 0.20.0
   latest version: 0.20.0

Up to date!

Plugins:
  - bigquery: 0.20.0
  - snowflake: 0.20.0
  - redshift: 0.20.0
  - postgres: 0.20.0

The operating system you're using: macOS 11.4

The output of python --version: 3.9.5

Additional context

I have not found a mention of this in the release notes and to be fair the updated docs don't say this should be possible. But it did work before and I think its useful especially when you want to document why you downgraded a test to a warning instead of an error.

@mirosval mirosval added bug Something isn't working triage labels Jul 20, 2021
@jtcohen6 jtcohen6 removed the triage label Jul 26, 2021
@jtcohen6
Copy link
Contributor

Thanks for opening @mirosval. As you note, this wasn't officially supported documented in previous versions of dbt. At the same time, it did sort-of work, and I totally get why it's desirable.

The description test argument (as in your code snippet above) couldn't reference doc blocks, and it wouldn't show up in the node-level description property in manifest.json; it would just be nested under test_metadata. We do want to support descriptions on tests, ultimately, in a way that's more consistent with descriptions on all other resource types: #2578, #3249.

In the meantime, I think a more general approach that could get you what you're after would be meta properties on tests: #3629.

I'm going to close this issue in favor of the meta approach in the shorter term, and real description support in the longer term.

rexledesma added a commit to dagster-io/dagster that referenced this issue Jan 31, 2024
## Summary & Motivation
According to the problem [Adding descriptions to tests is no longer
possible from 0.20.0](dbt-labs/dbt-core#3599 )
and the source code
[SchemaGenericTestParser](https://github.com/dbt-labs/dbt-core/blob/main/core/dbt/parser/schema_generic_tests.py#L39)
the general test does not support the description in the schema.

This fix allows users to define a test description in `tests/<generic
test>/config/meta/description`, to display data in Dagster(UI) Asset
Check.

```yaml
models:
  - name: wildberries_incomes
    tests:
      - name: 'Equal_row_count_with_stg__wildberries_incomes'
        config: 
          meta:
            description: "Equal rows before join with mapping table"
        test_name: equal_rowcount
        compare_model: source('production', 'stg__wildberries_incomes')
        compare_model_final: True
```

Related: dbt-labs/dbt-core#2578


![Снимок экрана 2024-01-29 в 14 57
45](https://github.com/dagster-io/dagster/assets/34104577/2638a04c-935f-4368-b21b-04c5de740614)


## How I Tested These Changes
pytest

Co-authored-by: Rex Ledesma <[email protected]>
OwenKephart pushed a commit to dagster-io/dagster that referenced this issue Jan 31, 2024
## Summary & Motivation
According to the problem [Adding descriptions to tests is no longer
possible from 0.20.0](dbt-labs/dbt-core#3599 )
and the source code
[SchemaGenericTestParser](https://github.com/dbt-labs/dbt-core/blob/main/core/dbt/parser/schema_generic_tests.py#L39)
the general test does not support the description in the schema.

This fix allows users to define a test description in `tests/<generic
test>/config/meta/description`, to display data in Dagster(UI) Asset
Check.

```yaml
models:
  - name: wildberries_incomes
    tests:
      - name: 'Equal_row_count_with_stg__wildberries_incomes'
        config: 
          meta:
            description: "Equal rows before join with mapping table"
        test_name: equal_rowcount
        compare_model: source('production', 'stg__wildberries_incomes')
        compare_model_final: True
```

Related: dbt-labs/dbt-core#2578


![Снимок экрана 2024-01-29 в 14 57
45](https://github.com/dagster-io/dagster/assets/34104577/2638a04c-935f-4368-b21b-04c5de740614)


## How I Tested These Changes
pytest

Co-authored-by: Rex Ledesma <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants