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

Pass config values to sources in dbt_project.yml #2542

Closed
azhard opened this issue Jun 12, 2020 · 5 comments
Closed

Pass config values to sources in dbt_project.yml #2542

azhard opened this issue Jun 12, 2020 · 5 comments
Labels
duplicate This issue or pull request already exists enhancement New feature or request

Comments

@azhard
Copy link
Contributor

azhard commented Jun 12, 2020

Describe the feature

In the dbt_project.yml file you can pass specific config values to models based on the folder structure. This is extremely useful so that you are not forced to pass in the same value in individual file configs. This pattern however doesn't work for sources. A project.yml sectoin that I would expect to work is as follows:

name: 'dbt'
version: '1.0.0'

config-version: 2

...

# This works
models:
  dbt:
    dir1:
      +tags:
        - fancy_tag1
      sub_dir1:
        +enabled: false
      sub_dir2:
        +materialized: ephemeral

    dir2:
      +tags:
        - fancy_tag2

# This doesn't cause an error but doesn't actually works
sources:
  dbt:
    dir1:
      +database:
        - database_1
      sub_dir1:
        +loaded_at_field: col_1
      sub_dir2:
        +description: Sub_dir2 sources live here

    dir2:
      +loader:
        - Kafka

Additional context

This should work across all databases

Who will this benefit?

Presumably any dbt users who have sources in separate files but those sources share config elements.

@azhard azhard added enhancement New feature or request triage labels Jun 12, 2020
@jtcohen6
Copy link
Contributor

jtcohen6 commented Jun 12, 2020

Really good points @azhard, and I totally agree. Check out #2401.

There are two kinds of dbt config today:

  • prescriptive node configs, set in dbt_project.yml or using the {{ config() }} macro within model files
  • descriptive resource configs, a.k.a. the schema.yml spec, set in any /**.yml files that are not dbt_project.yml

Right now, source-specific configs such as database and loader can only be set in resource.yml files. The only possible config for sources in dbt_project.yml today is enabled (docs):

sources:
  my_dir:
    +enabled: true|false

We have a plan to reconcile node configs and resource configs—it's going to be a lot of hard work, and very much on the roadmap.

@jtcohen6 jtcohen6 removed the triage label Jun 12, 2020
@azhard
Copy link
Contributor Author

azhard commented Jun 12, 2020

Thanks @jtcohen6, has there been any thoughts on when this feature is slated to be implemented?

@jtcohen6
Copy link
Contributor

@azhard We added #2401 to our 1.0 list, so it's slated for the medium term. I'm going to close this issue as a duplicate in the meantime.

@jtcohen6 jtcohen6 added the duplicate This issue or pull request already exists label Jun 22, 2020
@tom-rb
Copy link

tom-rb commented Feb 20, 2024

Reviving this issue, I still have the same problem as the OP. Meaning, this doesn't work:

sources:
  project:
    dir1:
      +database: database_1

Was this issue correctly closed then?

@dbeatty10
Copy link
Contributor

Second time's the charm?

Per #9990 (comment), see #7157 for an issue that looks like it will resolve this.

@dbeatty10 dbeatty10 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants