Skip to content

Commit

Permalink
Simplify the example for get_where_subquery
Browse files Browse the repository at this point in the history
  • Loading branch information
dbeatty10 authored Jul 7, 2023
1 parent 584d43d commit 463f0f5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions website/docs/reference/resource-configs/where.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ models:

```sql
{% macro get_where_subquery(relation) -%}
{% set where = config.get('where', '') %}
{% if where and "__three_days_ago__" in where %}
{# replace placeholder string with result of custom macro #}
{% set three_days_ago = dbt.dateadd('day', -3, current_timestamp()) %}
{% set where = where | replace("__three_days_ago__", three_days_ago) %}
{% endif %}
{% set where = config.get('where') %}
{% if where %}
{% if "__three_days_ago__" in where %}
{# replace placeholder string with result of custom macro #}
{% set three_days_ago = dbt.dateadd('day', -3, current_timestamp()) %}
{% set where = where | replace("__three_days_ago__", three_days_ago) %}
{% endif %}
{%- set filtered -%}
(select * from {{ relation }} where {{ where }}) dbt_subquery
{%- endset -%}
Expand Down

0 comments on commit 463f0f5

Please sign in to comment.