From b1e96a29955a9341bdcf21810ecd7d2c6396df70 Mon Sep 17 00:00:00 2001 From: Daniel Pollak Date: Thu, 25 Jul 2024 21:19:50 +0300 Subject: [PATCH] add until param --- macros/commands/dump_table.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/macros/commands/dump_table.sql b/macros/commands/dump_table.sql index fcd1eee9e..0bd6c5d96 100644 --- a/macros/commands/dump_table.sql +++ b/macros/commands/dump_table.sql @@ -1,4 +1,4 @@ -{% macro dump_table(model_unique_id, output_path, exclude_deprecated_columns=true, timestamp_column=none, since=none, days_back=7, dedup=false) %} +{% macro dump_table(model_unique_id, output_path, exclude_deprecated_columns=true, timestamp_column=none, since=none, days_back=7, dedup=false, until=none) %} {% set node = graph.nodes.get(model_unique_id) %} {% if not node %} {% do print("Node '{}' does not exist.".format(model_unique_id)) %} @@ -28,6 +28,9 @@ {% if timestamp_column %} {% if since %} where {{ elementary.edr_cast_as_timestamp(timestamp_column) }} > {{ elementary.edr_cast_as_timestamp(elementary.edr_quote(since)) }} + {% if until %} + and {{ elementary.edr_cast_as_timestamp(timestamp_column) }} <= {{ elementary.edr_cast_as_timestamp(elementary.edr_quote(until)) }} + {% endif %} {% else %} where {{ elementary.edr_datediff(elementary.edr_cast_as_timestamp(timestamp_column), elementary.edr_current_timestamp(), 'day') }} < {{ days_back }} {% endif %}