Skip to content

Commit

Permalink
Merge branch 'mwong-cloud-cli-beta' into mwong-cloud-cli-links
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 authored Oct 4, 2023
2 parents f67d8f2 + 254cdc1 commit 48e2408
Show file tree
Hide file tree
Showing 18 changed files with 279 additions and 191 deletions.
2 changes: 1 addition & 1 deletion website/docs/reference/commands/clone.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The `clone` command is useful for:
dbt clone --state path/to/artifacts

# clone one_specific_model of my models from specified state to my target schema(s)
dbt clone --select one_specific_model --state path/to/artifacts
dbt clone --select "one_specific_model" --state path/to/artifacts

# clone all of my models from specified state to my target schema(s) and recreate all pre-existing relations in the current target
dbt clone --state path/to/artifacts --full-refresh
Expand Down
4 changes: 2 additions & 2 deletions website/docs/reference/commands/compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ This will log the compiled SQL to the terminal, in addition to writing to the `t
For example:

```bash
dbt compile --select stg_payments
dbt compile --select "stg_payments"
dbt compile --inline "select * from {{ ref('raw_orders') }}"
```

returns the following:


```bash
dbt compile --select stg_orders
dbt compile --select "stg_orders"
21:17:09 Running with dbt=1.5.0-b5
21:17:09 Found 5 models, 20 tests, 0 snapshots, 0 analyses, 425 macros, 0 operations, 3 seed files, 0 sources, 0 exposures, 0 metrics, 0 groups
21:17:09
Expand Down
3 changes: 2 additions & 1 deletion website/docs/reference/commands/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ id: "list"
The `dbt ls` command lists resources in your dbt project. It accepts selector arguments that are similar to those provided in [dbt run](/reference/commands/run). `dbt list` is an alias for `dbt ls`. While `dbt ls` will read your [connection profile](/docs/core/connect-data-platform/connection-profiles) to resolve [`target`](/reference/dbt-jinja-functions/target)-specific logic, this command will not connect to your database or run any queries.

### Usage

```
dbt ls
[--resource-type {model,source,seed,snapshot,metric,test,exposure,analysis,default,all}]
Expand Down Expand Up @@ -85,7 +86,7 @@ $ dbt ls --select snowplow.* --output json --output-keys "name resource_type des
<VersionBlock firstVersion="1.5">

```
$ dbt ls --select snowplow.* --output json --output-keys name resource_type description
$ dbt ls --select snowplow.* --output json --output-keys "name resource_type description"
{"name": "snowplow_events", "description": "This is a pretty cool model", ...}
{"name": "snowplow_page_views", "description": "This model is even cooler", ...}
...
Expand Down
2 changes: 1 addition & 1 deletion website/docs/reference/commands/seed.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The `dbt seed` command will load `csv` files located in the `seed-paths` directo
Specific seeds can be run using the `--select` flag to `dbt seed`. Example:

```
$ dbt seed --select country_codes
$ dbt seed --select "country_codes"
Found 2 models, 3 tests, 0 archives, 0 analyses, 53 macros, 0 operations, 2 seed files
14:46:15 | Concurrency: 1 threads (target='dev')
Expand Down
8 changes: 4 additions & 4 deletions website/docs/reference/commands/show.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The results of the preview query are not materialized in the data warehouse, or
Example:

```
dbt show --select model_name.sql
dbt show --select "model_name.sql"
```
or
```
Expand All @@ -26,7 +26,7 @@ dbt show --inline "select * from {{ ref('model_name') }}"
The following is an example of `dbt show` output for a model named `stg_orders`:

```bash
dbt show --select stg_orders
dbt show --select "stg_orders"
21:17:38 Running with dbt=1.5.0-b5
21:17:38 Found 5 models, 20 tests, 0 snapshots, 0 analyses, 425 macros, 0 operations, 3 seed files, 0 sources, 0 exposures, 0 metrics, 0 groups
21:17:38
Expand All @@ -46,7 +46,7 @@ dbt show --select stg_orders
For example, if you've just built a model that has a failing test, you can quickly preview the test failures right in the terminal, to find values of `id` that are duplicated:

```bash
$ dbt build -s my_model_with_duplicates
$ dbt build -s "my_model_with_duplicates"
13:22:47 Running with dbt=1.5.0
...
13:22:48 Completed with 1 error and 0 warnings:
Expand All @@ -58,7 +58,7 @@ $ dbt build -s my_model_with_duplicates
13:22:48
13:22:48 Done. PASS=1 WARN=0 ERROR=1 SKIP=0 TOTAL=2

$ dbt show -s unique_my_model_with_duplicates_id
$ dbt show -s "unique_my_model_with_duplicates_id"
13:22:53 Running with dbt=1.5.0
13:22:53 Found 4 models, 2 tests, 0 snapshots, 0 analyses, 309 macros, 0 operations, 0 seed files, 0 sources, 0 exposures, 0 metrics, 0 groups
13:22:53
Expand Down
4 changes: 2 additions & 2 deletions website/docs/reference/commands/source.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ By default, `dbt source freshness` will calculate freshness information for all

```bash
# Snapshot freshness for all Snowplow tables:
$ dbt source freshness --select source:snowplow
$ dbt source freshness --select "source:snowplow"

# Snapshot freshness for a particular source table:
$ dbt source freshness --select source:snowplow.event
$ dbt source freshness --select "source:snowplow.event"
```

### Configuring source freshness output
Expand Down
12 changes: 6 additions & 6 deletions website/docs/reference/commands/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ The tests to run can be selected using the `--select` flag discussed [here](/ref

```bash
# run tests for one_specific_model
dbt test --select one_specific_model
dbt test --select "one_specific_model"

# run tests for all models in package
dbt test --select some_package.*
dbt test --select "some_package.*"

# run only tests defined singularly
dbt test --select test_type:singular
dbt test --select "test_type:singular"

# run only tests defined generically
dbt test --select test_type:generic
dbt test --select "test_type:generic"

# run singular tests limited to one_specific_model
dbt test --select one_specific_model,test_type:singular
dbt test --select "one_specific_model,test_type:singular"

# run generic tests limited to one_specific_model
dbt test --select one_specific_model,test_type:generic
dbt test --select "one_specific_model,test_type:generic"
```

For more information on writing tests, see the [Testing Documentation](/docs/build/tests).
79 changes: 79 additions & 0 deletions website/docs/reference/dbt_project.yml.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ By default, dbt will look for `dbt_project.yml` in your current working director

By default, dbt will look for `dbt_project.yml` in your current working directory and its parents, but you can set a different directory using the `--project-dir` flag or the `DBT_PROJECT_DIR` environment variable.

Starting from dbt v1.5 and higher, you can specify your dbt Cloud project ID in the `dbt_project.yml` file using the `dbt-cloud` config, which doesn't require validation or storage in the project config class. To find your project ID, check your dbt Cloud project URL, such as `https://cloud.getdbt.com/11/projects/123456`, where the project ID is `123456`.

</VersionBlock>

The following is a list of all available configurations in the `dbt_project.yml` file.
Expand All @@ -19,6 +21,9 @@ The following is a list of all available configurations in the `dbt_project.yml`
dbt uses YAML in a few different places. If you're new to YAML, it would be worth taking the time to learn how arrays, dictionaries and strings are represented.
:::


<VersionBlock firstVersion="1.5">

<File name='dbt_project.yml'>

```yml
Expand Down Expand Up @@ -48,6 +53,9 @@ dbt uses YAML in a few different places. If you're new to YAML, it would be wort

[require-dbt-version](/reference/project-configs/require-dbt-version): version-range | [version-range]

[dbt-cloud](/docs/cloud/cloud-cli-installation):
project-id: project_id

[quoting](/reference/project-configs/quoting):
database: true | false
schema: true | false
Expand Down Expand Up @@ -79,6 +87,77 @@ vars:
search_order: [packagename]

[restrict-access](/docs/collaborate/govern/model-access): true | false

```
</File>
</VersionBlock>
<VersionBlock lastVersion="1.5">
<File name='dbt_project.yml'>
```yml
[name](/reference/project-configs/name): string

[config-version](/reference/project-configs/config-version): 2
[version](/reference/project-configs/version): version

[profile](/reference/project-configs/profile): profilename

[model-paths](/reference/project-configs/model-paths): [directorypath]
[seed-paths](/reference/project-configs/seed-paths): [directorypath]
[test-paths](/reference/project-configs/test-paths): [directorypath]
[analysis-paths](/reference/project-configs/analysis-paths): [directorypath]
[macro-paths](/reference/project-configs/macro-paths): [directorypath]
[snapshot-paths](/reference/project-configs/snapshot-paths): [directorypath]
[docs-paths](/reference/project-configs/docs-paths): [directorypath]
[asset-paths](/reference/project-configs/asset-paths): [directorypath]

[target-path](/reference/project-configs/target-path): directorypath
[log-path](/reference/project-configs/log-path): directorypath
[packages-install-path](/reference/project-configs/packages-install-path): directorypath

[clean-targets](/reference/project-configs/clean-targets): [directorypath]

[query-comment](/reference/project-configs/query-comment): string

[require-dbt-version](/reference/project-configs/require-dbt-version): version-range | [version-range]

[quoting](/reference/project-configs/quoting):
database: true | false
schema: true | false
identifier: true | false

models:
[<model-configs>](/reference/model-configs)

seeds:
[<seed-configs>](/reference/seed-configs)

snapshots:
[<snapshot-configs>](/reference/snapshot-configs)

sources:
[<source-configs>](source-configs)

tests:
[<test-configs>](/reference/test-configs)

vars:
[<variables>](/docs/build/project-variables)

[on-run-start](/reference/project-configs/on-run-start-on-run-end): sql-statement | [sql-statement]
[on-run-end](/reference/project-configs/on-run-start-on-run-end): sql-statement | [sql-statement]

[dispatch](/reference/project-configs/dispatch-config):
- macro_namespace: packagename
search_order: [packagename]

[restrict-access](/docs/collaborate/govern/model-access): true | false

```
</File>
</VersionBlock>
16 changes: 8 additions & 8 deletions website/docs/reference/node-selection/defer.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ It is possible to use separate state for `state:modified` and `--defer`, by pass
### Usage

```shell
$ dbt run --select [...] --defer --state path/to/artifacts
$ dbt test --select [...] --defer --state path/to/artifacts
dbt run --select [...] --defer --state path/to/artifacts
dbt test --select [...] --defer --state path/to/artifacts
```


<VersionBlock lastVersion="0.20">

```shell
$ dbt run --models [...] --defer --state path/to/artifacts
$ dbt test --models [...] --defer --state path/to/artifacts
dbt run --models [...] --defer --state path/to/artifacts
dbt test --models [...] --defer --state path/to/artifacts
```

</VersionBlock>
Expand Down Expand Up @@ -101,7 +101,7 @@ I want to test my changes. Nothing exists in my development schema, `dev_alice`.
<TabItem value="no_defer">

```shell
$ dbt run --select model_b
dbt run --select "model_b"
```

<File name='target/run/my_project/model_b.sql'>
Expand All @@ -128,7 +128,7 @@ Unless I had previously run `model_a` into this development environment, `dev_al
<TabItem value="yes_defer">

```shell
$ dbt run --select model_b --defer --state prod-run-artifacts
dbt run --select "model_b" --defer --state prod-run-artifacts
```

<File name='target/run/my_project/model_b.sql'>
Expand Down Expand Up @@ -186,7 +186,7 @@ models:
<TabItem value="no_defer">

```shell
dbt test --select model_b
dbt test --select "model_b"
```

<File name='target/compiled/.../relationships_model_b_id__id__ref_model_a_.sql'>
Expand All @@ -211,7 +211,7 @@ The `relationships` test requires both `model_a` and `model_b`. Because I did no
<TabItem value="yes_defer">

```shell
dbt test --select model_b --defer --state prod-run-artifacts
dbt test --select "model_b" --defer --state prod-run-artifacts
```

<File name='target/compiled/.../relationships_model_b_id__id__ref_model_a_.sql'>
Expand Down
10 changes: 5 additions & 5 deletions website/docs/reference/node-selection/exclude.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ sidebar_label: "Exclude"
dbt provides an `--exclude` flag with the same semantics as `--select`. Models specified with the `--exclude` flag will be removed from the set of models selected with `--select`.

```bash
$ dbt run --select my_package.*+ --exclude my_package.a_big_model+ # select all models in my_package and their children except a_big_model and its children
dbt run --select "my_package".*+ --exclude "my_package.a_big_model+" # select all models in my_package and their children except a_big_model and its children
```

Exclude a specific resource by its name or lineage:

```bash
# test
$ dbt test --exclude not_null_orders_order_id # test all models except the not_null_orders_order_id test
$ dbt test --exclude orders # test all models except tests associated with the orders model
dbt test --exclude "not_null_orders_order_id" # test all models except the not_null_orders_order_id test
dbt test --exclude "orders" # test all models except tests associated with the orders model

# seed
$ dbt seed --exclude account_parent_mappings # load all seeds except account_parent_mappings
dbt seed --exclude "account_parent_mappings" # load all seeds except account_parent_mappings

# snapshot
$ dbt snapshot --exclude snap_order_statuses # execute all snapshots except snap_order_statuses
dbt snapshot --exclude "snap_order_statuses" # execute all snapshots except snap_order_statuses
```
14 changes: 7 additions & 7 deletions website/docs/reference/node-selection/graph-operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ If placed at the front of the model selector, `+` will select all parents of the


```bash
$ dbt run --select my_model+ # select my_model and all children
$ dbt run --select +my_model # select my_model and all parents
$ dbt run --select +my_model+ # select my_model, and all of its parents and children
dbt run --select "my_model+" # select my_model and all children
dbt run --select "+my_model" # select my_model and all parents
dbt run --select "+my_model+" # select my_model, and all of its parents and children
```


Expand All @@ -20,9 +20,9 @@ to step through.


```bash
$ dbt run --select my_model+1 # select my_model and its first-degree children
$ dbt run --select 2+my_model # select my_model, its first-degree parents, and its second-degree parents ("grandparents")
$ dbt run --select 3+my_model+4 # select my_model, its parents up to the 3rd degree, and its children down to the 4th degree
dbt run --select "my_model+1" # select my_model and its first-degree children
dbt run --select "2+my_model" # select my_model, its first-degree parents, and its second-degree parents ("grandparents")
dbt run --select "3+my_model+4" # select my_model, its parents up to the 3rd degree, and its children down to the 4th degree
```


Expand All @@ -32,5 +32,5 @@ The `@` operator is similar to `+`, but will also include _the parents of the ch
<Lightbox src="/img/docs/running-a-dbt-project/command-line-interface/1643e30-Screen_Shot_2019-03-11_at_7.18.20_PM.png" title="@snowplow_web_page_context will select all of the models shown here"/>

```bash
$ dbt run --models @my_model # select my_model, its children, and the parents of its children
dbt run --models @my_model # select my_model, its children, and the parents of its children
```
Loading

0 comments on commit 48e2408

Please sign in to comment.