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
10.01k stars 1.63k forks source link

[CT-2296] [Spike] Remove the distinction between configs and non-configs #7157

Open jtcohen6 opened 1 year ago

jtcohen6 commented 1 year ago

copying from internal Slack

At first blush, these feel like desirable UX outcomes for our artifacts / metadata interface:

And for the developer UX:

Internal Notion with more background & context: https://www.notion.so/dbtlabs/Why-Configs-0ab08bbf3bb34c84bc70c3e57b4f575e?pvs=4

Example

models:
  - name: my_model
    description: ...
    materialized: ...
    any_field_i_want: ...
{{ config(description = ..., materialized = ..., any_field_i_want = ...) }}

With the addition of frontmatter (#7100):

---
description: ...
materialized: ...
any_field_i_want: ...
---

select ...
joellabes commented 1 year ago

Does any_field_i_want imply breaking out of the meta sandbox, or do you just mean any_already_defined_field_i_want?

jtcohen6 commented 1 year ago

Does any_field_i_want imply breaking out of the meta sandbox, or do you just mean any_already_defined_field_i_want?

Fair point! Users (and adapter maintainers) can already define whatever custom configs they want, and access them via {{ config.get() }}.

If this is the route we go down, there will be very little functional difference between sticking a totally custom field in the "extra" dict (implicitly), versus putting it in the meta dict (explicitly). We'd either want to:

joellabes commented 1 year ago

Huh! TIL.

I would lean towards the first option - keep them both but explain what context is appropriate for each.

jtcohen6 commented 1 year ago

If we totally removed the config dict, and allowed users to specify whatever (valid) keys they wanted as top-level properties, it would make it more difficult for us to catch typos & provide a helpful warning: https://github.com/dbt-labs/dbt-core/issues/5605#issuecomment-1209317030 / https://github.com/dbt-labs/dbt-core/issues/6008

But it's already the case that we don't / can't catch a typo for a config entry, e.g.:

config:
  matrialized: table
jtcohen6 commented 1 year ago

@gshank and I discussed potentially pulling this as follow-on work, as part of stabilizing artifact (manifest) interfaces. It's still not top priority must-have, but it would be thematic with that effort.