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

Feature: @model to build additional dependencies #1156

Closed
swettk opened this issue Nov 27, 2018 · 4 comments
Closed

Feature: @model to build additional dependencies #1156

swettk opened this issue Nov 27, 2018 · 4 comments
Labels
enhancement New feature or request help_wanted Trickier changes, with a clear starting point, good for previous/experienced contributors

Comments

@swettk
Copy link

swettk commented Nov 27, 2018

Feature

Feature description

When using the --models flag in conjunction with + only results in the downstream/upstream dependencies being built (and not their individual dependencies). It would be useful to have a ++modelName++ syntax to build that path on the tree including the dependencies of the dependent/parent models.

Who will this benefit?

Anyone using selective builds in clean CI environments.

Edit: Updated Feature Description (See below)

Add an @ modifier (applicable only at the beginning of a selector) which will select:

  • all of the descendants of the specified resource
  • all of the ancestors of those resources

Examples:

# Run everything downstream of a source, plus transitive parents of those downstream models
dbt run --model @source:snowplow

# Run a model, plus everything downstream, plus transitive parents of those downstream models
dbt run --model @some_model
@drewbanin drewbanin added the enhancement New feature or request label Nov 27, 2018
@drewbanin
Copy link
Contributor

thanks for the suggestion @swettk! I'm super into the idea, but open to alternatives for the syntax. Ideally, we'd pick something 1) sensible 2) easy to parse 3) conflict-free with most terminals.

@drewbanin drewbanin added this to the Wilt Chamberlain milestone Nov 28, 2018
@drewbanin
Copy link
Contributor

This is currently prioritized for the Stephen Girard release, but our thinking needs to be developed a little further before we can tackle it.

  1. Rather than ++, let's use @. It's going to be less confusing/easier to implement than repurposing the + I think.
  2. What does the @ sign mean at the beginning/end of the selector?
  • At the end: Run the parents of the children of the selected model
  • At the beginning: I don't know that this is super useful, nor do I know exactly what it would indicate? I guess the opposite of the above is: "Run the children of the parents of the selected model". That might be consistent, but I am hard pressed to think of a good use case for that.

Either way, the @ selector has a weird effect of kind of doing the opposite of what you would think. If you do

dbt run --model my_model@

dbt will run:

  1. my_model
  2. all of the children of my_model
  3. all of the parents of the children of my_model

Almost by definition, (3) will include the parents of my_model, right? That's a little counter-intuitive, and it's not really what I would expect here!

This almost makes me think that this functionality shouldn't be implemented with a selector modifier like @, but instead with some other flag. Like --transitive-closure or something :). I think the use case is predominately for CI envs (as noted above) and I don't want to convolute the human-centric parts of model selection for something that will mainly be used by machines.

Keen to discuss, but let's answer these questions before doing any work on this issue

@drewbanin drewbanin added the help_wanted Trickier changes, with a clear starting point, good for previous/experienced contributors label Jan 24, 2019
@cmcarthur
Copy link
Member

@drewbanin can we drop the before/after stuff, and just define dbt run --model @my_model as: "Run my_model and all its descendants, and every other model that is an input to those descendants"? In that world my_model@ doesn't mean anything, and is invalid

@drewbanin
Copy link
Contributor

Yeah, I'm into that. I think this is also going to be really helpful for sources, right?

dbt run --model @source:snowplow

Run every model that depends on Snowplow source data, plus all of their inputs? Should be pretty useful!

beckjake added a commit that referenced this issue Feb 13, 2019
…el-selection

Enhanced model selection syntax (#1156)
@drewbanin drewbanin changed the title Feature: ++model++ to build additional dependencies Feature: @model to build additional dependencies Feb 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help_wanted Trickier changes, with a clear starting point, good for previous/experienced contributors
Projects
None yet
Development

No branches or pull requests

3 participants