Skip to content

Commit

Permalink
add defer page to cloud develop docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-connors-3 committed Oct 5, 2023
1 parent cfd8ea1 commit 4f895d5
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
42 changes: 42 additions & 0 deletions website/docs/docs/cloud/about-cloud-develop-defer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: Using defer in dbt Cloud
id: about-cloud-develop-defer
description: "Learn how to leverage defer to prod when developing with dbt Cloud."
sidebar_label: "Using defer in dbt Cloud"
pagination_next: "docs/cloud/cloud-cli-installation"
---


[Defer](/reference/node-selection/defer) is a powerful feature that allows developers to only build and run and test models they've edited without having to first run and build these models' upstream parents. This is powered by having a production manifest to compare to, and dbt will resolve the `{{ ref() }}` function with upstream production artifacts.

This comment has been minimized.

Copy link
@mirnawong1

mirnawong1 Oct 6, 2023

Contributor

i can't do a 'sugg' but do you mean having to run ALL models? just suggestion:

Defer is a powerful feature that allows developers to only build and run and test models they've edited without having to first run and build all the models that come before them (upstream parents). This is powered by using a production manifest for comparison, and dbt will fill in the {{ ref() }} function with upstream production artifacts.


Both the dbt Cloud IDE and the dbt Cloud CLI allow users to natively defer to production metadata directly in their development workflows, dramatically reducing development time and warehouse spend by preventing unecessary model builds.

This comment has been minimized.

Copy link
@mirnawong1

mirnawong1 Oct 6, 2023

Contributor

🔥


## Required setup

Set your production environment using the [production environment checkbox](/docs/deploy/deploy-environments#set-as-production-environment-beta) in the environment settings page. This can be set for one deployment environment per dbt Cloud project. When using defer, the artifacts from the latest successful, non-CI job execution in the production environment will be compared to.

This comment has been minimized.

Copy link
@mirnawong1

mirnawong1 Oct 6, 2023

Contributor

the prod env must be set right? it doesn't work if you have a dev env only?


### Defer in the IDE

Defer in the IDE is as simple as toggling the `Defer to production` switch on the command bar! When enabled, dbt Cloud will:

1. Pull down the most recent manifest from the Production environment for comparison
2. Pass the `--defer` flag to the command (for any command that accepts the flag)

This comment has been minimized.

Copy link
@mirnawong1

mirnawong1 Oct 6, 2023

Contributor

example? and we dont have a list of commands that accepts xyz flag but its an issue we're going to work on! #4206


For example, if you were to start developing with on a new branch with [nothing in your development schema](/reference/node-selection/defer#usage), make an edit to a single model, and run `dbt build -s state:modified` you would see *just* that model run, with any ` {{ ref() }}` functions resolve to the production location of the reffed models!

### Defer in dbt Cloud CLI

One key difference between using `--defer` in the Cloud CLI vs the IDE is that defer is *automatically on by default for all invocations*, using artifacts from your production evironment to compare. You can pass the `--no-defer` flag to your dbt command to disable this behavior. This flag is unique to the dbt Cloud CLI only.

Cloud CLI offers additional flexibility for declaring which environment is used as the source of deferral artifacts. You can set a `defer-env-id` key in either your `dbt_project.yml` file or your `dbt_cloud.yml` file.

```yml
# in dbt_cloud.yml
dever-env-id: '123456'
```
```yml
# in dbt_project.yml
dbt_cloud:
dever-env-id: '123456'
```
2 changes: 1 addition & 1 deletion website/docs/docs/cloud/about-cloud-develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: About developing in dbt Cloud
id: about-cloud-develop
description: "Learn how to develop your dbt projects using dbt Cloud."
sidebar_label: "About developing in dbt Cloud"
pagination_next: "docs/cloud/cloud-cli-installation"
pagination_next: "docs/cloud/about-cloud-develop-defer"
---

dbt Cloud offers a fast and reliable way to work on your dbt project. You can use it through an integrated development environment (IDE) in your browser or a dbt Cloud-powered command line interface (CLI):
Expand Down
1 change: 1 addition & 0 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ const sidebarSettings = {
link: { type: "doc", id: "docs/cloud/about-cloud-develop" },
items: [
"docs/cloud/about-cloud-develop",
"docs/cloud/about-cloud-develop-defer",
{
type: "category",
label: "dbt Cloud CLI (beta)",
Expand Down

0 comments on commit 4f895d5

Please sign in to comment.