dbt-labs / dbt-core

dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.
https://getdbt.com
Apache License 2.0
9.25k stars 1.53k forks source link

[Feature] Check `config` macros keys for validity, possible typos #10306

Open ivan-fishbrain opened 2 weeks ago

ivan-fishbrain commented 2 weeks ago

Is this a new bug in dbt-core?

Current Behavior

If I'll write a model with an inline model config having typo in one of the keys, dbt will silently proceed without any warning on that.

I've made a typo in key unique_key, which made dbt inferring field as an empty value and thus always appending rows instead of updating existing:

{{
    config(
        materialized = 'incremental',
        incremental_strategy = 'merge',
        unnnnique_key = ['id']  # here is the typo
    )
}}

Expected Behavior

I am unsure if it's intended to have custom keys in a model's config, but it would be nice to have at least warning or ideally exception on invalid config key. I can try to make a PR, if someone will kindly point me to the right place in the code to put this check.

Steps To Reproduce

Just make a dbt model with the code

{{
    config(
        materialized = 'incremental',
        incremental_strategy = 'merge',
        unnnnique_key = ['id']
    )
}}

select 1 as id

Relevant log output

No response

Environment

- OS: MacOS 14.5
- Python: 3.12
- dbt: 1.7.14
- dbt-bigquery: 1.7.8

Which database adapter are you using with dbt?

bigquery

Additional Context

No response

dbeatty10 commented 2 weeks ago

Thanks for reaching out @ivan-fishbrain ! This is expected behavior, so I switched this from a bug report to a feature request.