Skip to content

Commit

Permalink
Add is_incremental() as another case when you will need to force de…
Browse files Browse the repository at this point in the history
…pendencies (#5550)

[Preview](https://docs-getdbt-com-git-dbeatty10-patch-1-dbt-labs.vercel.app/reference/dbt-jinja-functions/ref#forcing-dependencies)

## What are you changing in this pull request and why?

Resolves #5547

## 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.
  • Loading branch information
dbeatty10 authored May 22, 2024
1 parent 4c54424 commit 9dc6e30
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions website/docs/reference/dbt-jinja-functions/ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,13 @@ In normal usage, dbt knows the proper order to run all models based on the usage
```

dbt will see the `ref` and build this model after the specified reference.

Another example is when a reference appears within an [`is_incremental()`](/docs/build/incremental-models#understand-the-is_incremental-macro) conditional block. This is because the `is_incremental()` macro will always return `false` at parse time, so any references within it can't be inferred. To handle this, you can use a SQL comment outside of the `is_incremental()` conditional:

```sql
-- depends_on: {{ source('raw', 'orders') }}

{% if is_incremental() %}
select * from {{ source('raw', 'orders') }}
{% endif %}
```

0 comments on commit 9dc6e30

Please sign in to comment.