Skip to content

Commit

Permalink
Merge branch 'current' into mwong-severity
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 authored Nov 14, 2023
2 parents 7891580 + 62f130a commit 4d7a4ed
Show file tree
Hide file tree
Showing 9 changed files with 1,133 additions and 51 deletions.
73 changes: 73 additions & 0 deletions website/blog/2023-11-14-specify-prod-environment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---

title: Why you should specify a production environment in dbt Cloud
description: "The bottom line: You should split your Environments in dbt Cloud based on their purposes (e.g. Production and Staging/CI) and mark one environment as Production. This will improve your CI experience and enable you to use dbt Explorer."
slug: specify-prod-environment

authors: [joel_labes]

tags: [dbt Cloud]
hide_table_of_contents: false

date: 2023-11-14
is_featured: false

---

:::tip The Bottom Line:
You should [split your Jobs](#how) across Environments in dbt Cloud based on their purposes (e.g. Production and Staging/CI) and set one environment as Production. This will improve your CI experience and enable you to use dbt Explorer.
:::

[Environmental segmentation](/docs/environments-in-dbt) has always been an important part of the analytics engineering workflow:

- When developing new models you can [process a smaller subset of your data](/reference/dbt-jinja-functions/target#use-targetname-to-limit-data-in-dev) by using `target.name` or an environment variable.
- By building your production-grade models into [a different schema and database](https://docs.getdbt.com/docs/build/custom-schemas#managing-environments), you can experiment in peace without being worried that your changes will accidentally impact downstream users.
- Using dedicated credentials for production runs, instead of an analytics engineer's individual dev credentials, ensures that things don't break when that long-tenured employee finally hangs up their IDE.

Historically, dbt Cloud required a separate environment for _Development_, but was otherwise unopinionated in how you configured your account. This mostly just worked – as long as you didn't have anything more complex than a CI job mixed in with a couple of production jobs – because important constructs like deferral in CI and documentation were only ever tied to a single job.

But as companies' dbt deployments have grown more complex, it doesn't make sense to assume that a single job is enough anymore. We need to exchange a job-oriented strategy for a more mature and scalable environment-centric view of the world. To support this, a recent change in dbt Cloud enables project administrators to [mark one of their environments as the Production environment](/docs/deploy/deploy-environments#set-as-production-environment-beta), just as has long been possible for the Development environment.

Explicitly separating your Production workloads lets dbt Cloud be smarter with the metadata it creates, and is particularly important for two new features: dbt Explorer and the revised CI workflows.

<!-- truncate -->

## Make sure dbt Explorer always has the freshest information available

**The old way**: Your dbt docs site was based on a single job's run.

**The new way**: dbt Explorer uses metadata from across every invocation in a defined Production environment to build the richest and most up-to-date understanding of your project.

Because dbt docs could only be updated by a single predetermined job, users who needed their documentation to immediately reflect changes deployed throughout the day (regardless of which job executed them) would find themselves forced to run a dedicated job which did nothing other than run `dbt docs generate` on a regular schedule.

The Discovery API that powers dbt Explorer ingests all metadata generated by any dbt invocation, which means that it can always be up to date with the applied state of your project. However it doesn't make sense for dbt Explorer to show docs based on a PR that hasn't been merged yet.

To avoid this conflation, you need to mark an environment as the Production environment. All runs completed in _that_ environment will contribute to dbt Explorer's, while others will be excluded. (Future versions of Explorer will support environment selection, so that you can preview your documentation changes as well.)

## Run Slimmer CI than ever with environment-level deferral

**The old way**: [Slim CI](/guides/set-up-ci?step=2) deferred to a single job, and would only detect changes as of that job's last build time.

**The new way**: Changes are detected regardless of the job they were deployed in, removing false positives and overbuilding of models in CI.

Just like dbt docs, relying on a single job to define your state for comparison purposes leads to a choice between unnecessarily rebuilding models which were deployed by another job, or creating a dedicated job that runs `dbt compile` on repeat to keep on top of all changes.

By using the environment as the arbiter of state, any time a change is made to your Production deployment it will immediately be taken into consideration by subsequent Slim CI runs.

## The easiest way to break apart your jobs {#how}

<Lightbox src="/img/blog/2023-11-06-differentiate-prod-and-staging-environments/data-landscape.png" alt="A chart showing the interplay of Data Warehouse, git repo and dbt Cloud project across Dev, CI and Prod environments." title="Your organization's data landscape should separate Dev, CI and Prod environments. To achieve this, configure your data warehouse, git repo and dbt Cloud account as shown above." width="100%"/>

For most projects, changing from a job-centric to environment-centric approach to metadata is straightforward and immediately pays dividends as described above. Assuming that your Staging/CI and Production jobs are currently intermingled, you can extricate them as follows:

1. Create a new dbt Cloud environment called Staging
2. For each job that belongs to the Staging environment, edit the job and update its environment
3. Tick the ["Mark as Production environment" box](/docs/deploy/deploy-environments#set-as-production-environment-beta) in your original environment's settings

## Conclusion

Until very recently, I only thought of Environments in dbt Cloud as a way to use different authentication credentials in different contexts. And until very recently, I was mostly right.

Not anymore. The metadata dbt creates is critical for effective data teams – whether you're concerned about cost savings, discoverability, increased development speed or reliable results across your organization – but is only fully effective if it's segmented by the environment that created it.

Take a few minutes to clean up your environments - it'll make all the difference.
2 changes: 2 additions & 0 deletions website/blog/categories.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@
display_title: SQL magic
description: Stories of dbt developers making SQL sing across warehouses.
is_featured: true
- name: dbt Cloud
description: Using dbt Cloud to build for scale
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dbt Cloud is [hosted](/docs/cloud/about-cloud/architecture) in multiple regions
| Region | Location | Access URL | IP addresses | Developer plan | Team plan | Enterprise plan |
|--------|----------|------------|--------------|----------------|-----------|-----------------|
| North America multi-tenant [^1] | AWS us-east-1 (N. Virginia) | cloud.getdbt.com | 52.45.144.63 <br /> 54.81.134.249 <br />52.22.161.231 ||||
| North America Cell 1 [^1] | AWS us-east-1 (N.Virginia) | {account prefix}.us1.dbt.com | [Located in Account Settings](#locating-your-dbt-cloud-ip-addresses) ||| |
| North America Cell 1 [^1] | AWS us-east-1 (N.Virginia) | {account prefix}.us1.dbt.com | [Located in Account Settings](#locating-your-dbt-cloud-ip-addresses) ||| |
| EMEA [^1] | AWS eu-central-1 (Frankfurt) | emea.dbt.com | 3.123.45.39 <br /> 3.126.140.248 <br /> 3.72.153.148 ||||
| APAC [^1] | AWS ap-southeast-2 (Sydney)| au.dbt.com | 52.65.89.235 <br /> 3.106.40.33 <br /> 13.239.155.206 <br />||||
| Virtual Private dbt or Single tenant | Customized | Customized | Ask [Support](/community/resources/getting-help#dbt-cloud-support) for your IPs ||||
Expand Down
2 changes: 1 addition & 1 deletion website/docs/reference/artifacts/run-results-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: "Run results JSON file"
sidebar_label: "Run results"
---

**Current schema**: [`v4`](https://schemas.getdbt.com/dbt/run-results/v4/index.html)
**Current schema**: [`v5`](https://schemas.getdbt.com/dbt/run-results/v5/index.html)

**Produced by:**
[`build`](/reference/commands/build)
Expand Down
48 changes: 24 additions & 24 deletions website/docs/reference/resource-configs/enabled.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ default_value: true
}>
<TabItem value="models">

<File name='dbt_project.yml'>

```yml
models:
[<resource-path>](/reference/resource-configs/resource-path):
+enabled: true | false

```

</File>

<File name='models/<modelname>.sql'>

```sql
Expand All @@ -35,10 +46,15 @@ select ...

</File>

</TabItem>


<TabItem value="seeds">

<File name='dbt_project.yml'>

```yml
models:
seeds:
[<resource-path>](/reference/resource-configs/resource-path):
+enabled: true | false

Expand All @@ -48,24 +64,19 @@ models:

</TabItem>


<TabItem value="seeds">
<TabItem value="snapshots">

<File name='dbt_project.yml'>

```yml
seeds:
snapshots:
[<resource-path>](/reference/resource-configs/resource-path):
+enabled: true | false

```

</File>

</TabItem>

<TabItem value="snapshots">

<File name='snapshots/<filename>.sql'>

```sql
Expand All @@ -83,21 +94,21 @@ select ...

</File>

</TabItem>

<TabItem value="tests">

<File name='dbt_project.yml'>

```yml
snapshots:
tests:
[<resource-path>](/reference/resource-configs/resource-path):
+enabled: true | false

```

</File>

</TabItem>

<TabItem value="tests">

<File name='tests/<filename>.sql'>

```sql
Expand Down Expand Up @@ -125,17 +136,6 @@ select ...

</File>

<File name='dbt_project.yml'>

```yml
tests:
[<resource-path>](/reference/resource-configs/resource-path):
+enabled: true | false

```

</File>

</TabItem>

<TabItem value="sources">
Expand Down
41 changes: 24 additions & 17 deletions website/docs/reference/resource-configs/group.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,29 @@ Support for grouping models was added in dbt Core v1.5

<VersionBlock firstVersion="1.5">

<File name='models/schema.yml'>
<File name='dbt_project.yml'>

```yml
version: 2

models:
- name: MODEL_NAME
group: GROUP_NAME

[<resource-path>](resource-path):
+group: GROUP_NAME

```


</File>

<File name='dbt_project.yml'>
<File name='models/schema.yml'>

```yml
version: 2

models:
[<resource-path>](resource-path):
+group: GROUP_NAME
```
- name: MODEL_NAME
group: GROUP

```

</File>

Expand Down Expand Up @@ -277,23 +280,27 @@ Support for grouping semantic models has been added in dbt Core v1.7.

<VersionBlock firstVersion="1.7">

<File name='models/semantic_models.yml'>
<File name='dbt_project.yml'>

```yaml
semantic_models:
- name: SEMANTIC_MODEL_NAME
group: GROUP_NAME

semantic-models:
[<resource-path>](resource-path):
[+](plus-prefix)group: GROUP_NAME

```

</File>

<File name='dbt_project.yml'>
<File name='models/semantic_models.yml'>

```yaml
semantic-models:
[<resource-path>](resource-path):
[+](plus-prefix)group: GROUP_NAME

semantic_models:
- name: SEMANTIC_MODEL_NAME
group: GROUP_NAME


```

</File>
Expand Down
8 changes: 0 additions & 8 deletions website/snippets/core-versions-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,3 @@
| [**v1.0**](/docs/dbt-versions/core-upgrade/upgrading-to-v1.0) ⚠️ | Dec 3, 2021 | Deprecated ⛔️ | Deprecated ⛔️ |
| **v0.X** ⛔️ | (Various dates) | Deprecated ⛔️ | Deprecated ⛔️ |
_*All versions of dbt Core since v1.0 are available in dbt Cloud until further notice. Versions that are EOL do not receive any fixes. For the best support, we recommend upgrading to a version released within the past 12 months._
### Planned future releases

_Future release dates are tentative and subject to change._

| dbt Core | Planned Release | Critical & dbt Cloud Support Until |
|----------|-----------------|-------------------------------------|
| **v1.8** | _Jan 2024_ | _Jan 2025_ |
| **v1.9** | _Apr 2024_ | _Apr 2025_ |
Loading

0 comments on commit 4d7a4ed

Please sign in to comment.