Skip to content

Commit

Permalink
remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mattromano committed Dec 19, 2024
1 parent b53d304 commit 02770d7
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions macros/tests/dynamic_tests.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
{% macro get_where_subquery(relation) -%}
{%- set where = config.get('where') -%}

{# Declare variables at the top level of the macro #}
{%- set interval_vars = namespace(
interval_type = none,
interval_value = none
) -%}

{# Check if any interval variables are set #}
{% set intervals = {
'minutes': var('minutes', none),
'hours': var('hours', none),
Expand All @@ -29,27 +27,23 @@
{% do return(relation) %}
{% endif %}

{# Initialize namespaces at the top of the macro #}
{%- set ts_vars = namespace(
timestamp_column = none,
filter_condition = none
) -%}

{% if where %}
{% if "__timestamp_filter__" in where %}
{# Get the appropriate timestamp column if none provided #}
{% set columns = adapter.get_columns_in_relation(relation) %}
{% set column_names = columns | map(attribute='name') | list %}

{# Check for MODIFIED_TIMESTAMP first #}
{% for column in columns %}
{% if column.name == 'MODIFIED_TIMESTAMP' %}
{% set ts_vars.timestamp_column = 'MODIFIED_TIMESTAMP' %}
{% break %}
{% endif %}
{% endfor %}

{# If no MODIFIED_TIMESTAMP, check for _INSERTED_TIMESTAMP #}
{% if not ts_vars.timestamp_column %}
{% for column in columns %}
{% if column.name == '_INSERTED_TIMESTAMP' %}
Expand All @@ -59,7 +53,6 @@
{% endfor %}
{% endif %}

{# If still no timestamp, check for BLOCK_TIMESTAMP #}
{% if not ts_vars.timestamp_column %}
{% for column in columns %}
{% if column.name == 'BLOCK_TIMESTAMP' %}
Expand Down

0 comments on commit 02770d7

Please sign in to comment.