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

[CT-76] [Feature] Allow vars to be declared in selectors #4599

Closed
1 task done
jjuanramos opened this issue Jan 20, 2022 · 4 comments
Closed
1 task done

[CT-76] [Feature] Allow vars to be declared in selectors #4599

jjuanramos opened this issue Jan 20, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request stale Issues that have gone stale vars

Comments

@jjuanramos
Copy link

jjuanramos commented Jan 20, 2022

Is there an existing feature request for this?

  • I have searched the existing issues

Describe the Feature

As of now, selectors are a great way of allowing dbt users to version control the dbt cloud jobs we run. Nevertheless, when it comes to variables we are still limited to declare them on the dbt Cloud UI.

It would be great if we could set the variables in the selector itself.
This could look like this:

selectors:
  - name: update_warehouse
    description: >
      Selection of models that we want to run when we
      update the whole warehouse.
    definition:
      union:
        - method: fqn
          value: "*"
        - exclude:
            - 'tag:tag_1'
            - 'base.kafka'
      vars:
        - treat_base_sources_as_relations: true
        - excluded_base_sources_from_relation_treatment: ['kafka']

Achieving this in the dbt Cloud UI:
dbt build --selector update_warehouse

Describe alternatives you've considered

Keep declaring them on the UI:
dbt build --selector update_warehouse --vars "{treat_base_sources_as_relations: true, excluded_base_sources_from_relation_treatment: ['kafka']}"

Who will this benefit?

Any dbt user that wants to maximize how much of the dbt flow is version controlled.

More specifically, dbt users that rely heavily on variables will improve the reliability and ease of their release process. Right now, any dbt user that has a staging/production environment has to make sure the variables are manually updated in all of their dbt Cloud jobs whenever necessary.

Are you interested in contributing this feature?

Yes!

Anything else?

No response

@jjuanramos jjuanramos added enhancement New feature or request triage labels Jan 20, 2022
@github-actions github-actions bot changed the title [Feature] Allow vars to be declared in selectors [CT-76] [Feature] Allow vars to be declared in selectors Jan 20, 2022
@gshank gshank self-assigned this Jan 25, 2022
@gshank
Copy link
Contributor

gshank commented Jan 25, 2022

I can see that this would be a useful feature. This would probably be easiest to implement if we consider the vars in the selectors as an alternative way of specifying cli vars, so that they are just added (internally) to any other cli vars. This would generally require a full re-parse (as providing different cli vars does today), though we are looking at enabling more granular re-parsing in the future.

@jtcohen6 would have to weigh in on how this would fit in to current development plans.

@jtcohen6
Copy link
Contributor

The proposal in this issue feels similar to a few others, in that they're all solving a similar problem. Effectively, by writing vars in selectors.yml, you can version control the env-dependent logic and save copy-paste across dbt Cloud jobs.

I'm hesitant to add vars right alongside selection logic in selectors.yml, though I see the mental connection between the two. I'd be more excited about:

@gshank Your points about partial parsing are also spot on, and the performance considerations are a big blocker to the ergonomics of vars (wherever they're defined).

@jtcohen6 jtcohen6 added vars and removed triage labels Jan 26, 2022
@github-actions
Copy link
Contributor

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue, or it will be closed in 7 days.

@github-actions github-actions bot added the stale Issues that have gone stale label Jul 26, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2022

Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest; add a comment to notify the maintainers.

@github-actions github-actions bot closed this as completed Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale Issues that have gone stale vars
Projects
None yet
Development

No branches or pull requests

3 participants