Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
User-defined custom incremental strategies (#4716)
[Preview](https://docs-getdbt-com-git-dbeatty-custom-incremental-d92d96-dbt-labs.vercel.app/docs/build/incremental-models#custom-strategies) ## What are you changing in this pull request and why? This addresses the "**For end users**" portion of #1761. The feature request in dbt-labs/dbt-core#5245 describes the value proposition as well as the previous and new behavior: #### Functional Requirement - Advanced users that wish to specify a custom incremental strategy must be able to do so. #### Previous behavior - Advanced dbt users who wished to specify a custom incremental strategy must override the same boilerplate Jinja macro by copy pasting it into their dbt project. #### New behavior - Advanced dbt users who wish to specify a custom incremental strategy will only need to create a macro that conforms to the naming convention `get_incremental_NAME_sql` that produces the correct SQL for the target warehouse. ## Also To address the questions raised in dbt-labs/dbt-core#8769, we also want to document how to utilize custom incremental macros that come from a package. For example, to use the `merge_null_safe` custom incremental strategy from the `example` package, first [install the package](/build/packages#how-do-i-add-a-package-to-my-project), then add this macro to your project: ```sql {% macro get_incremental_merge_null_safe_sql(arg_dict) %} {% do return(example.get_incremental_merge_null_safe_sql(arg_dict)) %} {% endmacro %} ``` ## 🎩 <img width="503" alt="image" src="https://github.com/dbt-labs/docs.getdbt.com/assets/44704949/51c3266e-e3fb-49bd-9428-7c43920a5412"> ## Checklist - [x] Review 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. - [x] For [docs versioning](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#about-versioning), review how to [version a whole page](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#adding-a-new-version) and [version a block of content](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-blocks-of-content).
- Loading branch information