dbt-labs / dbt-labs/dbt

[ERROR UX] [SPAN] invalid generic tests should point to offending YAML span not compiled SQL span

Open
#14,081 1 comment 0 reactions 2 assignees Claimed by @akbog View on GitHub
area:engine engine:v2 type:feature
Dominant language
Rust
Stars
13.8k
Forks
2.6k
Avg merge
21h 31m
Merged PRs (30d)
56

Description

with generic tests, end users only author in YAML. both the macros that template and the resulting SQL are not where the user needs to correct the location.

Ideally a generic test failing to compile should point to the offending YAML definition.

This is not the case for bespoke tests

from @pempey in https://github.com/dbt-labs/dbt-fusion/discussions/584#discussioncomment-14387615

> When the compile of a test fails, for example because of a missing column, I would like the error to direct me to the yaml where the test is defined in yaml and not the referents test macro in the `target\generic_tests` directory as the rendered test is not something I can change to fix the problem.
>
> ```
> error: dbt0227: No column CUSTOMER_ID found. Available are PREP.CUSTOMERS.CUSTOMERS_DB_CLOUD_ACTIVATIONS_SOURCE.CLOUD_ACTIVATION_ID, PREP.CUSTOMERS.CUSTOMERS_DB_CLOUD_ACTIVATIONS_SOURCE.SUBSCRIPTION_NAME, PREP.CUSTOMERS.CUSTOMERS_DB_CLOUD_ACTIVATIONS_SOURCE.BILLING_ACCOUNT_ID, PREP.CUSTOMERS.CUSTOMERS_DB_CLOUD_ACTIVATIONS_SOURCE.CLOUD_ACTIVATION_CODE, PREP.CUSTOMERS.CUSTOMERS_DB_CLOUD_ACTIVATIONS_SOURCE.CLOUD_ACTIVATION_CREATED_AT, PREP.CUSTOMERS.CUSTOMERS_DB_CLOUD_ACTIVATIONS_SOURCE.CLOUD_ACTIVATION_UPDATED_AT, PREP.CUSTOMERS.CUSTOMERS_DB_CLOUD_ACTIVATIONS_SOURCE.SEAT_UTILIZATION_REMINDER_SENT_AT ..(and 1 more)
> --> target/generic_tests/not_null_customers_db_cloud_activations_source_customer_id.sql:7:8 (target/compiled/generic_tests/not_null_customers_db_cloud_activations_source_customer_id.sql:7:8)
> ```

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.