From bef107265b603f2e02bab489a8b5de8873d0cb46 Mon Sep 17 00:00:00 2001
From: Teghan Nightengale <tnightengale@gmail.com>
Date: Sun, 19 May 2024 23:00:15 -0400
Subject: [PATCH] feat: add callable where clause in union_relations

---
 macros/sql/union.sql | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/macros/sql/union.sql b/macros/sql/union.sql
index ac289e2f..d653179d 100644
--- a/macros/sql/union.sql
+++ b/macros/sql/union.sql
@@ -114,7 +114,10 @@
 
             from {{ relation }}
 
-            {% if where -%}
+            {% if where is callable -%}
+            {# Allows possibility of customizing where clause by relation, eg. in incremental runs. #}
+            {{ where(relation) }} 
+            {% elif where -%}
             where {{ where }}
             {%- endif %}
         )