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

Understand the is_incremental() macro -- Remove one of the conditions? #5279

Closed
1 task done
ialdg opened this issue Apr 13, 2024 · 1 comment
Closed
1 task done
Labels
community Contributions from the dbt community content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear

Comments

@ialdg
Copy link
Contributor

ialdg commented Apr 13, 2024

Contributions

  • I have read the contribution docs, and understand what's expected of me.

Link to the page on docs.getdbt.com requiring updates

https://docs.getdbt.com/docs/build/incremental-models#understand-the-is_incremental-macro

What part(s) of the page would you like to see updated?

Hi. At the previous link there're four conditions to meet for the macro is_incremental() to return a True value:

  1. The model must already exist in the database
  2. The destination table already exists in the database
  3. The full-refresh flag is not passed
  4. The running model is configured with materialized='incremental'

Of the four, everytime I read them, the first two striked me as redundant but, since perhaps I didn't know enought about it, I let it go. However, reading the documentation at the following link:
https://docs.getdbt.com/best-practices/materializations/4-incremental-models#incremental-conditions
, I realised that my idea might be right (there are just three conditions, not four), that is, I think that perhaps bulletpoint 1 should be removed because, what does it mean that the model already exists in the database? As far as I know, in no database there are models, but tables or views, right?
Regards.
IL.

Additional information

No response

@ialdg ialdg added content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear labels Apr 13, 2024
@matthewshaver matthewshaver added the community Contributions from the dbt community label Dec 9, 2024
matthewshaver pushed a commit that referenced this issue Jan 8, 2025
update conditions for is_incremental() to evaluate to true based on
Issue 5279

## What are you changing in this pull request and why?
<!--
Describe your changes and why you're making them. If related to an open
issue or a pull request on dbt Core or another repository, then link to
them here!

To learn more about the writing conventions used in the dbt Labs docs,
see the [Content style
guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md).
-->
This update is to address [Issue 5279 - Understand the is_incremental()
macro](#5279)

I believe the original intent of the first two conditions was to say:
"the model has to exist as a table" however saying this using two lines
feels redundant and I know from training sessions that users react much
the same way as the author of this issue.

I'm proposing the following wording:

Revised

The `is_incremental()` macro powers incremental materializations. It
will return `True` if _all_ of the following conditions are met:

- The model must already exist _as a table_ in the database
- The `full-refresh` flag _is not_ passed
- The running model is configured with `materialized='incremental'`

Original (for reference)

The `is_incremental()` macro powers incremental materializations. It
will return `True` if _all_ of the following conditions are met:

- The model must already exist in the database
- The destination table already exists in the database
- The `full-refresh` flag _is not_ passed
- The running model is configured with `materialized='incremental'`

## Checklist
- [x] 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-datapackdan-patch-issue-5279-dbt-labs.vercel.app/docs/build/incremental-models

<!-- end-vercel-deployment-preview -->
@runleonarun
Copy link
Collaborator

Closed by #6739

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Contributions from the dbt community content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants