-
Notifications
You must be signed in to change notification settings - Fork 966
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created new section called Parallel batch execution (#6589)
## What are you changing in this pull request and why? I have created this PR following this Git issue: #6550 for Parallel batch execution ## Checklist - [ ] I have reviewed the [Content style guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md) so my content adheres to these guidelines. - [ ] The topic I'm writing about is for specific dbt version(s) and I have versioned it according to the [version a whole page](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#adding-a-new-version) and/or [version a block of content](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-blocks-of-content) guidelines. - [ ] I have added checklist item(s) to this list for anything anything that needs to happen before this PR is merged, such as "needs technical review" or "change base branch." - [ ] The content in this PR requires a dbt release note, so I added one to the [release notes page](https://docs.getdbt.com/docs/dbt-versions/dbt-cloud-release-notes). <!-- PRE-RELEASE VERSION OF dbt (if so, uncomment): - [ ] Add a note to the prerelease version [Migration Guide](https://github.com/dbt-labs/docs.getdbt.com/tree/current/website/docs/docs/dbt-versions/core-upgrade) --> <!-- ADDING OR REMOVING PAGES (if so, uncomment): - [ ] Add/remove page in `website/sidebars.js` - [ ] Provide a unique filename for new pages - [ ] Add an entry for deleted pages in `website/vercel.json` - [ ] Run link testing locally with `npm run build` to update the links that point to deleted pages --> <!-- vercel-deployment-preview --> --- 🚀 Deployment available! Here are the direct links to the updated files: - https://docs-getdbt-com-git-nfiann-rbip-dbt-labs.vercel.app/docs/build/incremental-microbatch - https://docs-getdbt-com-git-nfiann-rbip-dbt-labs.vercel.app/docs/dbt-versions/core-upgrade/06-upgrading-to-v1.9 - https://docs-getdbt-com-git-nfiann-rbip-dbt-labs.vercel.app/reference/resource-properties/concurrent_batches <!-- end-vercel-deployment-preview --> --------- Co-authored-by: Mirna Wong <[email protected]> Co-authored-by: Quigley Malcolm <[email protected]> Co-authored-by: Leona B. Campbell <[email protected]>
- Loading branch information
1 parent
2c538a6
commit 0cb8e68
Showing
4 changed files
with
225 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
website/docs/reference/resource-properties/concurrent_batches.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
title: "concurrent_batches" | ||
resource_types: [models] | ||
datatype: model_name | ||
description: "Learn about concurrent_batches in dbt." | ||
--- | ||
|
||
:::note | ||
|
||
Available in dbt Core v1.9+ or the [dbt Cloud "Latest" release tracks](/docs/dbt-versions/cloud-release-tracks). | ||
|
||
::: | ||
|
||
<Tabs> | ||
<TabItem value="Project file"> | ||
|
||
|
||
<File name='dbt_project.yml'> | ||
|
||
```yaml | ||
models: | ||
+concurrent_batches: true | ||
``` | ||
</File> | ||
</TabItem> | ||
<TabItem value="sql file"> | ||
<File name='models/my_model.sql'> | ||
```sql | ||
{{ | ||
config( | ||
materialized='incremental', | ||
concurrent_batches=true, | ||
incremental_strategy='microbatch' | ||
... | ||
) | ||
}} | ||
select ... | ||
``` | ||
|
||
</File> | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
## Definition | ||
|
||
`concurrent_batches` is an override which allows you to decide whether or not you want to run batches in parallel or sequentially (one at a time). | ||
|
||
For more information, refer to [how batch execution works](/docs/build/incremental-microbatch#how-parallel-batch-execution-works). | ||
## Example | ||
|
||
By default, dbt auto-detects whether batches can run in parallel for microbatch models. However, you can override dbt's detection by setting the `concurrent_batches` config to `false` in your `dbt_project.yml` or model `.sql` file to specify parallel or sequential execution, given you meet these conditions: | ||
* You've configured a microbatch incremental strategy. | ||
* You're working with cumulative metrics or any logic that depends on batch order. | ||
|
||
Set `concurrent_batches` config to `false` to ensure batches are processed sequentially. For example: | ||
|
||
<File name='dbt_project.yml'> | ||
|
||
```yaml | ||
models: | ||
my_project: | ||
cumulative_metrics_model: | ||
+concurrent_batches: false | ||
``` | ||
</File> | ||
<File name='models/my_model.sql'> | ||
```sql | ||
{{ | ||
config( | ||
materialized='incremental', | ||
incremental_strategy='microbatch' | ||
concurrent_batches=false | ||
) | ||
}} | ||
select ... | ||
|
||
``` | ||
</File> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters