Skip to content

Commit

Permalink
[CT-1947] Alias --models to --select for all commands except `dbt…
Browse files Browse the repository at this point in the history
… ls` (#6787)

Co-authored-by: Github Build Bot <buildbot@fishtownanalytics.com>
  • Loading branch information
aranke and FishtownBuildBot authored Jan 31, 2023
1 parent 726c4d6 commit 84bf5b4
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 63 deletions.
9 changes: 1 addition & 8 deletions core/dbt/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ def docs(ctx, **kwargs):
@p.defer
@p.exclude
@p.favor_state
@p.models
@p.profile
@p.profiles_dir
@p.project_dir
Expand Down Expand Up @@ -237,7 +236,6 @@ def docs_serve(ctx, **kwargs):
@p.exclude
@p.favor_state
@p.full_refresh
@p.models
@p.parse_only
@p.profile
@p.profiles_dir
Expand Down Expand Up @@ -347,7 +345,7 @@ def init(ctx, **kwargs):
@p.profiles_dir
@p.project_dir
@p.resource_type
@p.select
@p.raw_select
@p.selector
@p.state
@p.target
Expand Down Expand Up @@ -408,7 +406,6 @@ def parse(ctx, **kwargs):
@p.exclude
@p.fail_fast
@p.full_refresh
@p.models
@p.profile
@p.profiles_dir
@p.project_dir
Expand Down Expand Up @@ -471,7 +468,6 @@ def run_operation(ctx, **kwargs):
@click.pass_context
@p.exclude
@p.full_refresh
@p.models
@p.profile
@p.profiles_dir
@p.project_dir
Expand Down Expand Up @@ -508,7 +504,6 @@ def seed(ctx, **kwargs):
@p.defer
@p.exclude
@p.favor_state
@p.models
@p.profile
@p.profiles_dir
@p.project_dir
Expand Down Expand Up @@ -547,7 +542,6 @@ def source(ctx, **kwargs):
@source.command("freshness")
@click.pass_context
@p.exclude
@p.models
@p.output_path # TODO: Is this ok to re-use? We have three different output params, how much can we consolidate?
@p.profile
@p.profiles_dir
Expand Down Expand Up @@ -590,7 +584,6 @@ def freshness(ctx, **kwargs):
@p.fail_fast
@p.favor_state
@p.indirect_selection
@p.models
@p.profile
@p.profiles_dir
@p.project_dir
Expand Down
34 changes: 16 additions & 18 deletions core/dbt/cli/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,6 @@
hidden=True,
)

models = click.option(
"--models",
"--model",
"-m",
envvar=None,
help="Specify the nodes to include.",
cls=MultiOption,
type=tuple,
)

output = click.option(
"--output",
envvar=None,
Expand Down Expand Up @@ -274,14 +264,22 @@
default=(),
)

select = click.option(
"-s",
"--select",
envvar=None,
help="Specify the nodes to include.",
cls=MultiOption,
type=tuple,
)
model_decls = ("-m", "--models", "--model")
select_decls = ("-s", "--select")
select_attrs = {
"envvar": None,
"help": "Specify the nodes to include.",
"cls": MultiOption,
"type": tuple,
}

# `--select` and `--models` are analogous for most commands except `dbt list` for legacy reasons.
# Most CLI arguments should use the combined `select` option that aliases `--models` to `--select`.
# However, if you need to split out these separators (like `dbt ls`), use the `models` and `raw_select` options instead.
# See https://github.com/dbt-labs/dbt-core/pull/6774#issuecomment-1408476095 for more info.
models = click.option(*model_decls, **select_attrs)
raw_select = click.option(*select_decls, **select_attrs)
select = click.option(*select_decls, *model_decls, **select_attrs)

selector = click.option(
"--selector", envvar=None, help="The selector name to use, as defined in selectors.yml"
Expand Down
Binary file modified core/dbt/docs/build/doctrees/environment.pickle
Binary file not shown.
Binary file modified core/dbt/docs/build/doctrees/index.doctree
Binary file not shown.
25 changes: 0 additions & 25 deletions core/dbt/docs/build/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,6 @@ <h4>full_refresh<a class="headerlink" href="#compile|full_refresh" title="Permal
<p>Type: boolean</p>
<p>If specified, dbt will drop incremental models and fully-recalculate the incremental table from the model definition.</p>
</section>
<section id="compile|models">
<h4>models<a class="headerlink" href="#compile|models" title="Permalink to this heading"></a></h4>
<p>Type: unknown</p>
<p>Specify the nodes to include.</p>
</section>
<section id="compile|parse_only">
<h4>parse_only<a class="headerlink" href="#compile|parse_only" title="Permalink to this heading"></a></h4>
<p>Type: boolean</p>
Expand Down Expand Up @@ -590,11 +585,6 @@ <h4>full_refresh<a class="headerlink" href="#run|full_refresh" title="Permalink
<p>Type: boolean</p>
<p>If specified, dbt will drop incremental models and fully-recalculate the incremental table from the model definition.</p>
</section>
<section id="run|models">
<h4>models<a class="headerlink" href="#run|models" title="Permalink to this heading"></a></h4>
<p>Type: unknown</p>
<p>Specify the nodes to include.</p>
</section>
<section id="run|profile">
<h4>profile<a class="headerlink" href="#run|profile" title="Permalink to this heading"></a></h4>
<p>Type: string</p>
Expand Down Expand Up @@ -696,11 +686,6 @@ <h4>full_refresh<a class="headerlink" href="#seed|full_refresh" title="Permalink
<p>Type: boolean</p>
<p>If specified, dbt will drop incremental models and fully-recalculate the incremental table from the model definition.</p>
</section>
<section id="seed|models">
<h4>models<a class="headerlink" href="#seed|models" title="Permalink to this heading"></a></h4>
<p>Type: unknown</p>
<p>Specify the nodes to include.</p>
</section>
<section id="seed|profile">
<h4>profile<a class="headerlink" href="#seed|profile" title="Permalink to this heading"></a></h4>
<p>Type: string</p>
Expand Down Expand Up @@ -777,11 +762,6 @@ <h4>favor_state<a class="headerlink" href="#snapshot|favor_state" title="Permali
<p>Type: boolean</p>
<p>If set, defer to the argument provided to the state flag for resolving unselected nodes, even if the node(s) exist as a database object in the current environment.</p>
</section>
<section id="snapshot|models">
<h4>models<a class="headerlink" href="#snapshot|models" title="Permalink to this heading"></a></h4>
<p>Type: unknown</p>
<p>Specify the nodes to include.</p>
</section>
<section id="snapshot|profile">
<h4>profile<a class="headerlink" href="#snapshot|profile" title="Permalink to this heading"></a></h4>
<p>Type: string</p>
Expand Down Expand Up @@ -854,11 +834,6 @@ <h4>indirect_selection<a class="headerlink" href="#test|indirect_selection" titl
<p>Type: choice: [‘eager’, ‘cautious’, ‘buildable’]</p>
<p>Select all tests that are adjacent to selected resources, even if they those resources have been explicitly selected.</p>
</section>
<section id="test|models">
<h4>models<a class="headerlink" href="#test|models" title="Permalink to this heading"></a></h4>
<p>Type: unknown</p>
<p>Specify the nodes to include.</p>
</section>
<section id="test|profile">
<h4>profile<a class="headerlink" href="#test|profile" title="Permalink to this heading"></a></h4>
<p>Type: string</p>
Expand Down
Loading

0 comments on commit 84bf5b4

Please sign in to comment.