Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move configs to models subfolder #6868

Merged
merged 14 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 65 additions & 4 deletions website/docs/reference/model-configs.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,35 @@ import ConfigGeneral from '/snippets/_config-description-general.md';

<File name='dbt_project.yml'>

<VersionBlock lastVersion="1.8">

```yaml
models:
[<resource-path>](/reference/resource-configs/resource-path):
[+](/reference/resource-configs/plus-prefix)[materialized](/reference/resource-configs/materialized): <materialization_name>
[+](/reference/resource-configs/plus-prefix)[sql_header](/reference/resource-configs/sql_header): <string>
[+](/reference/resource-configs/plus-prefix)[on_configuration_change](/reference/resource-configs/on_configuration_change): apply | continue | fail #only for materialized views on supported adapters
[+](/reference/resource-configs/plus-prefix)[on_configuration_change](/reference/resource-configs/on_configuration_change): apply | continue | fail # Only for materialized views on supported adapters
[+](/reference/resource-configs/plus-prefix)[unique_key](/reference/resource-configs/unique_key): <column_name_or_expression>

```

</VersionBlock>

<VersionBlock firstVersion="1.9">

```yaml
models:
[<resource-path>](/reference/resource-configs/resource-path):
[+](/reference/resource-configs/plus-prefix)[materialized](/reference/resource-configs/materialized): <materialization_name>
[+](/reference/resource-configs/plus-prefix)[sql_header](/reference/resource-configs/sql_header): <string>
[+](/reference/resource-configs/plus-prefix)[on_configuration_change](/reference/resource-configs/on_configuration_change): apply | continue | fail # Only for materialized views on supported adapters
[+](/reference/resource-configs/plus-prefix)[unique_key](/reference/resource-configs/unique_key): <column_name_or_expression>
[+](/reference/resource-configs/plus-prefix)[batch_size](/reference/resource-configs/batch-size): day | hour | month | year
[+](/reference/resource-configs/plus-prefix)[begin](/reference/resource-configs/begin): "<ISO formatted date or datetime (like, "2024-01-15T12:00:00Z")>"
[+](/reference/resource-configs/plus-prefix)[lookback](/reference/resource-configs/lookback): <integer>
[+](/reference/resource-configs/plus-prefix)[concurrent_batches](/reference/resource-properties/concurrent_batches): true | false
```

</VersionBlock>
</File>

</TabItem>
Expand All @@ -50,6 +68,8 @@ models:

<File name='models/properties.yml'>

<VersionBlock lastVersion="1.8">

```yaml
version: 2

Expand All @@ -58,20 +78,41 @@ models:
config:
[materialized](/reference/resource-configs/materialized): <materialization_name>
[sql_header](/reference/resource-configs/sql_header): <string>
[on_configuration_change](/reference/resource-configs/on_configuration_change): apply | continue | fail #only for materialized views on supported adapters
[on_configuration_change](/reference/resource-configs/on_configuration_change): apply | continue | fail # Only for materialized views on supported adapters
[unique_key](/reference/resource-configs/unique_key): <column_name_or_expression>

```
</VersionBlock>

<VersionBlock firstVersion="1.9">

```yaml
version: 2

models:
- name: [<model-name>]
config:
[materialized](/reference/resource-configs/materialized): <materialization_name>
[sql_header](/reference/resource-configs/sql_header): <string>
[on_configuration_change](/reference/resource-configs/on_configuration_change): apply | continue | fail # Only for materialized views on supported adapters
[unique_key](/reference/resource-configs/unique_key): <column_name_or_expression>
[batch_size](/reference/resource-configs/batch-size): day | hour | month | year
[begin](/reference/resource-configs/begin): "<ISO formatted date or datetime (like, "2024-01-15T12:00:00Z")>"
[lookback](/reference/resource-configs/lookback): <integer>
[concurrent_batches](/reference/resource-properties/concurrent_batches): true | false

```
</VersionBlock>
</File>

</TabItem>


<TabItem value="config">

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

<VersionBlock lastVersion="1.8">

```sql

{{ config(
Expand All @@ -82,6 +123,26 @@ models:
) }}

```
</VersionBlock>

<VersionBlock firstVersion="1.9">

```sql

{{ config(
[materialized](/reference/resource-configs/materialized)="<materialization_name>",
[sql_header](/reference/resource-configs/sql_header)="<string>"
[on_configuration_change](/reference/resource-configs/on_configuration_change): apply | continue | fail # Only for materialized views for supported adapters
[unique_key](/reference/resource-configs/unique_key)='column_name_or_expression'
[batch_size](/reference/resource-configs/batch-size)='day' | 'hour' | 'month' | 'year'
[begin](/reference/resource-configs/begin)="<ISO formatted date or datetime (like, "2024-01-15T12:00:00Z")>"
[lookback](/reference/resource-configs/lookback)= <integer>
[concurrent_batches](/reference/resource-properties/concurrent_batches)= true | false
) }}

```

</VersionBlock>

</File>

Expand Down
2 changes: 1 addition & 1 deletion website/docs/reference/resource-configs/batch_size.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ datatype: hour | day | month | year

## Definition

The`batch_size` config determines how large batches are when running a microbatch. Accepted values are `hour`, `day`, `month`, or `year`. You can configure `batch_size` for a [model](/docs/build/models) in your `dbt_project.yml` file, property YAML file, or config block.
The `batch_size` config determines how large batches are when running a [microbatch incremental model](/docs/build/incremental-microbatch). Accepted values are `hour`, `day`, `month`, or `year`. You can configure `batch_size` for a [model](/docs/build/models) in your `dbt_project.yml` file, property YAML file, or config block.

## Examples

Expand Down
2 changes: 1 addition & 1 deletion website/docs/reference/resource-configs/begin.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ datatype: string

## Definition

Set the `begin` config to the timestamp value at which your microbatch model data should begin &mdash; at the point the data becomes relevant for the microbatch model. You can configure `begin` for a [model](/docs/build/models) in your `dbt_project.yml` file, property YAML file, or config block. The value for `begin` must be a string representing an ISO formatted date OR date and time.
Set the `begin` config to the timestamp value at which your [microbatch incremental model](/docs/build/incremental-microbatch) data should begin &mdash; at the point the data becomes relevant for the microbatch model. You can configure `begin` for a [model](/docs/build/models) in your `dbt_project.yml` file, property YAML file, or config block. The value for `begin` must be a string representing an ISO-formatted date _or_ date and time.

## Examples

Expand Down
6 changes: 4 additions & 2 deletions website/docs/reference/resource-configs/lookback.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ title: "lookback"
id: "lookback"
sidebar_label: "lookback"
resource_types: [models]
description: "dbt uses `lookback` to detrmine how many 'batches' of `batch_size` to reprocesses when a microbatch incremental model is running incrementally."
description: "Configure `lookback` to determine how many 'batches' of `batch_size` to reprocess when a dbt microbatch incremental model runs incrementally"
datatype: int
---

<VersionCallout version="1.9" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't need to be addressed with this PR but this renders as "Available from dbt v1.9 or with the dbt Cloud "Latest" release track" but the "Compatible" release track is v1.9, so wouldn't it be available there too? Maybe I'm overanalyzing, but it seems confusing

Suggested change
<VersionCallout version="1.9" />
<VersionCallout version="1.9" />

## Definition

Set the `lookback` to an integer greater than or equal to zero. The default value is `1`. You can configure `lookback` for a [model](/docs/build/models) in your `dbt_project.yml` file, property YAML file, or config block.
Configure a `lookback` window to reprocess additional batches during [microbatch incremental model](/docs/build/incremental-microbatch) runs. It processes X batches up to the latest bookmark (the last successfully processed data point) to capture late-arriving records.

Set the `lookback` to an integer greater than or equal to zero. The default value is `1`. You can configure `lookback` for a [microbatch incremental model](/docs/build/incremental-microbatch) in your `dbt_project.yml` file, property YAML file, or config block.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe nitpicking but this section doesn't actually define what "lookback" is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah i didn't write this and i think it was merged in this pr that you worked with Quigley on but i'm happy to define it in this pr

Copy link
Contributor Author

@mirnawong1 mirnawong1 Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will add:

Configure a lookback window to reprocess additional batches during microbatch incremental model runs. It processes X batches up to the latest bookmark (the last successfully processed data point) to capture late-arriving records.

Set the lookback to an integer greater than or equal to zero. The default value is 1. You can configure lookback for a microbatch incremental model n your dbt_project.yml file, property YAML file, or config block.


## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ models:
</TabItem>


<TabItem value="sql file">
<TabItem value="Config block">

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

Expand Down Expand Up @@ -52,7 +52,7 @@ For more information, refer to [how batch execution works](/docs/build/increment
## 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've configured a [microbatch incremental strategy](/docs/build/incremental-microbatch).
* 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:
Expand Down
8 changes: 4 additions & 4 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -934,8 +934,6 @@ const sidebarSettings = {
"reference/advanced-config-usage",
"reference/resource-configs/access",
"reference/resource-configs/alias",
"reference/resource-configs/batch-size",
"reference/resource-configs/begin",
"reference/resource-configs/contract",
"reference/resource-configs/database",
"reference/resource-configs/docs",
Expand All @@ -944,7 +942,6 @@ const sidebarSettings = {
"reference/resource-configs/full_refresh",
"reference/resource-configs/grants",
"reference/resource-configs/group",
"reference/resource-configs/lookback",
"reference/resource-configs/meta",
"reference/resource-configs/persist_docs",
"reference/resource-configs/plus-prefix",
Expand All @@ -959,10 +956,13 @@ const sidebarSettings = {
label: "For models",
items: [
"reference/model-properties",
"reference/resource-properties/model_name",
"reference/model-configs",
"reference/resource-configs/batch-size",
"reference/resource-configs/begin",
"reference/resource-properties/concurrent_batches",
"reference/resource-configs/lookback",
"reference/resource-configs/materialized",
"reference/resource-properties/model_name",
"reference/resource-configs/on_configuration_change",
"reference/resource-configs/sql_header",
],
Expand Down
Loading