From 92125a1e551d6daa08e4bf4fd76cfa399255cc7e Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Thu, 9 Nov 2023 11:30:47 -0800
Subject: [PATCH 01/54] use branch of fivetran utils

---
 packages.yml | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/packages.yml b/packages.yml
index c71e87a5..f49a46c0 100644
--- a/packages.yml
+++ b/packages.yml
@@ -1,6 +1,9 @@
 packages:
-- package: fivetran/fivetran_utils
-  version: [">=0.4.0", "<0.5.0"]
-
+# - package: fivetran/fivetran_utils
+#   version: [">=0.4.0", "<0.5.0"]
+- git: https://github.com/fivetran/dbt_fivetran_utils.git
+  revision: feature/sql-server-compatibility
+  warn-unpinned: false
+  
 - package: dbt-labs/spark_utils
-  version: [">=0.3.0", "<0.4.0"]
+  version: [">=0.3.0", "<0.4.0"]
\ No newline at end of file

From 090228adde725c851dc40a87a187115b0e6b67fb Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Mon, 20 Nov 2023 13:31:44 -0800
Subject: [PATCH 02/54] not working yet

---
 macros/get_brand_columns.sql                  |  4 +-
 models/fivetran_platform__audit_table.sql     | 16 ++++++--
 ...fivetran_platform__audit_user_activity.sql | 11 ++++-
 ...etran_platform__connector_daily_events.sql | 14 ++++---
 .../fivetran_platform__connector_status.sql   | 41 ++++++++++++++-----
 .../fivetran_platform__mar_table_history.sql  |  6 ++-
 .../fivetran_platform__schema_changelog.sql   |  7 +++-
 ...latform__usage_mar_destination_history.sql |  8 ++--
 packages.yml                                  |  3 ++
 9 files changed, 80 insertions(+), 30 deletions(-)

diff --git a/macros/get_brand_columns.sql b/macros/get_brand_columns.sql
index 65ec9ef6..2e028ae8 100644
--- a/macros/get_brand_columns.sql
+++ b/macros/get_brand_columns.sql
@@ -1,7 +1,7 @@
 {% macro get_connector_columns() %}
 
 {% set columns = [
-    {"name": "_fivetran_deleted", "datatype": "boolean"},
+    {"name": "_fivetran_deleted", "datatype": dbt.type_boolean()},
     {"name": "_fivetran_synced", "datatype": dbt.type_timestamp()},
     {"name": "connecting_user_id", "datatype": dbt.type_string()},
     {"name": "connector_id", "datatype": dbt.type_string()},
@@ -9,7 +9,7 @@
     {"name": "connector_type", "datatype": dbt.type_string()},
     {"name": "connector_type_id", "datatype": dbt.type_string()},
     {"name": "destination_id", "datatype": dbt.type_string()},
-    {"name": "paused", "datatype": "boolean"},
+    {"name": "paused", "datatype": dbt.type_boolean()},
     {"name": "service_version", "datatype": dbt.type_int()},
     {"name": "signed_up", "datatype": dbt.type_timestamp()}
 ] %}
diff --git a/models/fivetran_platform__audit_table.sql b/models/fivetran_platform__audit_table.sql
index 08e397c1..82443cfa 100644
--- a/models/fivetran_platform__audit_table.sql
+++ b/models/fivetran_platform__audit_table.sql
@@ -22,7 +22,7 @@ with sync_log as (
 
     -- Capture the latest timestamp in a call statement instead of a subquery for optimizing BQ costs on incremental runs
     {%- call statement('max_sync_start', fetch_result=True) -%}
-        select date(max(sync_start)) from {{ this }}
+        select cast(max(sync_start) as date) from {{ this }}
     {%- endcall -%}
 
     -- load the result from the above query into a new variable
@@ -32,7 +32,7 @@ with sync_log as (
     {%- set max_sync_start = query_result['data'][0][0] -%}
 
     -- compare the new batch of data to the latest sync already stored in this model
-    and date(created_at) > '{{ max_sync_start }}'
+    and case(created_at as date) > '{{ max_sync_start }}'
 
     {% endif %}
 ),
@@ -127,7 +127,17 @@ sum_records_modified as (
         and records_modified_log.created_at > limit_to_table_starts.sync_start 
         and records_modified_log.created_at < coalesce(limit_to_table_starts.sync_end, limit_to_table_starts.next_sync_start) 
 
-    {{ dbt_utils.group_by(n=10) }}
+    group by 
+        limit_to_table_starts.connector_id,
+        limit_to_table_starts.connector_name,
+        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name),
+        limit_to_table_starts.table_name,
+        limit_to_table_starts.destination_id,
+        limit_to_table_starts.destination_name,
+        limit_to_table_starts.write_to_table_start,
+        limit_to_table_starts.write_to_table_end,
+        limit_to_table_starts.sync_start,
+        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end
 ),
 
 final as (
diff --git a/models/fivetran_platform__audit_user_activity.sql b/models/fivetran_platform__audit_user_activity.sql
index 2aadf5de..8db0fefb 100644
--- a/models/fivetran_platform__audit_user_activity.sql
+++ b/models/fivetran_platform__audit_user_activity.sql
@@ -47,8 +47,15 @@ final as (
 
     select
         {{ dbt.date_trunc('day', 'user_logs.created_at') }} as date_day,
-        {{ dbt_date.day_name('user_logs.created_at') }} as day_name,
-        {{ dbt_date.day_of_month('user_logs.created_at') }} as day_of_month,
+        
+        {% if target.type != 'sqlserver' -%}
+            {{ dbt_date.day_name('user_logs.created_at') }} as day_name,
+            {{ dbt_date.day_of_month('user_logs.created_at') }} as day_of_month,
+        {% else -%} 
+            format(cast(user_logs.created_at as date), 'ddd') as day_name,
+            day(user_logs.created_at) as day_of_month,
+        {% endif -%} 
+        
         user_logs.created_at as occurred_at,
         destination.destination_name,
         destination.destination_id,
diff --git a/models/fivetran_platform__connector_daily_events.sql b/models/fivetran_platform__connector_daily_events.sql
index b6adcfb9..71362659 100644
--- a/models/fivetran_platform__connector_daily_events.sql
+++ b/models/fivetran_platform__connector_daily_events.sql
@@ -27,7 +27,7 @@ log_events as (
                             
         and connector_id is not null
 
-    group by 1,2,3
+    group by connector_id, date_day, event_subtype
 ),
 
 pivot_out_events as (
@@ -40,7 +40,7 @@ pivot_out_events as (
         max(case when event_subtype = 'schema_change' then count_events else 0 end) as count_schema_changes
 
     from log_events
-    group by 1,2
+    group by connector_id, date_day
 ),
 
 connector_event_counts as (
@@ -75,7 +75,7 @@ spine as (
     {{ dbt_utils.date_spine(
         datepart = "day", 
         start_date =  "cast('" ~ first_date[0:10] ~ "' as date)", 
-        end_date = dbt.dateadd("week", 1, dbt.date_trunc('day', dbt.current_timestamp_backcompat())) 
+        end_date = dbt.dateadd("week", 1, dbt.date_trunc('day', dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp())) 
         ) 
     }} 
 ),
@@ -105,7 +105,7 @@ connector_event_history as (
     spine join connector_event_counts
         on spine.date_day  >= cast( {{ dbt.date_trunc('day', 'connector_event_counts.set_up_at') }} as date)
 
-    group by 1,2,3,4,5,6
+    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id
 ),
 
 -- now rejoin spine to get a complete calendar
@@ -126,7 +126,7 @@ join_event_history as (
     spine left join connector_event_history
         on cast(spine.date_day as date) = connector_event_history.date_day
 
-    group by 1,2,3,4,5,6
+    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id
 ),
 
 final as (
@@ -134,9 +134,11 @@ final as (
     select *
     from join_event_history
 
-    where cast(date_day as timestamp) <= {{ dbt.current_timestamp_backcompat() }}
+    where cast(date_day as timestamp) <= {{ dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp() }}
 
+    {% if target.type != 'sqlserver' %} -- sql server cant order CTEs
     order by date_day desc
+    {% endif %}
 )
 
 select *
diff --git a/models/fivetran_platform__connector_status.sql b/models/fivetran_platform__connector_status.sql
index bca1c3e2..a38c9087 100644
--- a/models/fivetran_platform__connector_status.sql
+++ b/models/fivetran_platform__connector_status.sql
@@ -36,10 +36,10 @@ schema_changes as (
     from {{ ref('stg_fivetran_platform__log') }}
 
     where 
-        {{ dbt.datediff('created_at', dbt.current_timestamp_backcompat(), 'day') }} <= 30
+        {{ dbt.datediff('created_at', dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp(), 'day') }} <= 30
         and event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')
 
-    group by 1
+    group by connector_id
 
 ),
 
@@ -92,8 +92,7 @@ connector_metrics as (
     from connector 
     left join connector_log 
         on connector_log.connector_id = connector.connector_id
-    {{ dbt_utils.group_by(n=6) }}
-
+    group by connector.connector_id, connector.connector_name, connector.connector_type, connector.destination_id, connector.is_paused, connector.set_up_at
 ),
 
 connector_health as (
@@ -102,7 +101,7 @@ connector_health as (
         *,
         case 
             -- connector is paused
-            when is_paused then 'paused'
+            when is_paused {{ ' = 1' if target.type == 'sqlserver' else '' }} then 'paused'
 
             -- a sync has never been attempted
             when last_sync_started_at is null then 'incomplete'
@@ -156,8 +155,19 @@ connector_recent_logs as (
             and {{ fivetran_utils.json_parse(string="connector_log.message_data", string_path=["status"]) }} ='RESCHEDULED'
             and {{ fivetran_utils.json_parse(string="connector_log.message_data", string_path=["reason"]) }} like '%intended behavior%')
 
-    {{ dbt_utils.group_by(n=12) }} -- de-duping error messages
-    
+    group by -- remove duplicates
+        connector_health.connector_id,
+        connector_health.connector_name,
+        connector_health.connector_type,
+        connector_health.destination_id,
+        connector_health.connector_health,
+        connector_health.last_successful_sync_completed_at,
+        connector_health.last_sync_started_at,
+        connector_health.last_sync_completed_at,
+        connector_health.set_up_at,
+        connector_log.event_subtype,
+        connector_log.event_type,
+        connector_log.message_data
 
 ),
 
@@ -177,8 +187,8 @@ final as (
         coalesce(schema_changes.number_of_schema_changes_last_month, 0) as number_of_schema_changes_last_month
         
         {% if var('fivetran_platform_using_sync_alert_messages', true) %}
-        , {{ fivetran_utils.string_agg("distinct case when connector_recent_logs.event_type = 'SEVERE' then connector_recent_logs.message_data else null end", "'\\n'") }} as errors_since_last_completed_sync
-        , {{ fivetran_utils.string_agg("distinct case when connector_recent_logs.event_type = 'WARNING' then connector_recent_logs.message_data else null end", "'\\n'") }} as warnings_since_last_completed_sync
+        , {{ fivetran_utils.string_agg("case when connector_recent_logs.event_type = 'SEVERE' then connector_recent_logs.message_data else null end", "'\\n'") }} as errors_since_last_completed_sync
+        , {{ fivetran_utils.string_agg("case when connector_recent_logs.event_type = 'WARNING' then connector_recent_logs.message_data else null end", "'\\n'") }} as warnings_since_last_completed_sync
         {% endif %}
 
     from connector_recent_logs
@@ -186,7 +196,18 @@ final as (
         on connector_recent_logs.connector_id = schema_changes.connector_id 
 
     join destination on destination.destination_id = connector_recent_logs.destination_id
-    {{ dbt_utils.group_by(n=11) }}
+    group by 
+        connector_recent_logs.connector_id, 
+        connector_recent_logs.connector_name, 
+        connector_recent_logs.connector_type, 
+        connector_recent_logs.destination_id, 
+        destination.destination_name, 
+        connector_recent_logs.connector_health, 
+        connector_recent_logs.last_successful_sync_completed_at, 
+        connector_recent_logs.last_sync_started_at, 
+        connector_recent_logs.last_sync_completed_at, 
+        connector_recent_logs.set_up_at, 
+        number_of_schema_changes_last_month
 )
 
 select * from final
\ No newline at end of file
diff --git a/models/fivetran_platform__mar_table_history.sql b/models/fivetran_platform__mar_table_history.sql
index b6d4ca23..5841f53e 100644
--- a/models/fivetran_platform__mar_table_history.sql
+++ b/models/fivetran_platform__mar_table_history.sql
@@ -37,7 +37,7 @@ ordered_mar as (
         end, 0)) as free_monthly_active_rows
 
     from incremental_mar
-    {{dbt_utils.group_by(5)}}
+    group by connector_name, schema_name, table_name, destination_id, measured_month
 ),
 
 latest_mar as (
@@ -47,7 +47,7 @@ latest_mar as (
         table_name,
         destination_id,
         measured_month,
-        date(last_measured_at) as last_measured_at,
+        cast(last_measured_at as date) as last_measured_at,
         free_monthly_active_rows,
         paid_monthly_active_rows,
         (free_monthly_active_rows + paid_monthly_active_rows) as total_monthly_active_rows
@@ -71,5 +71,7 @@ mar_join as (
 )
 
 select * from mar_join
+{% if target.type != 'sqlserver' %} -- can't order CTEs in sqlserver
 order by measured_month desc, destination_id, connector_name
+{% endif %}
 
diff --git a/models/fivetran_platform__schema_changelog.sql b/models/fivetran_platform__schema_changelog.sql
index 5bf37e7d..94835020 100644
--- a/models/fivetran_platform__schema_changelog.sql
+++ b/models/fivetran_platform__schema_changelog.sql
@@ -20,7 +20,8 @@ add_connector_info as (
         connector.destination_id,
         connector.destination_name
 
-    from schema_changes join connector using(connector_id)
+    from schema_changes join connector 
+        on schema_changes.connector_id = connector.connector_id
 ),
 
 final as (
@@ -47,4 +48,6 @@ final as (
 )
 
 select * from final
-order by created_at desc, connector_id
\ No newline at end of file
+{% if target.type != 'sqlserver' %}
+order by created_at desc, connector_id
+{% endif %}
\ No newline at end of file
diff --git a/models/fivetran_platform__usage_mar_destination_history.sql b/models/fivetran_platform__usage_mar_destination_history.sql
index 42b0d391..537e768c 100644
--- a/models/fivetran_platform__usage_mar_destination_history.sql
+++ b/models/fivetran_platform__usage_mar_destination_history.sql
@@ -19,14 +19,14 @@ useage_cost as (
 destination_mar as (
 
     select 
-        measured_month,
+        cast(measured_month as date) as measured_month,
         destination_id,
         destination_name,
         sum(free_monthly_active_rows) as free_monthly_active_rows,
         sum(paid_monthly_active_rows) as paid_monthly_active_rows,
         sum(total_monthly_active_rows) as total_monthly_active_rows
     from table_mar
-    group by 1,2,3
+    group by measured_month, destination_id, destination_name
 ),
 
 usage as (
@@ -61,10 +61,12 @@ join_usage_mar as (
         round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as {{ dbt.type_numeric() }}) / cast(nullif(usage.dollars_spent,0) as {{ dbt.type_numeric() }}), 0) as mar_per_amount_spent
     from destination_mar 
     left join usage 
-        on destination_mar.measured_month = cast(usage.measured_month as timestamp)
+        on destination_mar.measured_month = cast(usage.measured_month as date)
         and destination_mar.destination_id = usage.destination_id
 )
 
 select * 
 from join_usage_mar
+{% if target.type != 'sqlserver' %} -- sql server doesn't support ordering CTEs
 order by measured_month desc
+{% endif %}
\ No newline at end of file
diff --git a/packages.yml b/packages.yml
index 89673e52..b28c2a8a 100644
--- a/packages.yml
+++ b/packages.yml
@@ -8,5 +8,8 @@ packages:
 - package: dbt-labs/spark_utils
   version: [">=0.3.0", "<0.4.0"]
 
+- package: dbt-msft/tsql_utils
+  version: [">=0.9.0", "<1.0.0"]
+
 - package: calogica/dbt_date
   version: [">=0.9.0", "<1.0.0"]
\ No newline at end of file

From 5846983ff98731b28a247bb29fc8aba68f1fd192 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Mon, 20 Nov 2023 15:22:36 -0800
Subject: [PATCH 03/54] working on sql server

---
 models/fivetran_platform__audit_table.sql            | 2 +-
 models/fivetran_platform__connector_daily_events.sql | 8 ++++----
 packages.yml                                         | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/models/fivetran_platform__audit_table.sql b/models/fivetran_platform__audit_table.sql
index 82443cfa..7e8ad6ae 100644
--- a/models/fivetran_platform__audit_table.sql
+++ b/models/fivetran_platform__audit_table.sql
@@ -32,7 +32,7 @@ with sync_log as (
     {%- set max_sync_start = query_result['data'][0][0] -%}
 
     -- compare the new batch of data to the latest sync already stored in this model
-    and case(created_at as date) > '{{ max_sync_start }}'
+    and cast(created_at as date) > '{{ max_sync_start }}'
 
     {% endif %}
 ),
diff --git a/models/fivetran_platform__connector_daily_events.sql b/models/fivetran_platform__connector_daily_events.sql
index 71362659..6e5a1b63 100644
--- a/models/fivetran_platform__connector_daily_events.sql
+++ b/models/fivetran_platform__connector_daily_events.sql
@@ -27,7 +27,7 @@ log_events as (
                             
         and connector_id is not null
 
-    group by connector_id, date_day, event_subtype
+    group by connector_id, cast( {{ dbt.date_trunc('day', 'created_at') }} as date), event_subtype
 ),
 
 pivot_out_events as (
@@ -72,7 +72,7 @@ spine as (
     {% else %} {% set first_date = "2016-01-01" %}
     {% endif %}
 
-    {{ dbt_utils.date_spine(
+    {{ fivetran_utils.date_spine(
         datepart = "day", 
         start_date =  "cast('" ~ first_date[0:10] ~ "' as date)", 
         end_date = dbt.dateadd("week", 1, dbt.date_trunc('day', dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp())) 
@@ -103,7 +103,7 @@ connector_event_history as (
         end) as count_schema_changes
     from
     spine join connector_event_counts
-        on spine.date_day  >= cast( {{ dbt.date_trunc('day', 'connector_event_counts.set_up_at') }} as date)
+        on spine.date_day  >= {{ dbt.date_trunc('day', 'cast(connector_event_counts.set_up_at as date)') }}
 
     group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id
 ),
@@ -134,7 +134,7 @@ final as (
     select *
     from join_event_history
 
-    where cast(date_day as timestamp) <= {{ dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp() }}
+    where date_day <= cast({{ dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp() }} as date)
 
     {% if target.type != 'sqlserver' %} -- sql server cant order CTEs
     order by date_day desc
diff --git a/packages.yml b/packages.yml
index b28c2a8a..2f7246c2 100644
--- a/packages.yml
+++ b/packages.yml
@@ -8,8 +8,8 @@ packages:
 - package: dbt-labs/spark_utils
   version: [">=0.3.0", "<0.4.0"]
 
-- package: dbt-msft/tsql_utils
-  version: [">=0.9.0", "<1.0.0"]
+# - package: dbt-msft/tsql_utils
+#   version: [">=0.9.0", "<1.0.0"]
 
 - package: calogica/dbt_date
   version: [">=0.9.0", "<1.0.0"]
\ No newline at end of file

From fd77632aa7c1b7670aa7911b319b54f86196c4d3 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Mon, 20 Nov 2023 15:32:49 -0800
Subject: [PATCH 04/54] bk

---
 ...etran_platform__connector_daily_events.sql | 23 +++++++++++--------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/models/fivetran_platform__connector_daily_events.sql b/models/fivetran_platform__connector_daily_events.sql
index 6e5a1b63..dd285ae2 100644
--- a/models/fivetran_platform__connector_daily_events.sql
+++ b/models/fivetran_platform__connector_daily_events.sql
@@ -72,33 +72,36 @@ spine as (
     {% else %} {% set first_date = "2016-01-01" %}
     {% endif %}
 
-    {{ fivetran_utils.date_spine(
-        datepart = "day", 
-        start_date =  "cast('" ~ first_date[0:10] ~ "' as date)", 
-        end_date = dbt.dateadd("week", 1, dbt.date_trunc('day', dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp())) 
-        ) 
-    }} 
+    select cast(date_day as date) as date_day
+    from (
+        {{ fivetran_utils.date_spine(
+            datepart = "day", 
+            start_date =  "cast('" ~ first_date[0:10] ~ "' as date)", 
+            end_date = dbt.dateadd("week", 1, dbt.date_trunc('day', dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp())) 
+            ) 
+        }} 
+    ) as date_spine
 ),
 
 connector_event_history as (
 
     select
-        cast(spine.date_day as date) as date_day,
+        spine.date_day as date_day,
         connector_event_counts.connector_name,
         connector_event_counts.connector_id,
         connector_event_counts.connector_type,
         connector_event_counts.destination_name,
         connector_event_counts.destination_id,
         max(case 
-            when cast(spine.date_day as date) = connector_event_counts.date_day then connector_event_counts.count_api_calls
+            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_api_calls
             else 0
         end) as count_api_calls,
         max(case 
-            when cast(spine.date_day as date) = connector_event_counts.date_day then connector_event_counts.count_record_modifications
+            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_record_modifications
             else 0
         end) as count_record_modifications,
         max(case 
-            when cast(spine.date_day as date) = connector_event_counts.date_day then connector_event_counts.count_schema_changes
+            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_schema_changes
             else 0
         end) as count_schema_changes
     from

From e2d62d6568b1c26a407fe55cf7ef3c5edbc28a8e Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Tue, 28 Nov 2023 14:28:23 -0800
Subject: [PATCH 05/54] buildkite for sql server

---
 .buildkite/hooks/pre-command                 |  6 +++++-
 .buildkite/pipeline.yml                      | 17 ++++++++++++++++-
 .buildkite/scripts/run_models.sh             |  5 ++++-
 integration_tests/ci/sample.profiles.yml     | 12 +++++++++++-
 integration_tests/requirements_sqlserver.txt |  2 ++
 5 files changed, 38 insertions(+), 4 deletions(-)
 create mode 100644 integration_tests/requirements_sqlserver.txt

diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command
index 81b7b002..b3bf7c23 100644
--- a/.buildkite/hooks/pre-command
+++ b/.buildkite/hooks/pre-command
@@ -22,4 +22,8 @@ export CI_SNOWFLAKE_DBT_WAREHOUSE=$(gcloud secrets versions access latest --secr
 export CI_DATABRICKS_DBT_HOST=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_HOST" --project="dbt-package-testing-363917")
 export CI_DATABRICKS_DBT_HTTP_PATH=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_HTTP_PATH" --project="dbt-package-testing-363917")
 export CI_DATABRICKS_DBT_TOKEN=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_TOKEN" --project="dbt-package-testing-363917")
-export CI_DATABRICKS_DBT_CATALOG=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_CATALOG" --project="dbt-package-testing-363917")
\ No newline at end of file
+export CI_DATABRICKS_DBT_CATALOG=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_CATALOG" --project="dbt-package-testing-363917")
+export CI_SQLSERVER_DBT_SERVER=$(gcloud secrets versions access latest --secret="CI_SQLSERVER_DBT_SERVER" --project="dbt-package-testing-363917")
+export CI_SQLSERVER_DBT_DATABASE=$(gcloud secrets versions access latest --secret="CI_SQLSERVER_DBT_DATABASE" --project="dbt-package-testing-363917")
+export CI_SQLSERVER_DBT_USER=$(gcloud secrets versions access latest --secret="CI_SQLSERVER_DBT_USER" --project="dbt-package-testing-363917")
+export CI_SQLSERVER_DBT_PASS=$(gcloud secrets versions access latest --secret="CI_SQLSERVER_DBT_PASS" --project="dbt-package-testing-363917")
\ No newline at end of file
diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml
index 985bfc37..4903aa30 100644
--- a/.buildkite/pipeline.yml
+++ b/.buildkite/pipeline.yml
@@ -71,4 +71,19 @@ steps:
             - "CI_DATABRICKS_DBT_TOKEN"
             - "CI_DATABRICKS_DBT_CATALOG"
     commands: |
-      bash .buildkite/scripts/run_models.sh databricks
\ No newline at end of file
+      bash .buildkite/scripts/run_models.sh databricks
+
+  - label: ":azure: Run Tests - SQLServer"
+    key: "run_dbt_sqlserver"
+    plugins:
+      - docker#v3.13.0:
+          image: "python:3.8"
+          shell: [ "/bin/bash", "-e", "-c" ]
+          environment:
+            - "BASH_ENV=/tmp/.bashrc"
+            - "CI_SQLSERVER_DBT_SERVER"
+            - "CI_SQLSERVER_DBT_DATABASE"
+            - "CI_SQLSERVER_DBT_USER"
+            - "CI_SQLSERVER_DBT_PASS"
+    commands: |
+      bash .buildkite/scripts/run_models.sh sqlserver
\ No newline at end of file
diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index dbd8a054..0b00e6fd 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -7,7 +7,10 @@ apt-get install libsasl2-dev
 python3 -m venv venv
 . venv/bin/activate
 pip install --upgrade pip setuptools
-pip install -r integration_tests/requirements.txt
+if [ "$1" = "sqlserver" ]; then
+    pip install -r integration_tests/requirements_sqlserver.txt
+else
+    pip install -r integration_tests/requirements.txt
 mkdir -p ~/.dbt
 cp integration_tests/ci/sample.profiles.yml ~/.dbt/profiles.yml
 
diff --git a/integration_tests/ci/sample.profiles.yml b/integration_tests/ci/sample.profiles.yml
index 45f20d6d..4d658134 100644
--- a/integration_tests/ci/sample.profiles.yml
+++ b/integration_tests/ci/sample.profiles.yml
@@ -51,4 +51,14 @@ integration_tests:
       schema: fivetran_platform_integration_tests
       threads: 2
       token: "{{ env_var('CI_DATABRICKS_DBT_TOKEN') }}"
-      type: databricks
\ No newline at end of file
+      type: databricks
+    sqlserver:
+      type: sqlserver
+      driver: 'ODBC Driver 18 for SQL Server'
+      server: "{{ env_var('CI_SQLSERVER_DBT_SERVER') }}"
+      port: 1433
+      database: "{{ env_var('CI_SQLSERVER_DBT_DATABASE') }}"
+      schema: fivetran_platform_integration_tests
+      user: "{{ env_var('CI_SQLSERVER_DBT_USER') }}"
+      password: "{{ env_var('CI_SQLSERVER_DBT_PASS') }}"
+      threads: 8
\ No newline at end of file
diff --git a/integration_tests/requirements_sqlserver.txt b/integration_tests/requirements_sqlserver.txt
new file mode 100644
index 00000000..da5621d0
--- /dev/null
+++ b/integration_tests/requirements_sqlserver.txt
@@ -0,0 +1,2 @@
+dbt-sqlserver>=1.4.0,<2.0.0
+pyodbc!=4.0.36,!=4.0.37,~=4.0.35
\ No newline at end of file

From fb300beee5beca397b54bc59302455f58e748e55 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Tue, 28 Nov 2023 15:40:53 -0800
Subject: [PATCH 06/54] bq

---
 dbt_project.yml                               |  2 +-
 ...etran_platform__connector_daily_events.sql | 18 ++++----
 .../fivetran_platform__connector_status.sql   | 44 +++++++++----------
 3 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/dbt_project.yml b/dbt_project.yml
index b2e4dbf1..65d827a6 100644
--- a/dbt_project.yml
+++ b/dbt_project.yml
@@ -22,4 +22,4 @@ vars:
     destination_membership: "{{ source('fivetran_platform', 'destination_membership') }}"
     log: "{{ source('fivetran_platform', 'log') }}"
     user: "{{ source('fivetran_platform', 'user') }}"
-    usage_cost: "{{ source('fivetran_platform', 'usage_cost') }}"
+    usage_cost: "{{ source('fivetran_platform', 'usage_cost') }}"
\ No newline at end of file
diff --git a/models/fivetran_platform__connector_daily_events.sql b/models/fivetran_platform__connector_daily_events.sql
index dd285ae2..5837ad8e 100644
--- a/models/fivetran_platform__connector_daily_events.sql
+++ b/models/fivetran_platform__connector_daily_events.sql
@@ -1,4 +1,4 @@
--- depends_on: {{ var('connector') }}
+{# -- depends_on: {{ var('connector') }}
 
 with connector as (
     
@@ -41,7 +41,7 @@ pivot_out_events as (
 
     from log_events
     group by connector_id, date_day
-),
+), 
 
 connector_event_counts as (
 
@@ -61,7 +61,8 @@ connector_event_counts as (
         on pivot_out_events.connector_id = connector.connector_id
 ),
 
-spine as (
+#}
+with spine as (
 
     {% if execute %}
     {% set first_date_query %}
@@ -74,19 +75,20 @@ spine as (
 
     select cast(date_day as date) as date_day
     from (
-        {{ fivetran_utils.date_spine(
+        {{ dbt_utils.date_spine(
             datepart = "day", 
             start_date =  "cast('" ~ first_date[0:10] ~ "' as date)", 
-            end_date = dbt.dateadd("week", 1, dbt.date_trunc('day', dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp())) 
+            end_date = dbt.dateadd("week", 1, dbt.date_trunc('day', dbt.current_timestamp_backcompat())) 
             ) 
         }} 
     ) as date_spine
-),
+) select * from spine
 
+{#
 connector_event_history as (
 
     select
-        spine.date_day as date_day,
+        spine.date_day,
         connector_event_counts.connector_name,
         connector_event_counts.connector_id,
         connector_event_counts.connector_type,
@@ -145,4 +147,4 @@ final as (
 )
 
 select *
-from final
+from final #}
diff --git a/models/fivetran_platform__connector_status.sql b/models/fivetran_platform__connector_status.sql
index a38c9087..b958302b 100644
--- a/models/fivetran_platform__connector_status.sql
+++ b/models/fivetran_platform__connector_status.sql
@@ -95,7 +95,7 @@ connector_metrics as (
     group by connector.connector_id, connector.connector_name, connector.connector_type, connector.destination_id, connector.is_paused, connector.set_up_at
 ),
 
-connector_health as (
+connector_health_status as (
 
     select
         *,
@@ -130,24 +130,24 @@ connector_health as (
 connector_recent_logs as (
 
     select 
-        connector_health.connector_id,
-        connector_health.connector_name,
-        connector_health.connector_type,
-        connector_health.destination_id,
-        connector_health.connector_health,
-        connector_health.last_successful_sync_completed_at,
-        connector_health.last_sync_started_at,
-        connector_health.last_sync_completed_at,
-        connector_health.set_up_at,
+        connector_health_status.connector_id,
+        connector_health_status.connector_name,
+        connector_health_status.connector_type,
+        connector_health_status.destination_id,
+        connector_health_status.connector_health,
+        connector_health_status.last_successful_sync_completed_at,
+        connector_health_status.last_sync_started_at,
+        connector_health_status.last_sync_completed_at,
+        connector_health_status.set_up_at,
         connector_log.event_subtype,
         connector_log.event_type,
         connector_log.message_data
 
-    from connector_health 
+    from connector_health_status 
     left join connector_log 
-        on connector_log.connector_id = connector_health.connector_id
+        on connector_log.connector_id = connector_health_status.connector_id
         -- limiting relevance to since the last successful sync completion (if there has been one)
-        and connector_log.created_at > coalesce(connector_health.last_sync_completed_at, connector_health.last_priority_first_sync_completed_at, '2000-01-01') 
+        and connector_log.created_at > coalesce(connector_health_status.last_sync_completed_at, connector_health_status.last_priority_first_sync_completed_at, '2000-01-01') 
         -- only looking at errors and warnings (excluding syncs - both normal and priority first)
         and connector_log.event_type != 'INFO' 
         -- need to explicitly avoid priority first statuses because they are of event_type WARNING
@@ -156,15 +156,15 @@ connector_recent_logs as (
             and {{ fivetran_utils.json_parse(string="connector_log.message_data", string_path=["reason"]) }} like '%intended behavior%')
 
     group by -- remove duplicates
-        connector_health.connector_id,
-        connector_health.connector_name,
-        connector_health.connector_type,
-        connector_health.destination_id,
-        connector_health.connector_health,
-        connector_health.last_successful_sync_completed_at,
-        connector_health.last_sync_started_at,
-        connector_health.last_sync_completed_at,
-        connector_health.set_up_at,
+        connector_health_status.connector_id,
+        connector_health_status.connector_name,
+        connector_health_status.connector_type,
+        connector_health_status.destination_id,
+        connector_health_status.connector_health,
+        connector_health_status.last_successful_sync_completed_at,
+        connector_health_status.last_sync_started_at,
+        connector_health_status.last_sync_completed_at,
+        connector_health_status.set_up_at,
         connector_log.event_subtype,
         connector_log.event_type,
         connector_log.message_data

From b8d16012b1e45412bedd972bb7170e46d081af50 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Tue, 28 Nov 2023 15:44:09 -0800
Subject: [PATCH 07/54] bq

---
 .buildkite/scripts/run_models.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 0b00e6fd..a183fe6b 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -7,10 +7,11 @@ apt-get install libsasl2-dev
 python3 -m venv venv
 . venv/bin/activate
 pip install --upgrade pip setuptools
-if [ "$1" = "sqlserver" ]; then
+if [ "$1" == "sqlserver" ]; then
     pip install -r integration_tests/requirements_sqlserver.txt
 else
     pip install -r integration_tests/requirements.txt
+fi
 mkdir -p ~/.dbt
 cp integration_tests/ci/sample.profiles.yml ~/.dbt/profiles.yml
 

From 55aaf6891ed7f15f286f33d964fed8b5bee2a476 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Tue, 28 Nov 2023 16:05:56 -0800
Subject: [PATCH 08/54] ttry this

---
 .buildkite/scripts/run_models.sh                     |  1 +
 models/fivetran_platform__connector_daily_events.sql | 10 ++++------
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index a183fe6b..c2190245 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -8,6 +8,7 @@ python3 -m venv venv
 . venv/bin/activate
 pip install --upgrade pip setuptools
 if [ "$1" == "sqlserver" ]; then
+    apt-get install unixodbc-dev
     pip install -r integration_tests/requirements_sqlserver.txt
 else
     pip install -r integration_tests/requirements.txt
diff --git a/models/fivetran_platform__connector_daily_events.sql b/models/fivetran_platform__connector_daily_events.sql
index 5837ad8e..3393ce23 100644
--- a/models/fivetran_platform__connector_daily_events.sql
+++ b/models/fivetran_platform__connector_daily_events.sql
@@ -1,4 +1,4 @@
-{# -- depends_on: {{ var('connector') }}
+-- depends_on: {{ var('connector') }}
 
 with connector as (
     
@@ -61,8 +61,7 @@ connector_event_counts as (
         on pivot_out_events.connector_id = connector.connector_id
 ),
 
-#}
-with spine as (
+spine as (
 
     {% if execute %}
     {% set first_date_query %}
@@ -82,9 +81,8 @@ with spine as (
             ) 
         }} 
     ) as date_spine
-) select * from spine
+),
 
-{#
 connector_event_history as (
 
     select
@@ -147,4 +145,4 @@ final as (
 )
 
 select *
-from final #}
+from final
\ No newline at end of file

From b12def0e31c3a8d3b3cf6907902f2589888b74fe Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Tue, 28 Nov 2023 16:20:25 -0800
Subject: [PATCH 09/54] buildkite

---
 models/fivetran_platform__connector_daily_events.sql | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/models/fivetran_platform__connector_daily_events.sql b/models/fivetran_platform__connector_daily_events.sql
index 3393ce23..79e1d38f 100644
--- a/models/fivetran_platform__connector_daily_events.sql
+++ b/models/fivetran_platform__connector_daily_events.sql
@@ -106,7 +106,7 @@ connector_event_history as (
         end) as count_schema_changes
     from
     spine join connector_event_counts
-        on spine.date_day  >= {{ dbt.date_trunc('day', 'cast(connector_event_counts.set_up_at as date)') }}
+        on spine.date_day  >= cast({{ dbt.date_trunc('day', 'cast(connector_event_counts.set_up_at as date)') }} as date)
 
     group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id
 ),
@@ -127,7 +127,7 @@ join_event_history as (
 
     from
     spine left join connector_event_history
-        on cast(spine.date_day as date) = connector_event_history.date_day
+        on spine.date_day = connector_event_history.date_day
 
     group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id
 ),

From 41a68c3ed559dbb9450d0b3b8a564103af91deeb Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 08:33:23 -0800
Subject: [PATCH 10/54] sql server on bk

---
 .buildkite/scripts/run_models.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index c2190245..98ae3b66 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -8,7 +8,7 @@ python3 -m venv venv
 . venv/bin/activate
 pip install --upgrade pip setuptools
 if [ "$1" == "sqlserver" ]; then
-    apt-get install unixodbc-dev
+    apt-get --assume-yes install unixodbc-dev
     pip install -r integration_tests/requirements_sqlserver.txt
 else
     pip install -r integration_tests/requirements.txt

From cb323d69487fdd00bb5d8bf6fa1a235a5468cdff Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 09:13:04 -0800
Subject: [PATCH 11/54] server bk

---
 .buildkite/scripts/run_models.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 98ae3b66..1744b595 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -8,7 +8,11 @@ python3 -m venv venv
 . venv/bin/activate
 pip install --upgrade pip setuptools
 if [ "$1" == "sqlserver" ]; then
+    curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
+    curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
+    apt-get update
     apt-get --assume-yes install unixodbc-dev
+    ACCEPT_EULA=Y apt-get install -y msodbcsql18
     pip install -r integration_tests/requirements_sqlserver.txt
 else
     pip install -r integration_tests/requirements.txt

From 946f95878a5b98ceb07c362726e045ded021ef8f Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 09:44:17 -0800
Subject: [PATCH 12/54] remove sudo

---
 .buildkite/scripts/run_models.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 1744b595..b7601e5f 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -8,10 +8,10 @@ python3 -m venv venv
 . venv/bin/activate
 pip install --upgrade pip setuptools
 if [ "$1" == "sqlserver" ]; then
-    curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
-    curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
-    apt-get update
     apt-get --assume-yes install unixodbc-dev
+    curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc
+    curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
+    apt-get update
     ACCEPT_EULA=Y apt-get install -y msodbcsql18
     pip install -r integration_tests/requirements_sqlserver.txt
 else

From 8c18d4910edd56b66bc5cf2d38dade0a84efb858 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 09:53:28 -0800
Subject: [PATCH 13/54] more sql server

---
 .buildkite/scripts/run_models.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index b7601e5f..356e9a69 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -8,11 +8,12 @@ python3 -m venv venv
 . venv/bin/activate
 pip install --upgrade pip setuptools
 if [ "$1" == "sqlserver" ]; then
-    apt-get --assume-yes install unixodbc-dev
+    apt install lsb-core
     curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc
     curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
     apt-get update
     ACCEPT_EULA=Y apt-get install -y msodbcsql18
+    apt-get --assume-yes install unixodbc-dev
     pip install -r integration_tests/requirements_sqlserver.txt
 else
     pip install -r integration_tests/requirements.txt

From e8071016915c299e3d47283187f903a29362e6b5 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 09:58:38 -0800
Subject: [PATCH 14/54] sql xserver

---
 .buildkite/pipeline.yml          | 138 +++++++++++++++----------------
 .buildkite/scripts/run_models.sh |   2 +-
 2 files changed, 70 insertions(+), 70 deletions(-)

diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml
index 4903aa30..c81a3090 100644
--- a/.buildkite/pipeline.yml
+++ b/.buildkite/pipeline.yml
@@ -1,77 +1,77 @@
 steps:
-  - label: ":postgres: Run Tests - Postgres"
-    key: "run-dbt-postgres"
-    plugins:
-      - docker#v3.13.0:
-          image: "python:3.8"
-          shell: [ "/bin/bash", "-e", "-c" ]
-          environment:
-            - "BASH_ENV=/tmp/.bashrc"
-            - "CI_POSTGRES_DBT_DBNAME"
-            - "CI_POSTGRES_DBT_HOST"
-            - "CI_POSTGRES_DBT_PASS"
-            - "CI_POSTGRES_DBT_USER"
-    commands: |
-      bash .buildkite/scripts/run_models.sh postgres 
+  # - label: ":postgres: Run Tests - Postgres"
+  #   key: "run-dbt-postgres"
+  #   plugins:
+  #     - docker#v3.13.0:
+  #         image: "python:3.8"
+  #         shell: [ "/bin/bash", "-e", "-c" ]
+  #         environment:
+  #           - "BASH_ENV=/tmp/.bashrc"
+  #           - "CI_POSTGRES_DBT_DBNAME"
+  #           - "CI_POSTGRES_DBT_HOST"
+  #           - "CI_POSTGRES_DBT_PASS"
+  #           - "CI_POSTGRES_DBT_USER"
+  #   commands: |
+  #     bash .buildkite/scripts/run_models.sh postgres 
 
-  - label: ":snowflake-db: Run Tests - Snowflake"
-    key: "run_dbt_snowflake"
-    plugins:
-      - docker#v3.13.0:
-          image: "python:3.8"
-          shell: [ "/bin/bash", "-e", "-c" ]
-          environment:
-            - "BASH_ENV=/tmp/.bashrc"
-            - "CI_SNOWFLAKE_DBT_ACCOUNT"
-            - "CI_SNOWFLAKE_DBT_DATABASE"
-            - "CI_SNOWFLAKE_DBT_PASS"
-            - "CI_SNOWFLAKE_DBT_ROLE"
-            - "CI_SNOWFLAKE_DBT_USER"
-            - "CI_SNOWFLAKE_DBT_WAREHOUSE"
-    commands: |
-      bash .buildkite/scripts/run_models.sh snowflake
+  # - label: ":snowflake-db: Run Tests - Snowflake"
+  #   key: "run_dbt_snowflake"
+  #   plugins:
+  #     - docker#v3.13.0:
+  #         image: "python:3.8"
+  #         shell: [ "/bin/bash", "-e", "-c" ]
+  #         environment:
+  #           - "BASH_ENV=/tmp/.bashrc"
+  #           - "CI_SNOWFLAKE_DBT_ACCOUNT"
+  #           - "CI_SNOWFLAKE_DBT_DATABASE"
+  #           - "CI_SNOWFLAKE_DBT_PASS"
+  #           - "CI_SNOWFLAKE_DBT_ROLE"
+  #           - "CI_SNOWFLAKE_DBT_USER"
+  #           - "CI_SNOWFLAKE_DBT_WAREHOUSE"
+  #   commands: |
+  #     bash .buildkite/scripts/run_models.sh snowflake
 
-  - label: ":gcloud: Run Tests - BigQuery"
-    key: "run_dbt_bigquery"
-    plugins:
-      - docker#v3.13.0:
-          image: "python:3.8"
-          shell: [ "/bin/bash", "-e", "-c" ]
-          environment:
-            - "BASH_ENV=/tmp/.bashrc"
-            - "GCLOUD_SERVICE_KEY"
-    commands: |
-      bash .buildkite/scripts/run_models.sh bigquery
+  # - label: ":gcloud: Run Tests - BigQuery"
+  #   key: "run_dbt_bigquery"
+  #   plugins:
+  #     - docker#v3.13.0:
+  #         image: "python:3.8"
+  #         shell: [ "/bin/bash", "-e", "-c" ]
+  #         environment:
+  #           - "BASH_ENV=/tmp/.bashrc"
+  #           - "GCLOUD_SERVICE_KEY"
+  #   commands: |
+  #     bash .buildkite/scripts/run_models.sh bigquery
 
-  - label: ":amazon-redshift: Run Tests - Redshift"
-    key: "run_dbt_redshift"
-    plugins:
-      - docker#v3.13.0:
-          image: "python:3.8"
-          shell: [ "/bin/bash", "-e", "-c" ]
-          environment:
-            - "BASH_ENV=/tmp/.bashrc"
-            - "CI_REDSHIFT_DBT_DBNAME"
-            - "CI_REDSHIFT_DBT_HOST"
-            - "CI_REDSHIFT_DBT_PASS"
-            - "CI_REDSHIFT_DBT_USER"
-    commands: |
-      bash .buildkite/scripts/run_models.sh redshift
+  # - label: ":amazon-redshift: Run Tests - Redshift"
+  #   key: "run_dbt_redshift"
+  #   plugins:
+  #     - docker#v3.13.0:
+  #         image: "python:3.8"
+  #         shell: [ "/bin/bash", "-e", "-c" ]
+  #         environment:
+  #           - "BASH_ENV=/tmp/.bashrc"
+  #           - "CI_REDSHIFT_DBT_DBNAME"
+  #           - "CI_REDSHIFT_DBT_HOST"
+  #           - "CI_REDSHIFT_DBT_PASS"
+  #           - "CI_REDSHIFT_DBT_USER"
+  #   commands: |
+  #     bash .buildkite/scripts/run_models.sh redshift
 
-  - label: ":bricks: Run Tests - Databricks"
-    key: "run_dbt_databricks"
-    plugins:
-      - docker#v3.13.0:
-          image: "python:3.8"
-          shell: [ "/bin/bash", "-e", "-c" ]
-          environment:
-            - "BASH_ENV=/tmp/.bashrc"
-            - "CI_DATABRICKS_DBT_HOST"
-            - "CI_DATABRICKS_DBT_HTTP_PATH"
-            - "CI_DATABRICKS_DBT_TOKEN"
-            - "CI_DATABRICKS_DBT_CATALOG"
-    commands: |
-      bash .buildkite/scripts/run_models.sh databricks
+  # - label: ":bricks: Run Tests - Databricks"
+  #   key: "run_dbt_databricks"
+  #   plugins:
+  #     - docker#v3.13.0:
+  #         image: "python:3.8"
+  #         shell: [ "/bin/bash", "-e", "-c" ]
+  #         environment:
+  #           - "BASH_ENV=/tmp/.bashrc"
+  #           - "CI_DATABRICKS_DBT_HOST"
+  #           - "CI_DATABRICKS_DBT_HTTP_PATH"
+  #           - "CI_DATABRICKS_DBT_TOKEN"
+  #           - "CI_DATABRICKS_DBT_CATALOG"
+  #   commands: |
+  #     bash .buildkite/scripts/run_models.sh databricks
 
   - label: ":azure: Run Tests - SQLServer"
     key: "run_dbt_sqlserver"
diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 356e9a69..04030f74 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -8,7 +8,7 @@ python3 -m venv venv
 . venv/bin/activate
 pip install --upgrade pip setuptools
 if [ "$1" == "sqlserver" ]; then
-    apt install lsb-core
+    apt install lsb-base lsb-release
     curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc
     curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
     apt-get update

From ac42f6ab508b090a328fb538f7a683244b3612c0 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 11:29:27 -0800
Subject: [PATCH 15/54] get driver in docker image

---
 .buildkite/scripts/run_models.sh | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 04030f74..bddab929 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -8,13 +8,17 @@ python3 -m venv venv
 . venv/bin/activate
 pip install --upgrade pip setuptools
 if [ "$1" == "sqlserver" ]; then
-    apt install lsb-base lsb-release
-    curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc
-    curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
-    apt-get update
-    ACCEPT_EULA=Y apt-get install -y msodbcsql18
-    apt-get --assume-yes install unixodbc-dev
     pip install -r integration_tests/requirements_sqlserver.txt
+    curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh
+    brew install unixodbc
+    # curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc
+    # curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
+    brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
+    pip uninstall pyodbc
+    pip install --no-cache-dir --no-binary :all: pyodbc==4.0.39 
+    # apt-get update
+    # ACCEPT_EULA=Y apt-get install -y msodbcsql18
+    # apt-get --assume-yes install unixodbc-dev
 else
     pip install -r integration_tests/requirements.txt
 fi

From 8d5cd4038692447ccca2570acebd4ed08f1e1dea Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 11:47:53 -0800
Subject: [PATCH 16/54] install brew correctly in docker

---
 .buildkite/scripts/run_models.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index bddab929..2ef0eb01 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -9,7 +9,7 @@ python3 -m venv venv
 pip install --upgrade pip setuptools
 if [ "$1" == "sqlserver" ]; then
     pip install -r integration_tests/requirements_sqlserver.txt
-    curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh
+    CI=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
     brew install unixodbc
     # curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc
     # curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | tee /etc/apt/sources.list.d/mssql-release.list

From e9ee936fecb32979a1c5c1e612e879a03ce09446 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 11:54:41 -0800
Subject: [PATCH 17/54] more brew

---
 .buildkite/scripts/run_models.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 2ef0eb01..e0359c1a 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -10,6 +10,7 @@ pip install --upgrade pip setuptools
 if [ "$1" == "sqlserver" ]; then
     pip install -r integration_tests/requirements_sqlserver.txt
     CI=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
+    eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
     brew install unixodbc
     # curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc
     # curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | tee /etc/apt/sources.list.d/mssql-release.list

From f953e3f9edd8da6a58bd3e5f3c8cd80a56a349e4 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 12:06:03 -0800
Subject: [PATCH 18/54] docker

---
 .buildkite/scripts/run_models.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index e0359c1a..1f03adeb 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -10,12 +10,13 @@ pip install --upgrade pip setuptools
 if [ "$1" == "sqlserver" ]; then
     pip install -r integration_tests/requirements_sqlserver.txt
     CI=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
+    (echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /root/.bashrc
     eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
     brew install unixodbc
     # curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc
     # curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
     brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
-    pip uninstall pyodbc
+    pip uninstall -y pyodbc
     pip install --no-cache-dir --no-binary :all: pyodbc==4.0.39 
     # apt-get update
     # ACCEPT_EULA=Y apt-get install -y msodbcsql18

From 88b2848f42f22caa36226d12daec191b0a189e1d Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 12:25:54 -0800
Subject: [PATCH 19/54] brew

---
 .buildkite/scripts/run_models.sh | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 1f03adeb..4221c2c4 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -10,7 +10,6 @@ pip install --upgrade pip setuptools
 if [ "$1" == "sqlserver" ]; then
     pip install -r integration_tests/requirements_sqlserver.txt
     CI=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
-    (echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /root/.bashrc
     eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
     brew install unixodbc
     # curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc

From dae7b45ebd119bfa2ff480813a8a12c37c2e2cce Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 12:33:27 -0800
Subject: [PATCH 20/54] different installation of unixodbc

---
 .buildkite/scripts/run_models.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 4221c2c4..9ff08fbb 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -11,9 +11,8 @@ if [ "$1" == "sqlserver" ]; then
     pip install -r integration_tests/requirements_sqlserver.txt
     CI=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
     eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
-    brew install unixodbc
-    # curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc
-    # curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
+    # brew install unixodbc
+    apt-get -y install unixodbc
     brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
     pip uninstall -y pyodbc
     pip install --no-cache-dir --no-binary :all: pyodbc==4.0.39 

From c7ff18a6cf4fc32aea8154ac4c5bc00b35fbfad2 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 12:40:46 -0800
Subject: [PATCH 21/54] tring out

---
 .buildkite/scripts/run_models.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 9ff08fbb..7f491bff 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -12,8 +12,8 @@ if [ "$1" == "sqlserver" ]; then
     CI=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
     eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
     # brew install unixodbc
-    apt-get -y install unixodbc
     brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
+    apt-get -y install unixodbc-dev unixodbc
     pip uninstall -y pyodbc
     pip install --no-cache-dir --no-binary :all: pyodbc==4.0.39 
     # apt-get update

From 6a7b93c8362221db36cace29882bb82c0226f4e7 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 12:56:41 -0800
Subject: [PATCH 22/54] try this

---
 .buildkite/scripts/run_models.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 7f491bff..1353bd83 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -12,7 +12,9 @@ if [ "$1" == "sqlserver" ]; then
     CI=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
     eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
     # brew install unixodbc
+    brew install gcc
     brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
+    apt-get update
     apt-get -y install unixodbc-dev unixodbc
     pip uninstall -y pyodbc
     pip install --no-cache-dir --no-binary :all: pyodbc==4.0.39 

From 7242ee88a8d4286d5a0065cb209260609f5aefae Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 13:02:53 -0800
Subject: [PATCH 23/54] try out

---
 .buildkite/scripts/run_models.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 1353bd83..a1c8710b 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -14,6 +14,8 @@ if [ "$1" == "sqlserver" ]; then
     # brew install unixodbc
     brew install gcc
     brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
+    brew update
+    HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql18 mssql-tools18
     apt-get update
     apt-get -y install unixodbc-dev unixodbc
     pip uninstall -y pyodbc

From 904e5ad1e24eac25e1205539e5abd32ea4986b01 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 15:10:18 -0800
Subject: [PATCH 24/54] debug

---
 models/fivetran_platform__connector_daily_events.sql | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/models/fivetran_platform__connector_daily_events.sql b/models/fivetran_platform__connector_daily_events.sql
index 79e1d38f..9431d023 100644
--- a/models/fivetran_platform__connector_daily_events.sql
+++ b/models/fivetran_platform__connector_daily_events.sql
@@ -74,10 +74,10 @@ spine as (
 
     select cast(date_day as date) as date_day
     from (
-        {{ dbt_utils.date_spine(
+        {{ fivetran_utils.date_spine(
             datepart = "day", 
             start_date =  "cast('" ~ first_date[0:10] ~ "' as date)", 
-            end_date = dbt.dateadd("week", 1, dbt.date_trunc('day', dbt.current_timestamp_backcompat())) 
+            end_date = dbt.dateadd("week", 1, dbt.date_trunc('day', dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp())) 
             ) 
         }} 
     ) as date_spine

From 9f151002f0bddc9a4e16cefc5f4253c8fb85a5ef Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 15:21:27 -0800
Subject: [PATCH 25/54] get driver working

---
 .buildkite/scripts/run_models.sh | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index a1c8710b..d271f68a 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -15,14 +15,11 @@ if [ "$1" == "sqlserver" ]; then
     brew install gcc
     brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
     brew update
-    HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql18 mssql-tools18
-    apt-get update
-    apt-get -y install unixodbc-dev unixodbc
+    HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql18 mssql-tools18 unixodbc
+    # apt-get update
+    # apt-get -y install unixodbc-dev unixodbc
     pip uninstall -y pyodbc
     pip install --no-cache-dir --no-binary :all: pyodbc==4.0.39 
-    # apt-get update
-    # ACCEPT_EULA=Y apt-get install -y msodbcsql18
-    # apt-get --assume-yes install unixodbc-dev
 else
     pip install -r integration_tests/requirements.txt
 fi

From f334346c49146719e33e81fb96ae9ae133bf7387 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 15:45:35 -0800
Subject: [PATCH 26/54] driver

---
 .buildkite/scripts/run_models.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index d271f68a..0d535007 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -15,9 +15,9 @@ if [ "$1" == "sqlserver" ]; then
     brew install gcc
     brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
     brew update
-    HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql18 mssql-tools18 unixodbc
-    # apt-get update
-    # apt-get -y install unixodbc-dev unixodbc
+    HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql18 mssql-tools18
+    apt-get update
+    apt-get -y install unixodbc-dev
     pip uninstall -y pyodbc
     pip install --no-cache-dir --no-binary :all: pyodbc==4.0.39 
 else

From 1551e33b0294a2f66bbd7f1d5eda67dfe7b4368a Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 16:01:10 -0800
Subject: [PATCH 27/54] log

---
 .buildkite/scripts/run_models.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 0d535007..51464dfb 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -20,6 +20,7 @@ if [ "$1" == "sqlserver" ]; then
     apt-get -y install unixodbc-dev
     pip uninstall -y pyodbc
     pip install --no-cache-dir --no-binary :all: pyodbc==4.0.39 
+    cat /etc/odbc.ini
 else
     pip install -r integration_tests/requirements.txt
 fi

From d5f60c76bea1f0d71184c2aa479856715719a3a0 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 29 Nov 2023 16:17:36 -0800
Subject: [PATCH 28/54] try out odbc 17

---
 .buildkite/scripts/run_models.sh         | 4 ++--
 integration_tests/ci/sample.profiles.yml | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 51464dfb..eaea3979 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -12,10 +12,10 @@ if [ "$1" == "sqlserver" ]; then
     CI=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
     eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
     # brew install unixodbc
+    brew update
     brew install gcc
     brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
-    brew update
-    HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql18 mssql-tools18
+    HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql17 mssql-tools
     apt-get update
     apt-get -y install unixodbc-dev
     pip uninstall -y pyodbc
diff --git a/integration_tests/ci/sample.profiles.yml b/integration_tests/ci/sample.profiles.yml
index 4d658134..ac2550b3 100644
--- a/integration_tests/ci/sample.profiles.yml
+++ b/integration_tests/ci/sample.profiles.yml
@@ -54,7 +54,7 @@ integration_tests:
       type: databricks
     sqlserver:
       type: sqlserver
-      driver: 'ODBC Driver 18 for SQL Server'
+      driver: 'ODBC Driver 17 for SQL Server'
       server: "{{ env_var('CI_SQLSERVER_DBT_SERVER') }}"
       port: 1433
       database: "{{ env_var('CI_SQLSERVER_DBT_DATABASE') }}"

From 0bc41ede7437426ccf8729b2c16cf59d86a49322 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Thu, 30 Nov 2023 09:13:53 -0800
Subject: [PATCH 29/54] brew unixodbc and downgrade pyodbc

---
 .buildkite/scripts/run_models.sh         | 11 +++++------
 integration_tests/ci/sample.profiles.yml |  2 +-
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index eaea3979..1947b345 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -11,16 +11,15 @@ if [ "$1" == "sqlserver" ]; then
     pip install -r integration_tests/requirements_sqlserver.txt
     CI=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
     eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
-    # brew install unixodbc
     brew update
     brew install gcc
     brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
-    HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql17 mssql-tools
-    apt-get update
-    apt-get -y install unixodbc-dev
+    HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql18 mssql-tools18
+    # apt-get update
+    # apt-get -y install unixodbc-dev
+    brew install unixodbc
     pip uninstall -y pyodbc
-    pip install --no-cache-dir --no-binary :all: pyodbc==4.0.39 
-    cat /etc/odbc.ini
+    pip install --no-cache-dir --no-binary :all: pyodbc==4.0.34
 else
     pip install -r integration_tests/requirements.txt
 fi
diff --git a/integration_tests/ci/sample.profiles.yml b/integration_tests/ci/sample.profiles.yml
index ac2550b3..4d658134 100644
--- a/integration_tests/ci/sample.profiles.yml
+++ b/integration_tests/ci/sample.profiles.yml
@@ -54,7 +54,7 @@ integration_tests:
       type: databricks
     sqlserver:
       type: sqlserver
-      driver: 'ODBC Driver 17 for SQL Server'
+      driver: 'ODBC Driver 18 for SQL Server'
       server: "{{ env_var('CI_SQLSERVER_DBT_SERVER') }}"
       port: 1433
       database: "{{ env_var('CI_SQLSERVER_DBT_DATABASE') }}"

From 355e75b94ddb69ea798c28e453187f31b784053c Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Thu, 30 Nov 2023 09:22:31 -0800
Subject: [PATCH 30/54] go back to unixodbc-dev but switch order

---
 .buildkite/scripts/run_models.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 1947b345..c40a0b5c 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -15,9 +15,9 @@ if [ "$1" == "sqlserver" ]; then
     brew install gcc
     brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
     HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql18 mssql-tools18
-    # apt-get update
-    # apt-get -y install unixodbc-dev
-    brew install unixodbc
+    apt-get -y install unixodbc-dev
+    apt-get update
+    # brew install unixodbc
     pip uninstall -y pyodbc
     pip install --no-cache-dir --no-binary :all: pyodbc==4.0.34
 else

From 9df1281f0e9b5a14d5690b9c5a6c1d27d3cad564 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Thu, 30 Nov 2023 09:30:25 -0800
Subject: [PATCH 31/54] upgrade pyodbc

---
 .buildkite/scripts/run_models.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index c40a0b5c..3904f21e 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -19,7 +19,7 @@ if [ "$1" == "sqlserver" ]; then
     apt-get update
     # brew install unixodbc
     pip uninstall -y pyodbc
-    pip install --no-cache-dir --no-binary :all: pyodbc==4.0.34
+    pip install --no-cache-dir --no-binary :all: pyodbc==4.0.39
 else
     pip install -r integration_tests/requirements.txt
 fi

From 140e36bf3ff3e505ae918dcc4869cd5ee2f01dc8 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Thu, 30 Nov 2023 10:00:22 -0800
Subject: [PATCH 32/54] add stdoutput

---
 .buildkite/scripts/run_models.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 3904f21e..d0db07e4 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -20,6 +20,8 @@ if [ "$1" == "sqlserver" ]; then
     # brew install unixodbc
     pip uninstall -y pyodbc
     pip install --no-cache-dir --no-binary :all: pyodbc==4.0.39
+    which odbcinst
+    odbcinst -j
 else
     pip install -r integration_tests/requirements.txt
 fi

From 37282c58217b9fb9df2f8b8b09b70a97d946623f Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Thu, 30 Nov 2023 10:46:55 -0800
Subject: [PATCH 33/54] cat the DSN file

---
 .buildkite/scripts/run_models.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index d0db07e4..387ea08e 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -22,6 +22,7 @@ if [ "$1" == "sqlserver" ]; then
     pip install --no-cache-dir --no-binary :all: pyodbc==4.0.39
     which odbcinst
     odbcinst -j
+    cat /home/linuxbrew/.linuxbrew/etc/odbc.ini
 else
     pip install -r integration_tests/requirements.txt
 fi

From 5021033923130371e4d222ce83c801ec20d28374 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Thu, 30 Nov 2023 11:44:07 -0800
Subject: [PATCH 34/54] check which version of debian

---
 .buildkite/scripts/run_models.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 387ea08e..47586c7c 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -22,7 +22,8 @@ if [ "$1" == "sqlserver" ]; then
     pip install --no-cache-dir --no-binary :all: pyodbc==4.0.39
     which odbcinst
     odbcinst -j
-    cat /home/linuxbrew/.linuxbrew/etc/odbc.ini
+    # cat /home/linuxbrew/.linuxbrew/etc/odbc.ini
+    lsb_release -a
 else
     pip install -r integration_tests/requirements.txt
 fi

From 51b203949fbcbbe233e82db84912f7c79cbeb35c Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Thu, 30 Nov 2023 12:02:12 -0800
Subject: [PATCH 35/54] try the debian 12 way

---
 .buildkite/scripts/run_models.sh | 35 ++++++++++++++++++++++----------
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 47586c7c..461a0dc6 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -9,21 +9,34 @@ python3 -m venv venv
 pip install --upgrade pip setuptools
 if [ "$1" == "sqlserver" ]; then
     pip install -r integration_tests/requirements_sqlserver.txt
-    CI=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
-    eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
-    brew update
-    brew install gcc
-    brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
-    HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql18 mssql-tools18
+
+    ## brew 
+    # CI=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
+    # eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
+    # brew update
+    # brew install gcc
+    # brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
+    # HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql18 mssql-tools18
+    # brew install unixodbc
+
+    ## debian 12
+    curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc
+    curl https://packages.microsoft.com/config/debian/12/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
+    apt-get update
+    ACCEPT_EULA=Y apt-get install -y msodbcsql18
+    ACCEPT_EULA=Y apt-get install -y mssql-tools18
+    echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
+    source ~/.bashrc
     apt-get -y install unixodbc-dev
     apt-get update
-    # brew install unixodbc
+    
+    # works i think
     pip uninstall -y pyodbc
     pip install --no-cache-dir --no-binary :all: pyodbc==4.0.39
-    which odbcinst
-    odbcinst -j
-    # cat /home/linuxbrew/.linuxbrew/etc/odbc.ini
-    lsb_release -a
+    
+    # which odbcinst
+    # odbcinst -j
+
 else
     pip install -r integration_tests/requirements.txt
 fi

From f5d1d542f240899347aa7753a685d2eb258041c7 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Thu, 30 Nov 2023 12:22:04 -0800
Subject: [PATCH 36/54] add echos

---
 .buildkite/scripts/run_models.sh | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 461a0dc6..b02d244f 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -22,20 +22,25 @@ if [ "$1" == "sqlserver" ]; then
     ## debian 12
     curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc
     curl https://packages.microsoft.com/config/debian/12/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
+    echo "CURLing MS packages"
     apt-get update
+    echo "apt-get updated after CURLing stuff"
     ACCEPT_EULA=Y apt-get install -y msodbcsql18
     ACCEPT_EULA=Y apt-get install -y mssql-tools18
+    echo "installed MS packages"
     echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
     source ~/.bashrc
     apt-get -y install unixodbc-dev
+    echo "installed UnixODBC"
     apt-get update
+    echo "apt-get updated after installing stuff"
     
     # works i think
     pip uninstall -y pyodbc
     pip install --no-cache-dir --no-binary :all: pyodbc==4.0.39
-    
-    # which odbcinst
-    # odbcinst -j
+
+    which odbcinst
+    odbcinst -j
 
 else
     pip install -r integration_tests/requirements.txt

From f7702dd4e3f76a47e74ad713a9920724c7a040d3 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Thu, 30 Nov 2023 15:15:43 -0800
Subject: [PATCH 37/54] public key for debian

---
 .buildkite/scripts/run_models.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index b02d244f..d6b5580f 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -23,8 +23,11 @@ if [ "$1" == "sqlserver" ]; then
     curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc
     curl https://packages.microsoft.com/config/debian/12/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
     echo "CURLing MS packages"
+    apt-get install debian-archive-keyring
+    apt-key update
+    echo "apt-KEY updated after CURLing stuff"
     apt-get update
-    echo "apt-get updated after CURLing stuff"
+    echo "apt-GET updated after CURLing stuff"
     ACCEPT_EULA=Y apt-get install -y msodbcsql18
     ACCEPT_EULA=Y apt-get install -y mssql-tools18
     echo "installed MS packages"
@@ -34,7 +37,7 @@ if [ "$1" == "sqlserver" ]; then
     echo "installed UnixODBC"
     apt-get update
     echo "apt-get updated after installing stuff"
-    
+
     # works i think
     pip uninstall -y pyodbc
     pip install --no-cache-dir --no-binary :all: pyodbc==4.0.39

From 6c0e27d59a9a81e1629ad54c734f6a872f037625 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Thu, 30 Nov 2023 15:27:17 -0800
Subject: [PATCH 38/54] use different curl command for microsoft keys

---
 .buildkite/scripts/run_models.sh | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index d6b5580f..f8639992 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -20,12 +20,11 @@ if [ "$1" == "sqlserver" ]; then
     # brew install unixodbc
 
     ## debian 12
-    curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc
+    # curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc
+    curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/packages.microsoft.gpg
     curl https://packages.microsoft.com/config/debian/12/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
     echo "CURLing MS packages"
-    apt-get install debian-archive-keyring
-    apt-key update
-    echo "apt-KEY updated after CURLing stuff"
+    # apt-get install debian-archive-keyring
     apt-get update
     echo "apt-GET updated after CURLing stuff"
     ACCEPT_EULA=Y apt-get install -y msodbcsql18

From 04a38dfe753a4b92a71698fa64a4fbe80c390ba3 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Thu, 30 Nov 2023 16:17:38 -0800
Subject: [PATCH 39/54] try out solution from
 https://github.com/MicrosoftDocs/microsoft-365-docs/issues/12660

---
 .buildkite/scripts/run_models.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index f8639992..2bfeadfc 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -21,8 +21,10 @@ if [ "$1" == "sqlserver" ]; then
 
     ## debian 12
     # curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc
-    curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/packages.microsoft.gpg
-    curl https://packages.microsoft.com/config/debian/12/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
+    # curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/packages.microsoft.gpg
+    curl -sSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /usr/share/keyrings/microsoft-prod.gpg
+    curl -sSL https://packages.microsoft.com/config/debian/12/prod.list > /etc/apt/sources.list.d/mssql-release.list
+    # curl https://packages.microsoft.com/config/debian/12/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
     echo "CURLing MS packages"
     # apt-get install debian-archive-keyring
     apt-get update

From 238ba98ef65f036537630932ec3c13ca9f981062 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Fri, 1 Dec 2023 15:49:54 -0800
Subject: [PATCH 40/54] polish

---
 .buildkite/pipeline.yml           | 138 +++++++++++++++---------------
 CHANGELOG.md                      |   4 +
 README.md                         |   2 +-
 dbt_project.yml                   |   2 +-
 integration_tests/dbt_project.yml |   2 +-
 5 files changed, 76 insertions(+), 72 deletions(-)

diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml
index c81a3090..4903aa30 100644
--- a/.buildkite/pipeline.yml
+++ b/.buildkite/pipeline.yml
@@ -1,77 +1,77 @@
 steps:
-  # - label: ":postgres: Run Tests - Postgres"
-  #   key: "run-dbt-postgres"
-  #   plugins:
-  #     - docker#v3.13.0:
-  #         image: "python:3.8"
-  #         shell: [ "/bin/bash", "-e", "-c" ]
-  #         environment:
-  #           - "BASH_ENV=/tmp/.bashrc"
-  #           - "CI_POSTGRES_DBT_DBNAME"
-  #           - "CI_POSTGRES_DBT_HOST"
-  #           - "CI_POSTGRES_DBT_PASS"
-  #           - "CI_POSTGRES_DBT_USER"
-  #   commands: |
-  #     bash .buildkite/scripts/run_models.sh postgres 
+  - label: ":postgres: Run Tests - Postgres"
+    key: "run-dbt-postgres"
+    plugins:
+      - docker#v3.13.0:
+          image: "python:3.8"
+          shell: [ "/bin/bash", "-e", "-c" ]
+          environment:
+            - "BASH_ENV=/tmp/.bashrc"
+            - "CI_POSTGRES_DBT_DBNAME"
+            - "CI_POSTGRES_DBT_HOST"
+            - "CI_POSTGRES_DBT_PASS"
+            - "CI_POSTGRES_DBT_USER"
+    commands: |
+      bash .buildkite/scripts/run_models.sh postgres 
 
-  # - label: ":snowflake-db: Run Tests - Snowflake"
-  #   key: "run_dbt_snowflake"
-  #   plugins:
-  #     - docker#v3.13.0:
-  #         image: "python:3.8"
-  #         shell: [ "/bin/bash", "-e", "-c" ]
-  #         environment:
-  #           - "BASH_ENV=/tmp/.bashrc"
-  #           - "CI_SNOWFLAKE_DBT_ACCOUNT"
-  #           - "CI_SNOWFLAKE_DBT_DATABASE"
-  #           - "CI_SNOWFLAKE_DBT_PASS"
-  #           - "CI_SNOWFLAKE_DBT_ROLE"
-  #           - "CI_SNOWFLAKE_DBT_USER"
-  #           - "CI_SNOWFLAKE_DBT_WAREHOUSE"
-  #   commands: |
-  #     bash .buildkite/scripts/run_models.sh snowflake
+  - label: ":snowflake-db: Run Tests - Snowflake"
+    key: "run_dbt_snowflake"
+    plugins:
+      - docker#v3.13.0:
+          image: "python:3.8"
+          shell: [ "/bin/bash", "-e", "-c" ]
+          environment:
+            - "BASH_ENV=/tmp/.bashrc"
+            - "CI_SNOWFLAKE_DBT_ACCOUNT"
+            - "CI_SNOWFLAKE_DBT_DATABASE"
+            - "CI_SNOWFLAKE_DBT_PASS"
+            - "CI_SNOWFLAKE_DBT_ROLE"
+            - "CI_SNOWFLAKE_DBT_USER"
+            - "CI_SNOWFLAKE_DBT_WAREHOUSE"
+    commands: |
+      bash .buildkite/scripts/run_models.sh snowflake
 
-  # - label: ":gcloud: Run Tests - BigQuery"
-  #   key: "run_dbt_bigquery"
-  #   plugins:
-  #     - docker#v3.13.0:
-  #         image: "python:3.8"
-  #         shell: [ "/bin/bash", "-e", "-c" ]
-  #         environment:
-  #           - "BASH_ENV=/tmp/.bashrc"
-  #           - "GCLOUD_SERVICE_KEY"
-  #   commands: |
-  #     bash .buildkite/scripts/run_models.sh bigquery
+  - label: ":gcloud: Run Tests - BigQuery"
+    key: "run_dbt_bigquery"
+    plugins:
+      - docker#v3.13.0:
+          image: "python:3.8"
+          shell: [ "/bin/bash", "-e", "-c" ]
+          environment:
+            - "BASH_ENV=/tmp/.bashrc"
+            - "GCLOUD_SERVICE_KEY"
+    commands: |
+      bash .buildkite/scripts/run_models.sh bigquery
 
-  # - label: ":amazon-redshift: Run Tests - Redshift"
-  #   key: "run_dbt_redshift"
-  #   plugins:
-  #     - docker#v3.13.0:
-  #         image: "python:3.8"
-  #         shell: [ "/bin/bash", "-e", "-c" ]
-  #         environment:
-  #           - "BASH_ENV=/tmp/.bashrc"
-  #           - "CI_REDSHIFT_DBT_DBNAME"
-  #           - "CI_REDSHIFT_DBT_HOST"
-  #           - "CI_REDSHIFT_DBT_PASS"
-  #           - "CI_REDSHIFT_DBT_USER"
-  #   commands: |
-  #     bash .buildkite/scripts/run_models.sh redshift
+  - label: ":amazon-redshift: Run Tests - Redshift"
+    key: "run_dbt_redshift"
+    plugins:
+      - docker#v3.13.0:
+          image: "python:3.8"
+          shell: [ "/bin/bash", "-e", "-c" ]
+          environment:
+            - "BASH_ENV=/tmp/.bashrc"
+            - "CI_REDSHIFT_DBT_DBNAME"
+            - "CI_REDSHIFT_DBT_HOST"
+            - "CI_REDSHIFT_DBT_PASS"
+            - "CI_REDSHIFT_DBT_USER"
+    commands: |
+      bash .buildkite/scripts/run_models.sh redshift
 
-  # - label: ":bricks: Run Tests - Databricks"
-  #   key: "run_dbt_databricks"
-  #   plugins:
-  #     - docker#v3.13.0:
-  #         image: "python:3.8"
-  #         shell: [ "/bin/bash", "-e", "-c" ]
-  #         environment:
-  #           - "BASH_ENV=/tmp/.bashrc"
-  #           - "CI_DATABRICKS_DBT_HOST"
-  #           - "CI_DATABRICKS_DBT_HTTP_PATH"
-  #           - "CI_DATABRICKS_DBT_TOKEN"
-  #           - "CI_DATABRICKS_DBT_CATALOG"
-  #   commands: |
-  #     bash .buildkite/scripts/run_models.sh databricks
+  - label: ":bricks: Run Tests - Databricks"
+    key: "run_dbt_databricks"
+    plugins:
+      - docker#v3.13.0:
+          image: "python:3.8"
+          shell: [ "/bin/bash", "-e", "-c" ]
+          environment:
+            - "BASH_ENV=/tmp/.bashrc"
+            - "CI_DATABRICKS_DBT_HOST"
+            - "CI_DATABRICKS_DBT_HTTP_PATH"
+            - "CI_DATABRICKS_DBT_TOKEN"
+            - "CI_DATABRICKS_DBT_CATALOG"
+    commands: |
+      bash .buildkite/scripts/run_models.sh databricks
 
   - label: ":azure: Run Tests - SQLServer"
     key: "run_dbt_sqlserver"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bb066508..5a94ebfc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+# dbt_fivetran_log v1.3.1
+
+This release introduces compatibility with **SQL Server** 🥳  🎆  🍾
+
 # dbt_fivetran_log v1.3.0
 
 ## 🚨 Breaking Changes 🚨
diff --git a/README.md b/README.md
index 82fa48b9..7665dc88 100644
--- a/README.md
+++ b/README.md
@@ -42,7 +42,7 @@ Refer to the table below for a detailed view of all models materialized by defau
 # 🎯 How do I use the dbt package?
 ## Step 1: Pre-Requisites
 - **Connector**: Have the Fivetran Platform connector syncing data into your warehouse. 
-- **Database support**: This package has been tested on **BigQuery**, **Snowflake**, **Redshift**, **Postgres**, and **Databricks**. Ensure you are using one of these supported databases.
+- **Database support**: This package has been tested on **BigQuery**, **Snowflake**, **Redshift**, **Postgres**, **Databricks**, and **SQL Server**. Ensure you are using one of these supported databases.
 
 ### Databricks Dispatch Configuration
 If you are using a Databricks destination with this package you will need to add the below (or a variation of the below) dispatch configuration within your `dbt_project.yml`. This is required in order for the package to accurately search for macros within the `dbt-labs/spark_utils` then the `dbt-labs/dbt_utils` packages respectively.
diff --git a/dbt_project.yml b/dbt_project.yml
index 65d827a6..94364207 100644
--- a/dbt_project.yml
+++ b/dbt_project.yml
@@ -1,6 +1,6 @@
 config-version: 2
 name: 'fivetran_log'
-version: '1.3.0'
+version: '1.3.1'
 require-dbt-version: [">=1.3.0", "<2.0.0"]
 
 models:
diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml
index 787826e4..8042247f 100644
--- a/integration_tests/dbt_project.yml
+++ b/integration_tests/dbt_project.yml
@@ -1,5 +1,5 @@
 name: 'fivetran_log_integration_tests'
-version: '1.3.0'
+version: '1.3.1'
 
 config-version: 2
 profile: 'integration_tests'

From 438c47ad01e4202f5eccea13f75cbc6791b44f5b Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Mon, 4 Dec 2023 12:48:00 -0800
Subject: [PATCH 41/54] fix grain of user audit activity model

---
 CHANGELOG.md                 |  7 +++++++
 models/fivetran_platform.yml | 10 ++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index bb066508..7a4f1434 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+# dbt_fivetran_log v1.3.1
+
+## Bug Fixes
+- Adjusts the uniqueness test on the recently introduced `fivetran_platform__audit_user_activity` model.
+  - Previously, the `log_id` was erroneously considered the primary key of this model.
+  - Now, the model tests for unique combinations of `log_id` and `occurred_at`.
+
 # dbt_fivetran_log v1.3.0
 
 ## 🚨 Breaking Changes 🚨
diff --git a/models/fivetran_platform.yml b/models/fivetran_platform.yml
index 8f54474c..11ff749d 100644
--- a/models/fivetran_platform.yml
+++ b/models/fivetran_platform.yml
@@ -287,6 +287,11 @@ models:
       Each record represents a user-triggered action in your Fivetran instance.This model is intended for audit-trail purposes, as it can be very helpful
       when trying to trace a user action to a [log event](https://fivetran.com/docs/logs#logeventlist) such as a schema change, sync frequency update, 
       manual update, broken connection, etc.
+    tests:
+      - dbt_utils.unique_combination_of_columns:
+          combination_of_columns: 
+            - log_id
+            - occurred_at
     columns:
       - name: date_day
         description: Date on which the user action occurred.
@@ -323,7 +328,4 @@ models:
       - name: message_data
         description: The details of the event in JSON format.
       - name: log_id
-        description: Unique ID of the log record.
-        tests:
-          - unique
-          - not_null
\ No newline at end of file
+        description: Unique ID of the log record.
\ No newline at end of file

From c809ead2fc3ce1b3058dff6b8f6fcdffccf555c6 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Tue, 5 Dec 2023 11:11:51 -0800
Subject: [PATCH 42/54] changelog with pr link

---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7a4f1434..7689052c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,7 @@
 # dbt_fivetran_log v1.3.1
 
 ## Bug Fixes
+[PR #102](https://github.com/fivetran/dbt_fivetran_log/pull/102) applies the following update:
 - Adjusts the uniqueness test on the recently introduced `fivetran_platform__audit_user_activity` model.
   - Previously, the `log_id` was erroneously considered the primary key of this model.
   - Now, the model tests for unique combinations of `log_id` and `occurred_at`.

From 733a70072e1fc1ee6893bafd30e085965b26eb96 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 6 Dec 2023 16:03:32 -0800
Subject: [PATCH 43/54] cleanup

---
 .buildkite/scripts/run_models.sh | 24 ++----------------------
 packages.yml                     |  3 ---
 2 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 2bfeadfc..3c5f34de 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -10,41 +10,21 @@ pip install --upgrade pip setuptools
 if [ "$1" == "sqlserver" ]; then
     pip install -r integration_tests/requirements_sqlserver.txt
 
-    ## brew 
-    # CI=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
-    # eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
-    # brew update
-    # brew install gcc
-    # brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
-    # HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql18 mssql-tools18
-    # brew install unixodbc
-
-    ## debian 12
-    # curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc
-    # curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/packages.microsoft.gpg
     curl -sSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /usr/share/keyrings/microsoft-prod.gpg
     curl -sSL https://packages.microsoft.com/config/debian/12/prod.list > /etc/apt/sources.list.d/mssql-release.list
-    # curl https://packages.microsoft.com/config/debian/12/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
-    echo "CURLing MS packages"
-    # apt-get install debian-archive-keyring
+
     apt-get update
-    echo "apt-GET updated after CURLing stuff"
     ACCEPT_EULA=Y apt-get install -y msodbcsql18
     ACCEPT_EULA=Y apt-get install -y mssql-tools18
-    echo "installed MS packages"
     echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
     source ~/.bashrc
     apt-get -y install unixodbc-dev
-    echo "installed UnixODBC"
     apt-get update
-    echo "apt-get updated after installing stuff"
 
-    # works i think
     pip uninstall -y pyodbc
     pip install --no-cache-dir --no-binary :all: pyodbc==4.0.39
 
-    which odbcinst
-    odbcinst -j
+    # odbcinst -j
 
 else
     pip install -r integration_tests/requirements.txt
diff --git a/packages.yml b/packages.yml
index 2f7246c2..89673e52 100644
--- a/packages.yml
+++ b/packages.yml
@@ -8,8 +8,5 @@ packages:
 - package: dbt-labs/spark_utils
   version: [">=0.3.0", "<0.4.0"]
 
-# - package: dbt-msft/tsql_utils
-#   version: [">=0.9.0", "<1.0.0"]
-
 - package: calogica/dbt_date
   version: [">=0.9.0", "<1.0.0"]
\ No newline at end of file

From 8ad1cfb31603936308dfef6b1b1dfbc537d0ddc4 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Thu, 7 Dec 2023 10:44:57 -0800
Subject: [PATCH 44/54] Update CHANGELOG.md

Co-authored-by: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com>
---
 CHANGELOG.md | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7689052c..c58f3bc1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,9 +2,8 @@
 
 ## Bug Fixes
 [PR #102](https://github.com/fivetran/dbt_fivetran_log/pull/102) applies the following update:
-- Adjusts the uniqueness test on the recently introduced `fivetran_platform__audit_user_activity` model.
+- Adjusts the uniqueness test on the recently introduced `fivetran_platform__audit_user_activity` model to test on `log_id` and `occurred_at`.
   - Previously, the `log_id` was erroneously considered the primary key of this model.
-  - Now, the model tests for unique combinations of `log_id` and `occurred_at`.
 
 # dbt_fivetran_log v1.3.0
 

From a30d24779fc4be6e1d481077ea352b307f964aca Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Thu, 7 Dec 2023 12:35:28 -0800
Subject: [PATCH 45/54] fivetran utils release

---
 packages.yml | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/packages.yml b/packages.yml
index 89673e52..58289031 100644
--- a/packages.yml
+++ b/packages.yml
@@ -1,9 +1,6 @@
 packages:
-# - package: fivetran/fivetran_utils
-#   version: [">=0.4.0", "<0.5.0"]
-- git: https://github.com/fivetran/dbt_fivetran_utils.git
-  revision: feature/sql-server-compatibility
-  warn-unpinned: false
+- package: fivetran/fivetran_utils
+  version: [">=0.4.0", "<0.5.0"]
   
 - package: dbt-labs/spark_utils
   version: [">=0.3.0", "<0.4.0"]

From a9678008918320934c7e122f31cc575d3a2928b2 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Mon, 11 Dec 2023 16:18:41 -0800
Subject: [PATCH 46/54] get sqlserver workign

---
 .buildkite/pipeline.yml           | 138 +++++++++++++++---------------
 integration_tests/dbt_project.yml |  18 ++--
 2 files changed, 78 insertions(+), 78 deletions(-)

diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml
index 4903aa30..c81a3090 100644
--- a/.buildkite/pipeline.yml
+++ b/.buildkite/pipeline.yml
@@ -1,77 +1,77 @@
 steps:
-  - label: ":postgres: Run Tests - Postgres"
-    key: "run-dbt-postgres"
-    plugins:
-      - docker#v3.13.0:
-          image: "python:3.8"
-          shell: [ "/bin/bash", "-e", "-c" ]
-          environment:
-            - "BASH_ENV=/tmp/.bashrc"
-            - "CI_POSTGRES_DBT_DBNAME"
-            - "CI_POSTGRES_DBT_HOST"
-            - "CI_POSTGRES_DBT_PASS"
-            - "CI_POSTGRES_DBT_USER"
-    commands: |
-      bash .buildkite/scripts/run_models.sh postgres 
+  # - label: ":postgres: Run Tests - Postgres"
+  #   key: "run-dbt-postgres"
+  #   plugins:
+  #     - docker#v3.13.0:
+  #         image: "python:3.8"
+  #         shell: [ "/bin/bash", "-e", "-c" ]
+  #         environment:
+  #           - "BASH_ENV=/tmp/.bashrc"
+  #           - "CI_POSTGRES_DBT_DBNAME"
+  #           - "CI_POSTGRES_DBT_HOST"
+  #           - "CI_POSTGRES_DBT_PASS"
+  #           - "CI_POSTGRES_DBT_USER"
+  #   commands: |
+  #     bash .buildkite/scripts/run_models.sh postgres 
 
-  - label: ":snowflake-db: Run Tests - Snowflake"
-    key: "run_dbt_snowflake"
-    plugins:
-      - docker#v3.13.0:
-          image: "python:3.8"
-          shell: [ "/bin/bash", "-e", "-c" ]
-          environment:
-            - "BASH_ENV=/tmp/.bashrc"
-            - "CI_SNOWFLAKE_DBT_ACCOUNT"
-            - "CI_SNOWFLAKE_DBT_DATABASE"
-            - "CI_SNOWFLAKE_DBT_PASS"
-            - "CI_SNOWFLAKE_DBT_ROLE"
-            - "CI_SNOWFLAKE_DBT_USER"
-            - "CI_SNOWFLAKE_DBT_WAREHOUSE"
-    commands: |
-      bash .buildkite/scripts/run_models.sh snowflake
+  # - label: ":snowflake-db: Run Tests - Snowflake"
+  #   key: "run_dbt_snowflake"
+  #   plugins:
+  #     - docker#v3.13.0:
+  #         image: "python:3.8"
+  #         shell: [ "/bin/bash", "-e", "-c" ]
+  #         environment:
+  #           - "BASH_ENV=/tmp/.bashrc"
+  #           - "CI_SNOWFLAKE_DBT_ACCOUNT"
+  #           - "CI_SNOWFLAKE_DBT_DATABASE"
+  #           - "CI_SNOWFLAKE_DBT_PASS"
+  #           - "CI_SNOWFLAKE_DBT_ROLE"
+  #           - "CI_SNOWFLAKE_DBT_USER"
+  #           - "CI_SNOWFLAKE_DBT_WAREHOUSE"
+  #   commands: |
+  #     bash .buildkite/scripts/run_models.sh snowflake
 
-  - label: ":gcloud: Run Tests - BigQuery"
-    key: "run_dbt_bigquery"
-    plugins:
-      - docker#v3.13.0:
-          image: "python:3.8"
-          shell: [ "/bin/bash", "-e", "-c" ]
-          environment:
-            - "BASH_ENV=/tmp/.bashrc"
-            - "GCLOUD_SERVICE_KEY"
-    commands: |
-      bash .buildkite/scripts/run_models.sh bigquery
+  # - label: ":gcloud: Run Tests - BigQuery"
+  #   key: "run_dbt_bigquery"
+  #   plugins:
+  #     - docker#v3.13.0:
+  #         image: "python:3.8"
+  #         shell: [ "/bin/bash", "-e", "-c" ]
+  #         environment:
+  #           - "BASH_ENV=/tmp/.bashrc"
+  #           - "GCLOUD_SERVICE_KEY"
+  #   commands: |
+  #     bash .buildkite/scripts/run_models.sh bigquery
 
-  - label: ":amazon-redshift: Run Tests - Redshift"
-    key: "run_dbt_redshift"
-    plugins:
-      - docker#v3.13.0:
-          image: "python:3.8"
-          shell: [ "/bin/bash", "-e", "-c" ]
-          environment:
-            - "BASH_ENV=/tmp/.bashrc"
-            - "CI_REDSHIFT_DBT_DBNAME"
-            - "CI_REDSHIFT_DBT_HOST"
-            - "CI_REDSHIFT_DBT_PASS"
-            - "CI_REDSHIFT_DBT_USER"
-    commands: |
-      bash .buildkite/scripts/run_models.sh redshift
+  # - label: ":amazon-redshift: Run Tests - Redshift"
+  #   key: "run_dbt_redshift"
+  #   plugins:
+  #     - docker#v3.13.0:
+  #         image: "python:3.8"
+  #         shell: [ "/bin/bash", "-e", "-c" ]
+  #         environment:
+  #           - "BASH_ENV=/tmp/.bashrc"
+  #           - "CI_REDSHIFT_DBT_DBNAME"
+  #           - "CI_REDSHIFT_DBT_HOST"
+  #           - "CI_REDSHIFT_DBT_PASS"
+  #           - "CI_REDSHIFT_DBT_USER"
+  #   commands: |
+  #     bash .buildkite/scripts/run_models.sh redshift
 
-  - label: ":bricks: Run Tests - Databricks"
-    key: "run_dbt_databricks"
-    plugins:
-      - docker#v3.13.0:
-          image: "python:3.8"
-          shell: [ "/bin/bash", "-e", "-c" ]
-          environment:
-            - "BASH_ENV=/tmp/.bashrc"
-            - "CI_DATABRICKS_DBT_HOST"
-            - "CI_DATABRICKS_DBT_HTTP_PATH"
-            - "CI_DATABRICKS_DBT_TOKEN"
-            - "CI_DATABRICKS_DBT_CATALOG"
-    commands: |
-      bash .buildkite/scripts/run_models.sh databricks
+  # - label: ":bricks: Run Tests - Databricks"
+  #   key: "run_dbt_databricks"
+  #   plugins:
+  #     - docker#v3.13.0:
+  #         image: "python:3.8"
+  #         shell: [ "/bin/bash", "-e", "-c" ]
+  #         environment:
+  #           - "BASH_ENV=/tmp/.bashrc"
+  #           - "CI_DATABRICKS_DBT_HOST"
+  #           - "CI_DATABRICKS_DBT_HTTP_PATH"
+  #           - "CI_DATABRICKS_DBT_TOKEN"
+  #           - "CI_DATABRICKS_DBT_CATALOG"
+  #   commands: |
+  #     bash .buildkite/scripts/run_models.sh databricks
 
   - label: ":azure: Run Tests - SQLServer"
     key: "run_dbt_sqlserver"
diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml
index 8042247f..517bdb5d 100644
--- a/integration_tests/dbt_project.yml
+++ b/integration_tests/dbt_project.yml
@@ -29,35 +29,35 @@ models:
 seeds:
   fivetran_log_integration_tests:
     +column_types:
-      _fivetran_synced: timestamp
+      _fivetran_synced: "{{ 'datetime' if target.type == 'sqlserver' else 'timestamp' }}"
     account:
       +column_types:
-        created_at: timestamp
+        created_at: "{{ 'datetime' if target.type == 'sqlserver' else 'timestamp' }}"
     incremental_mar:
       +column_types:
-        measured_date: timestamp
+        measured_date: "{{ 'datetime' if target.type == 'sqlserver' else 'timestamp' }}"
         incremental_rows: "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"
     connector:
       +column_types:
-        signed_up: timestamp
+        signed_up: "{{ 'datetime' if target.type == 'sqlserver' else 'timestamp' }}"
     credits_used:
       +column_types:
         credits_consumed: "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"
     destination:
       +column_types:
-        created_at: timestamp
+        created_at: "{{ 'datetime' if target.type == 'sqlserver' else 'timestamp' }}"
         id: "{{ 'string' if target.type in ('bigquery', 'spark', 'databricks') else 'varchar' }}"
     destination_membership:
       +column_types:
-        activated_at: timestamp
-        joined_at: timestamp
+        activated_at: "{{ 'datetime' if target.type == 'sqlserver' else 'timestamp' }}"
+        joined_at: "{{ 'datetime' if target.type == 'sqlserver' else 'timestamp' }}"
     log:
       +column_types:
-        time_stamp: timestamp
+        time_stamp: "{{ 'datetime' if target.type == 'sqlserver' else 'timestamp' }}"
         transformation_id:  "{{ 'string' if target.type in ('bigquery', 'spark', 'databricks') else 'varchar' }}"
     user:
       +column_types:
-        created_at: timestamp
+        created_at: "{{ 'datetime' if target.type == 'sqlserver' else 'timestamp' }}"
 
 clean-targets:         # directories to be removed by `dbt clean`
   - "target"

From 595c2864d1c756bcc387977902f6275e3f483a24 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Mon, 11 Dec 2023 16:30:55 -0800
Subject: [PATCH 47/54] seeds

---
 integration_tests/dbt_project.yml | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml
index 517bdb5d..0c1cc5e4 100644
--- a/integration_tests/dbt_project.yml
+++ b/integration_tests/dbt_project.yml
@@ -29,35 +29,35 @@ models:
 seeds:
   fivetran_log_integration_tests:
     +column_types:
-      _fivetran_synced: "{{ 'datetime' if target.type == 'sqlserver' else 'timestamp' }}"
+      _fivetran_synced: "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"
     account:
       +column_types:
-        created_at: "{{ 'datetime' if target.type == 'sqlserver' else 'timestamp' }}"
+        created_at: "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"
     incremental_mar:
       +column_types:
-        measured_date: "{{ 'datetime' if target.type == 'sqlserver' else 'timestamp' }}"
+        measured_date: "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"
         incremental_rows: "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"
     connector:
       +column_types:
-        signed_up: "{{ 'datetime' if target.type == 'sqlserver' else 'timestamp' }}"
+        signed_up: "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"
     credits_used:
       +column_types:
         credits_consumed: "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"
     destination:
       +column_types:
-        created_at: "{{ 'datetime' if target.type == 'sqlserver' else 'timestamp' }}"
-        id: "{{ 'string' if target.type in ('bigquery', 'spark', 'databricks') else 'varchar' }}"
+        created_at: "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"
+        id: "{{ 'string' if target.type in ('bigquery', 'spark', 'databricks') else 'varchar' if target.type != 'sqlserver' else 'varchar(256)' }}"
     destination_membership:
       +column_types:
-        activated_at: "{{ 'datetime' if target.type == 'sqlserver' else 'timestamp' }}"
-        joined_at: "{{ 'datetime' if target.type == 'sqlserver' else 'timestamp' }}"
+        activated_at: "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"
+        joined_at: "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"
     log:
       +column_types:
-        time_stamp: "{{ 'datetime' if target.type == 'sqlserver' else 'timestamp' }}"
-        transformation_id:  "{{ 'string' if target.type in ('bigquery', 'spark', 'databricks') else 'varchar' }}"
+        time_stamp: "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"
+        transformation_id:  "{{ 'string' if target.type in ('bigquery', 'spark', 'databricks') else 'varchar' if target.type != 'sqlserver' else 'varchar(256)' }}"
     user:
       +column_types:
-        created_at: "{{ 'datetime' if target.type == 'sqlserver' else 'timestamp' }}"
+        created_at: "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"
 
 clean-targets:         # directories to be removed by `dbt clean`
   - "target"

From b03ccb49aca16725f3536e7df320ff87eaaef367 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Mon, 11 Dec 2023 16:36:14 -0800
Subject: [PATCH 48/54] reference fivetran_DATE_SPINE

---
 models/fivetran_platform__connector_daily_events.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/models/fivetran_platform__connector_daily_events.sql b/models/fivetran_platform__connector_daily_events.sql
index 9431d023..b6b78e37 100644
--- a/models/fivetran_platform__connector_daily_events.sql
+++ b/models/fivetran_platform__connector_daily_events.sql
@@ -74,7 +74,7 @@ spine as (
 
     select cast(date_day as date) as date_day
     from (
-        {{ fivetran_utils.date_spine(
+        {{ fivetran_utils.fivetran_date_spine(
             datepart = "day", 
             start_date =  "cast('" ~ first_date[0:10] ~ "' as date)", 
             end_date = dbt.dateadd("week", 1, dbt.date_trunc('day', dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp())) 

From 0d0efec246ee91458fec0af80311726e09cb5fed Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Mon, 11 Dec 2023 16:49:51 -0800
Subject: [PATCH 49/54] branch of fivetran utils

---
 packages.yml | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/packages.yml b/packages.yml
index 58289031..290930c9 100644
--- a/packages.yml
+++ b/packages.yml
@@ -1,7 +1,10 @@
 packages:
-- package: fivetran/fivetran_utils
-  version: [">=0.4.0", "<0.5.0"]
-  
+# - package: fivetran/fivetran_utils
+#   version: [">=0.4.0", "<0.5.0"]
+- git: https://github.com/fivetran/dbt_fivetran_utils.git
+  revision: feature/sql-server-compatibility
+  warn-unpinned: false
+
 - package: dbt-labs/spark_utils
   version: [">=0.3.0", "<0.4.0"]
 

From e1596a6d7bfd9b06d28aa66b8fede1711ffe1499 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Mon, 11 Dec 2023 16:57:35 -0800
Subject: [PATCH 50/54] re-add other WH steps

---
 .buildkite/pipeline.yml | 138 ++++++++++++++++++++--------------------
 1 file changed, 69 insertions(+), 69 deletions(-)

diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml
index c81a3090..4903aa30 100644
--- a/.buildkite/pipeline.yml
+++ b/.buildkite/pipeline.yml
@@ -1,77 +1,77 @@
 steps:
-  # - label: ":postgres: Run Tests - Postgres"
-  #   key: "run-dbt-postgres"
-  #   plugins:
-  #     - docker#v3.13.0:
-  #         image: "python:3.8"
-  #         shell: [ "/bin/bash", "-e", "-c" ]
-  #         environment:
-  #           - "BASH_ENV=/tmp/.bashrc"
-  #           - "CI_POSTGRES_DBT_DBNAME"
-  #           - "CI_POSTGRES_DBT_HOST"
-  #           - "CI_POSTGRES_DBT_PASS"
-  #           - "CI_POSTGRES_DBT_USER"
-  #   commands: |
-  #     bash .buildkite/scripts/run_models.sh postgres 
+  - label: ":postgres: Run Tests - Postgres"
+    key: "run-dbt-postgres"
+    plugins:
+      - docker#v3.13.0:
+          image: "python:3.8"
+          shell: [ "/bin/bash", "-e", "-c" ]
+          environment:
+            - "BASH_ENV=/tmp/.bashrc"
+            - "CI_POSTGRES_DBT_DBNAME"
+            - "CI_POSTGRES_DBT_HOST"
+            - "CI_POSTGRES_DBT_PASS"
+            - "CI_POSTGRES_DBT_USER"
+    commands: |
+      bash .buildkite/scripts/run_models.sh postgres 
 
-  # - label: ":snowflake-db: Run Tests - Snowflake"
-  #   key: "run_dbt_snowflake"
-  #   plugins:
-  #     - docker#v3.13.0:
-  #         image: "python:3.8"
-  #         shell: [ "/bin/bash", "-e", "-c" ]
-  #         environment:
-  #           - "BASH_ENV=/tmp/.bashrc"
-  #           - "CI_SNOWFLAKE_DBT_ACCOUNT"
-  #           - "CI_SNOWFLAKE_DBT_DATABASE"
-  #           - "CI_SNOWFLAKE_DBT_PASS"
-  #           - "CI_SNOWFLAKE_DBT_ROLE"
-  #           - "CI_SNOWFLAKE_DBT_USER"
-  #           - "CI_SNOWFLAKE_DBT_WAREHOUSE"
-  #   commands: |
-  #     bash .buildkite/scripts/run_models.sh snowflake
+  - label: ":snowflake-db: Run Tests - Snowflake"
+    key: "run_dbt_snowflake"
+    plugins:
+      - docker#v3.13.0:
+          image: "python:3.8"
+          shell: [ "/bin/bash", "-e", "-c" ]
+          environment:
+            - "BASH_ENV=/tmp/.bashrc"
+            - "CI_SNOWFLAKE_DBT_ACCOUNT"
+            - "CI_SNOWFLAKE_DBT_DATABASE"
+            - "CI_SNOWFLAKE_DBT_PASS"
+            - "CI_SNOWFLAKE_DBT_ROLE"
+            - "CI_SNOWFLAKE_DBT_USER"
+            - "CI_SNOWFLAKE_DBT_WAREHOUSE"
+    commands: |
+      bash .buildkite/scripts/run_models.sh snowflake
 
-  # - label: ":gcloud: Run Tests - BigQuery"
-  #   key: "run_dbt_bigquery"
-  #   plugins:
-  #     - docker#v3.13.0:
-  #         image: "python:3.8"
-  #         shell: [ "/bin/bash", "-e", "-c" ]
-  #         environment:
-  #           - "BASH_ENV=/tmp/.bashrc"
-  #           - "GCLOUD_SERVICE_KEY"
-  #   commands: |
-  #     bash .buildkite/scripts/run_models.sh bigquery
+  - label: ":gcloud: Run Tests - BigQuery"
+    key: "run_dbt_bigquery"
+    plugins:
+      - docker#v3.13.0:
+          image: "python:3.8"
+          shell: [ "/bin/bash", "-e", "-c" ]
+          environment:
+            - "BASH_ENV=/tmp/.bashrc"
+            - "GCLOUD_SERVICE_KEY"
+    commands: |
+      bash .buildkite/scripts/run_models.sh bigquery
 
-  # - label: ":amazon-redshift: Run Tests - Redshift"
-  #   key: "run_dbt_redshift"
-  #   plugins:
-  #     - docker#v3.13.0:
-  #         image: "python:3.8"
-  #         shell: [ "/bin/bash", "-e", "-c" ]
-  #         environment:
-  #           - "BASH_ENV=/tmp/.bashrc"
-  #           - "CI_REDSHIFT_DBT_DBNAME"
-  #           - "CI_REDSHIFT_DBT_HOST"
-  #           - "CI_REDSHIFT_DBT_PASS"
-  #           - "CI_REDSHIFT_DBT_USER"
-  #   commands: |
-  #     bash .buildkite/scripts/run_models.sh redshift
+  - label: ":amazon-redshift: Run Tests - Redshift"
+    key: "run_dbt_redshift"
+    plugins:
+      - docker#v3.13.0:
+          image: "python:3.8"
+          shell: [ "/bin/bash", "-e", "-c" ]
+          environment:
+            - "BASH_ENV=/tmp/.bashrc"
+            - "CI_REDSHIFT_DBT_DBNAME"
+            - "CI_REDSHIFT_DBT_HOST"
+            - "CI_REDSHIFT_DBT_PASS"
+            - "CI_REDSHIFT_DBT_USER"
+    commands: |
+      bash .buildkite/scripts/run_models.sh redshift
 
-  # - label: ":bricks: Run Tests - Databricks"
-  #   key: "run_dbt_databricks"
-  #   plugins:
-  #     - docker#v3.13.0:
-  #         image: "python:3.8"
-  #         shell: [ "/bin/bash", "-e", "-c" ]
-  #         environment:
-  #           - "BASH_ENV=/tmp/.bashrc"
-  #           - "CI_DATABRICKS_DBT_HOST"
-  #           - "CI_DATABRICKS_DBT_HTTP_PATH"
-  #           - "CI_DATABRICKS_DBT_TOKEN"
-  #           - "CI_DATABRICKS_DBT_CATALOG"
-  #   commands: |
-  #     bash .buildkite/scripts/run_models.sh databricks
+  - label: ":bricks: Run Tests - Databricks"
+    key: "run_dbt_databricks"
+    plugins:
+      - docker#v3.13.0:
+          image: "python:3.8"
+          shell: [ "/bin/bash", "-e", "-c" ]
+          environment:
+            - "BASH_ENV=/tmp/.bashrc"
+            - "CI_DATABRICKS_DBT_HOST"
+            - "CI_DATABRICKS_DBT_HTTP_PATH"
+            - "CI_DATABRICKS_DBT_TOKEN"
+            - "CI_DATABRICKS_DBT_CATALOG"
+    commands: |
+      bash .buildkite/scripts/run_models.sh databricks
 
   - label: ":azure: Run Tests - SQLServer"
     key: "run_dbt_sqlserver"

From c7a15637bbc526397742ee8deebb16a8dfc6e0ef Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Tue, 12 Dec 2023 10:41:00 -0800
Subject: [PATCH 51/54] swtich fivetran utils

---
 .buildkite/scripts/run_models.sh | 2 ++
 packages.yml                     | 7 ++-----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/.buildkite/scripts/run_models.sh b/.buildkite/scripts/run_models.sh
index 3c5f34de..f782944b 100644
--- a/.buildkite/scripts/run_models.sh
+++ b/.buildkite/scripts/run_models.sh
@@ -47,4 +47,6 @@ dbt test --target "$db"
 dbt run --vars '{fivetran_platform__usage_pricing: false, fivetran_platform_using_destination_membership: false, fivetran_platform_using_user: false}' --target "$db" --full-refresh
 dbt run --vars '{fivetran_platform__usage_pricing: false, fivetran_platform_using_destination_membership: false, fivetran_platform_using_user: false}' --target "$db"
 dbt test --target "$db"
+if [ "$1" != "sqlserver" ]; then
 dbt run-operation fivetran_utils.drop_schemas_automation --target "$db"
+fi
\ No newline at end of file
diff --git a/packages.yml b/packages.yml
index 290930c9..d55adedf 100644
--- a/packages.yml
+++ b/packages.yml
@@ -1,9 +1,6 @@
 packages:
-# - package: fivetran/fivetran_utils
-#   version: [">=0.4.0", "<0.5.0"]
-- git: https://github.com/fivetran/dbt_fivetran_utils.git
-  revision: feature/sql-server-compatibility
-  warn-unpinned: false
+- package: fivetran/fivetran_utils
+  version: [">=0.4.0", "<0.5.0"]
 
 - package: dbt-labs/spark_utils
   version: [">=0.3.0", "<0.4.0"]

From d542170b97ed7b396d1112397d47a8cbf9189874 Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Tue, 12 Dec 2023 11:11:30 -0800
Subject: [PATCH 52/54] docs

---
 .gitignore            | 3 ++-
 docs/catalog.json     | 2 +-
 docs/manifest.json    | 2 +-
 docs/run_results.json | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/.gitignore b/.gitignore
index 4dab99d9..ee0ba26d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,4 +6,5 @@ logs/
 .DS_Store
 dbt_packages/
 integration_tests/.DS_Store
-integration_tests/seeds/.DS_Store
\ No newline at end of file
+integration_tests/seeds/.DS_Store
+integration_tests/package-lock.yml
\ No newline at end of file
diff --git a/docs/catalog.json b/docs/catalog.json
index 4002c8cc..f9fca39d 100644
--- a/docs/catalog.json
+++ b/docs/catalog.json
@@ -1 +1 @@
-{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.7.0", "generated_at": "2023-11-14T18:04:19.853650Z", "invocation_id": "5e424184-132f-49e4-8bc7-f99dbda88d2d", "env": {}}, "nodes": {"seed.fivetran_log_integration_tests.usage_cost": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1", "name": "usage_cost", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "measured_month": {"type": "STRING", "index": 2, "name": "measured_month", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "amount": {"type": "FLOAT64", "index": 4, "name": "amount", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 164, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 4, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.usage_cost"}, "seed.fivetran_log_integration_tests.credits_used": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1", "name": "credits_used", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "measured_month": {"type": "STRING", "index": 2, "name": "measured_month", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "credits_consumed": {"type": "INT64", "index": 4, "name": "credits_consumed", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 74, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.credits_used"}, "seed.fivetran_log_integration_tests.log": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1", "name": "log", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "STRING", "index": 1, "name": "id", "comment": null}, "time_stamp": {"type": "TIMESTAMP", "index": 2, "name": "time_stamp", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "connector_id": {"type": "STRING", "index": 4, "name": "connector_id", "comment": null}, "event": {"type": "STRING", "index": 5, "name": "event", "comment": null}, "message_data": {"type": "STRING", "index": 6, "name": "message_data", "comment": null}, "message_event": {"type": "STRING", "index": 7, "name": "message_event", "comment": null}, "transformation_id": {"type": "STRING", "index": 8, "name": "transformation_id", "comment": null}, "sync_id": {"type": "STRING", "index": 9, "name": "sync_id", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 4596, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 30, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.log"}, "seed.fivetran_log_integration_tests.destination": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1", "name": "destination", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "STRING", "index": 1, "name": "id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "account_id": {"type": "STRING", "index": 3, "name": "account_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 4, "name": "created_at", "comment": null}, "name": {"type": "STRING", "index": 5, "name": "name", "comment": null}, "region": {"type": "STRING", "index": 6, "name": "region", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 139, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.destination"}, "seed.fivetran_log_integration_tests.account": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1", "name": "account", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "STRING", "index": 1, "name": "id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "country": {"type": "INT64", "index": 3, "name": "country", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 4, "name": "created_at", "comment": null}, "name": {"type": "STRING", "index": 5, "name": "name", "comment": null}, "status": {"type": "STRING", "index": 6, "name": "status", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 55, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 1, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.account"}, "seed.fivetran_log_integration_tests.connector": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1", "name": "connector", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_id": {"type": "STRING", "index": 1, "name": "connector_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "connecting_user_id": {"type": "STRING", "index": 3, "name": "connecting_user_id", "comment": null}, "connector_name": {"type": "STRING", "index": 4, "name": "connector_name", "comment": null}, "connector_type": {"type": "STRING", "index": 5, "name": "connector_type", "comment": null}, "destination_id": {"type": "STRING", "index": 6, "name": "destination_id", "comment": null}, "paused": {"type": "BOOL", "index": 7, "name": "paused", "comment": null}, "signed_up": {"type": "TIMESTAMP", "index": 8, "name": "signed_up", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 158, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.connector"}, "seed.fivetran_log_integration_tests.destination_membership": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1", "name": "destination_membership", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "user_id": {"type": "STRING", "index": 2, "name": "user_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "activated_at": {"type": "TIMESTAMP", "index": 4, "name": "activated_at", "comment": null}, "joined_at": {"type": "TIMESTAMP", "index": 5, "name": "joined_at", "comment": null}, "role": {"type": "STRING", "index": 6, "name": "role", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 125, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.destination_membership"}, "seed.fivetran_log_integration_tests.incremental_mar": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1", "name": "incremental_mar", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_id": {"type": "STRING", "index": 1, "name": "connector_id", "comment": null}, "destination_id": {"type": "STRING", "index": 2, "name": "destination_id", "comment": null}, "free_type": {"type": "STRING", "index": 3, "name": "free_type", "comment": null}, "measured_date": {"type": "TIMESTAMP", "index": 4, "name": "measured_date", "comment": null}, "schema_name": {"type": "STRING", "index": 5, "name": "schema_name", "comment": null}, "sync_type": {"type": "STRING", "index": 6, "name": "sync_type", "comment": null}, "table_name": {"type": "STRING", "index": 7, "name": "table_name", "comment": null}, "updated_at": {"type": "DATETIME", "index": 8, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 9, "name": "_fivetran_synced", "comment": null}, "incremental_rows": {"type": "INT64", "index": 10, "name": "incremental_rows", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 988, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 10, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.incremental_mar"}, "seed.fivetran_log_integration_tests.user": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1", "name": "user", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "STRING", "index": 1, "name": "id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 3, "name": "created_at", "comment": null}, "email": {"type": "STRING", "index": 4, "name": "email", "comment": null}, "email_disabled": {"type": "BOOL", "index": 5, "name": "email_disabled", "comment": null}, "family_name": {"type": "STRING", "index": 6, "name": "family_name", "comment": null}, "given_name": {"type": "STRING", "index": 7, "name": "given_name", "comment": null}, "phone": {"type": "INT64", "index": 8, "name": "phone", "comment": null}, "verified": {"type": "BOOL", "index": 9, "name": "verified", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 133, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.user"}, "model.fivetran_log.fivetran_platform__usage_mar_destination_history": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__usage_mar_destination_history", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"measured_month": {"type": "TIMESTAMP", "index": 1, "name": "measured_month", "comment": null}, "destination_id": {"type": "STRING", "index": 2, "name": "destination_id", "comment": null}, "destination_name": {"type": "STRING", "index": 3, "name": "destination_name", "comment": null}, "credits_spent": {"type": "INT64", "index": 4, "name": "credits_spent", "comment": null}, "dollars_spent": {"type": "FLOAT64", "index": 5, "name": "dollars_spent", "comment": null}, "free_monthly_active_rows": {"type": "INT64", "index": 6, "name": "free_monthly_active_rows", "comment": null}, "paid_monthly_active_rows": {"type": "INT64", "index": 7, "name": "paid_monthly_active_rows", "comment": null}, "total_monthly_active_rows": {"type": "INT64", "index": 8, "name": "total_monthly_active_rows", "comment": null}, "credits_spent_per_million_mar": {"type": "NUMERIC", "index": 9, "name": "credits_spent_per_million_mar", "comment": null}, "mar_per_credit_spent": {"type": "NUMERIC", "index": 10, "name": "mar_per_credit_spent", "comment": null}, "amount_spent_per_million_mar": {"type": "NUMERIC", "index": 11, "name": "amount_spent_per_million_mar", "comment": null}, "mar_per_amount_spent": {"type": "NUMERIC", "index": 12, "name": "mar_per_amount_spent", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 0, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__usage_mar_destination_history"}, "model.fivetran_log.fivetran_platform__schema_changelog": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__schema_changelog", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_id": {"type": "STRING", "index": 1, "name": "connector_id", "comment": null}, "connector_name": {"type": "STRING", "index": 2, "name": "connector_name", "comment": null}, "destination_id": {"type": "STRING", "index": 3, "name": "destination_id", "comment": null}, "destination_name": {"type": "STRING", "index": 4, "name": "destination_name", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 5, "name": "created_at", "comment": null}, "event_subtype": {"type": "STRING", "index": 6, "name": "event_subtype", "comment": null}, "message_data": {"type": "STRING", "index": 7, "name": "message_data", "comment": null}, "table_name": {"type": "STRING", "index": 8, "name": "table_name", "comment": null}, "schema_name": {"type": "STRING", "index": 9, "name": "schema_name", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 0, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__schema_changelog"}, "model.fivetran_log.fivetran_platform__audit_user_activity": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__audit_user_activity", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"date_day": {"type": "TIMESTAMP", "index": 1, "name": "date_day", "comment": null}, "day_name": {"type": "STRING", "index": 2, "name": "day_name", "comment": null}, "day_of_month": {"type": "INT64", "index": 3, "name": "day_of_month", "comment": null}, "occurred_at": {"type": "TIMESTAMP", "index": 4, "name": "occurred_at", "comment": null}, "destination_name": {"type": "STRING", "index": 5, "name": "destination_name", "comment": null}, "destination_id": {"type": "STRING", "index": 6, "name": "destination_id", "comment": null}, "connector_name": {"type": "STRING", "index": 7, "name": "connector_name", "comment": null}, "connector_id": {"type": "STRING", "index": 8, "name": "connector_id", "comment": null}, "email": {"type": "STRING", "index": 9, "name": "email", "comment": null}, "first_name": {"type": "STRING", "index": 10, "name": "first_name", "comment": null}, "last_name": {"type": "STRING", "index": 11, "name": "last_name", "comment": null}, "user_id": {"type": "STRING", "index": 12, "name": "user_id", "comment": null}, "destination_role": {"type": "STRING", "index": 13, "name": "destination_role", "comment": null}, "event_type": {"type": "STRING", "index": 14, "name": "event_type", "comment": null}, "event_subtype": {"type": "STRING", "index": 15, "name": "event_subtype", "comment": null}, "message_data": {"type": "STRING", "index": 16, "name": "message_data", "comment": null}, "log_id": {"type": "STRING", "index": 17, "name": "log_id", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 342, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 1, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__audit_user_activity"}, "model.fivetran_log.fivetran_platform__connector_daily_events": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__connector_daily_events", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"date_day": {"type": "DATETIME", "index": 1, "name": "date_day", "comment": null}, "connector_name": {"type": "STRING", "index": 2, "name": "connector_name", "comment": null}, "connector_id": {"type": "STRING", "index": 3, "name": "connector_id", "comment": null}, "connector_type": {"type": "STRING", "index": 4, "name": "connector_type", "comment": null}, "destination_name": {"type": "STRING", "index": 5, "name": "destination_name", "comment": null}, "destination_id": {"type": "STRING", "index": 6, "name": "destination_id", "comment": null}, "count_api_calls": {"type": "INT64", "index": 7, "name": "count_api_calls", "comment": null}, "count_record_modifications": {"type": "INT64", "index": 8, "name": "count_record_modifications", "comment": null}, "count_schema_changes": {"type": "INT64", "index": 9, "name": "count_schema_changes", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 277747, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2870, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__connector_daily_events"}, "model.fivetran_log.stg_fivetran_platform__destination_membership": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__destination_membership", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "user_id": {"type": "STRING", "index": 2, "name": "user_id", "comment": null}, "activated_at": {"type": "TIMESTAMP", "index": 3, "name": "activated_at", "comment": null}, "joined_at": {"type": "TIMESTAMP", "index": 4, "name": "joined_at", "comment": null}, "destination_role": {"type": "STRING", "index": 5, "name": "destination_role", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 109, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__destination_membership"}, "model.fivetran_log.stg_fivetran_platform__usage_cost": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__usage_cost", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "measured_month": {"type": "STRING", "index": 2, "name": "measured_month", "comment": null}, "dollars_spent": {"type": "FLOAT64", "index": 3, "name": "dollars_spent", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 132, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 4, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__usage_cost"}, "model.fivetran_log.stg_fivetran_platform__log_tmp": {"metadata": {"type": "view", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__log_tmp", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "STRING", "index": 1, "name": "id", "comment": null}, "time_stamp": {"type": "TIMESTAMP", "index": 2, "name": "time_stamp", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "connector_id": {"type": "STRING", "index": 4, "name": "connector_id", "comment": null}, "event": {"type": "STRING", "index": 5, "name": "event", "comment": null}, "message_data": {"type": "STRING", "index": 6, "name": "message_data", "comment": null}, "message_event": {"type": "STRING", "index": 7, "name": "message_event", "comment": null}, "transformation_id": {"type": "STRING", "index": 8, "name": "transformation_id", "comment": null}, "sync_id": {"type": "STRING", "index": 9, "name": "sync_id", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__log_tmp"}, "model.fivetran_log.stg_fivetran_platform__log": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__log", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"log_id": {"type": "STRING", "index": 1, "name": "log_id", "comment": null}, "sync_id": {"type": "STRING", "index": 2, "name": "sync_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 3, "name": "created_at", "comment": null}, "connector_id": {"type": "STRING", "index": 4, "name": "connector_id", "comment": null}, "event_type": {"type": "STRING", "index": 5, "name": "event_type", "comment": null}, "message_data": {"type": "STRING", "index": 6, "name": "message_data", "comment": null}, "event_subtype": {"type": "STRING", "index": 7, "name": "event_subtype", "comment": null}, "transformation_id": {"type": "STRING", "index": 8, "name": "transformation_id", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 4356, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 30, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__log"}, "model.fivetran_log.fivetran_platform__connector_status": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__connector_status", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_id": {"type": "STRING", "index": 1, "name": "connector_id", "comment": null}, "connector_name": {"type": "STRING", "index": 2, "name": "connector_name", "comment": null}, "connector_type": {"type": "STRING", "index": 3, "name": "connector_type", "comment": null}, "destination_id": {"type": "STRING", "index": 4, "name": "destination_id", "comment": null}, "destination_name": {"type": "STRING", "index": 5, "name": "destination_name", "comment": null}, "connector_health": {"type": "STRING", "index": 6, "name": "connector_health", "comment": null}, "last_successful_sync_completed_at": {"type": "TIMESTAMP", "index": 7, "name": "last_successful_sync_completed_at", "comment": null}, "last_sync_started_at": {"type": "TIMESTAMP", "index": 8, "name": "last_sync_started_at", "comment": null}, "last_sync_completed_at": {"type": "TIMESTAMP", "index": 9, "name": "last_sync_completed_at", "comment": null}, "set_up_at": {"type": "TIMESTAMP", "index": 10, "name": "set_up_at", "comment": null}, "number_of_schema_changes_last_month": {"type": "INT64", "index": 11, "name": "number_of_schema_changes_last_month", "comment": null}, "errors_since_last_completed_sync": {"type": "STRING", "index": 12, "name": "errors_since_last_completed_sync", "comment": null}, "warnings_since_last_completed_sync": {"type": "STRING", "index": 13, "name": "warnings_since_last_completed_sync", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 177, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__connector_status"}, "model.fivetran_log.fivetran_platform__mar_table_history": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__mar_table_history", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_name": {"type": "STRING", "index": 1, "name": "connector_name", "comment": null}, "schema_name": {"type": "STRING", "index": 2, "name": "schema_name", "comment": null}, "table_name": {"type": "STRING", "index": 3, "name": "table_name", "comment": null}, "destination_id": {"type": "STRING", "index": 4, "name": "destination_id", "comment": null}, "measured_month": {"type": "TIMESTAMP", "index": 5, "name": "measured_month", "comment": null}, "last_measured_at": {"type": "DATE", "index": 6, "name": "last_measured_at", "comment": null}, "free_monthly_active_rows": {"type": "INT64", "index": 7, "name": "free_monthly_active_rows", "comment": null}, "paid_monthly_active_rows": {"type": "INT64", "index": 8, "name": "paid_monthly_active_rows", "comment": null}, "total_monthly_active_rows": {"type": "INT64", "index": 9, "name": "total_monthly_active_rows", "comment": null}, "connector_type": {"type": "STRING", "index": 10, "name": "connector_type", "comment": null}, "connector_id": {"type": "STRING", "index": 11, "name": "connector_id", "comment": null}, "destination_name": {"type": "STRING", "index": 12, "name": "destination_name", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 0, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__mar_table_history"}, "model.fivetran_log.stg_fivetran_platform__connector_tmp": {"metadata": {"type": "view", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__connector_tmp", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_id": {"type": "STRING", "index": 1, "name": "connector_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "connecting_user_id": {"type": "STRING", "index": 3, "name": "connecting_user_id", "comment": null}, "connector_name": {"type": "STRING", "index": 4, "name": "connector_name", "comment": null}, "connector_type": {"type": "STRING", "index": 5, "name": "connector_type", "comment": null}, "destination_id": {"type": "STRING", "index": 6, "name": "destination_id", "comment": null}, "paused": {"type": "BOOL", "index": 7, "name": "paused", "comment": null}, "signed_up": {"type": "TIMESTAMP", "index": 8, "name": "signed_up", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__connector_tmp"}, "model.fivetran_log.stg_fivetran_platform__incremental_mar": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__incremental_mar", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_name": {"type": "STRING", "index": 1, "name": "connector_name", "comment": null}, "destination_id": {"type": "STRING", "index": 2, "name": "destination_id", "comment": null}, "free_type": {"type": "STRING", "index": 3, "name": "free_type", "comment": null}, "measured_date": {"type": "TIMESTAMP", "index": 4, "name": "measured_date", "comment": null}, "schema_name": {"type": "STRING", "index": 5, "name": "schema_name", "comment": null}, "sync_type": {"type": "STRING", "index": 6, "name": "sync_type", "comment": null}, "table_name": {"type": "STRING", "index": 7, "name": "table_name", "comment": null}, "updated_at": {"type": "DATETIME", "index": 8, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 9, "name": "_fivetran_synced", "comment": null}, "incremental_rows": {"type": "INT64", "index": 10, "name": "incremental_rows", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 988, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 10, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__incremental_mar"}, "model.fivetran_log.stg_fivetran_platform__destination": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__destination", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "account_id": {"type": "STRING", "index": 2, "name": "account_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 3, "name": "created_at", "comment": null}, "destination_name": {"type": "STRING", "index": 4, "name": "destination_name", "comment": null}, "region": {"type": "STRING", "index": 5, "name": "region", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 123, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__destination"}, "model.fivetran_log.stg_fivetran_platform__connector": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__connector", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_id": {"type": "STRING", "index": 1, "name": "connector_id", "comment": null}, "connector_name": {"type": "STRING", "index": 2, "name": "connector_name", "comment": null}, "connector_type": {"type": "STRING", "index": 3, "name": "connector_type", "comment": null}, "destination_id": {"type": "STRING", "index": 4, "name": "destination_id", "comment": null}, "connecting_user_id": {"type": "STRING", "index": 5, "name": "connecting_user_id", "comment": null}, "is_paused": {"type": "BOOL", "index": 6, "name": "is_paused", "comment": null}, "set_up_at": {"type": "TIMESTAMP", "index": 7, "name": "set_up_at", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 142, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__connector"}, "model.fivetran_log.fivetran_platform__audit_table": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__audit_table", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_id": {"type": "STRING", "index": 1, "name": "connector_id", "comment": null}, "connector_name": {"type": "STRING", "index": 2, "name": "connector_name", "comment": null}, "schema_name": {"type": "STRING", "index": 3, "name": "schema_name", "comment": null}, "table_name": {"type": "STRING", "index": 4, "name": "table_name", "comment": null}, "destination_id": {"type": "STRING", "index": 5, "name": "destination_id", "comment": null}, "destination_name": {"type": "STRING", "index": 6, "name": "destination_name", "comment": null}, "write_to_table_start": {"type": "TIMESTAMP", "index": 7, "name": "write_to_table_start", "comment": null}, "write_to_table_end": {"type": "TIMESTAMP", "index": 8, "name": "write_to_table_end", "comment": null}, "sync_start": {"type": "TIMESTAMP", "index": 9, "name": "sync_start", "comment": null}, "sync_end": {"type": "TIMESTAMP", "index": 10, "name": "sync_end", "comment": null}, "sum_rows_replaced_or_inserted": {"type": "INT64", "index": 11, "name": "sum_rows_replaced_or_inserted", "comment": null}, "sum_rows_updated": {"type": "INT64", "index": 12, "name": "sum_rows_updated", "comment": null}, "sum_rows_deleted": {"type": "INT64", "index": 13, "name": "sum_rows_deleted", "comment": null}, "unique_table_sync_key": {"type": "STRING", "index": 14, "name": "unique_table_sync_key", "comment": null}, "sync_start_day": {"type": "TIMESTAMP", "index": 15, "name": "sync_start_day", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1172, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 6, "include": true, "description": "Approximate count of rows in this table"}, "partitioning_type": {"id": "partitioning_type", "label": "Partitioned By", "value": "sync_start", "include": true, "description": "The partitioning column for this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__audit_table"}, "model.fivetran_log.stg_fivetran_platform__credits_used": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__credits_used", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "measured_month": {"type": "STRING", "index": 2, "name": "measured_month", "comment": null}, "credits_spent": {"type": "INT64", "index": 3, "name": "credits_spent", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 58, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__credits_used"}, "model.fivetran_log.stg_fivetran_platform__account": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__account", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"account_id": {"type": "STRING", "index": 1, "name": "account_id", "comment": null}, "country": {"type": "INT64", "index": 2, "name": "country", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 3, "name": "created_at", "comment": null}, "account_name": {"type": "STRING", "index": 4, "name": "account_name", "comment": null}, "status": {"type": "STRING", "index": 5, "name": "status", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 47, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 1, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__account"}, "model.fivetran_log.stg_fivetran_platform__user": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__user", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"user_id": {"type": "STRING", "index": 1, "name": "user_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 2, "name": "created_at", "comment": null}, "email": {"type": "STRING", "index": 3, "name": "email", "comment": null}, "has_disabled_email_notifications": {"type": "BOOL", "index": 4, "name": "has_disabled_email_notifications", "comment": null}, "last_name": {"type": "STRING", "index": 5, "name": "last_name", "comment": null}, "first_name": {"type": "STRING", "index": 6, "name": "first_name", "comment": null}, "phone": {"type": "INT64", "index": 7, "name": "phone", "comment": null}, "is_verified": {"type": "BOOL", "index": 8, "name": "is_verified", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 117, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__user"}}, "sources": {"source.fivetran_log.fivetran_platform.usage_cost": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1", "name": "usage_cost", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "measured_month": {"type": "STRING", "index": 2, "name": "measured_month", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "amount": {"type": "FLOAT64", "index": 4, "name": "amount", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 164, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 4, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.usage_cost"}, "source.fivetran_log.fivetran_platform.credits_used": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1", "name": "credits_used", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "measured_month": {"type": "STRING", "index": 2, "name": "measured_month", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "credits_consumed": {"type": "INT64", "index": 4, "name": "credits_consumed", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 74, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.credits_used"}, "source.fivetran_log.fivetran_platform.log": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1", "name": "log", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "STRING", "index": 1, "name": "id", "comment": null}, "time_stamp": {"type": "TIMESTAMP", "index": 2, "name": "time_stamp", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "connector_id": {"type": "STRING", "index": 4, "name": "connector_id", "comment": null}, "event": {"type": "STRING", "index": 5, "name": "event", "comment": null}, "message_data": {"type": "STRING", "index": 6, "name": "message_data", "comment": null}, "message_event": {"type": "STRING", "index": 7, "name": "message_event", "comment": null}, "transformation_id": {"type": "STRING", "index": 8, "name": "transformation_id", "comment": null}, "sync_id": {"type": "STRING", "index": 9, "name": "sync_id", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 4596, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 30, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.log"}, "source.fivetran_log.fivetran_platform.destination": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1", "name": "destination", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "STRING", "index": 1, "name": "id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "account_id": {"type": "STRING", "index": 3, "name": "account_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 4, "name": "created_at", "comment": null}, "name": {"type": "STRING", "index": 5, "name": "name", "comment": null}, "region": {"type": "STRING", "index": 6, "name": "region", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 139, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.destination"}, "source.fivetran_log.fivetran_platform.account": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1", "name": "account", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "STRING", "index": 1, "name": "id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "country": {"type": "INT64", "index": 3, "name": "country", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 4, "name": "created_at", "comment": null}, "name": {"type": "STRING", "index": 5, "name": "name", "comment": null}, "status": {"type": "STRING", "index": 6, "name": "status", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 55, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 1, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.account"}, "source.fivetran_log.fivetran_platform.connector": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1", "name": "connector", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_id": {"type": "STRING", "index": 1, "name": "connector_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "connecting_user_id": {"type": "STRING", "index": 3, "name": "connecting_user_id", "comment": null}, "connector_name": {"type": "STRING", "index": 4, "name": "connector_name", "comment": null}, "connector_type": {"type": "STRING", "index": 5, "name": "connector_type", "comment": null}, "destination_id": {"type": "STRING", "index": 6, "name": "destination_id", "comment": null}, "paused": {"type": "BOOL", "index": 7, "name": "paused", "comment": null}, "signed_up": {"type": "TIMESTAMP", "index": 8, "name": "signed_up", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 158, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.connector"}, "source.fivetran_log.fivetran_platform.destination_membership": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1", "name": "destination_membership", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "user_id": {"type": "STRING", "index": 2, "name": "user_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "activated_at": {"type": "TIMESTAMP", "index": 4, "name": "activated_at", "comment": null}, "joined_at": {"type": "TIMESTAMP", "index": 5, "name": "joined_at", "comment": null}, "role": {"type": "STRING", "index": 6, "name": "role", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 125, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.destination_membership"}, "source.fivetran_log.fivetran_platform.incremental_mar": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1", "name": "incremental_mar", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_id": {"type": "STRING", "index": 1, "name": "connector_id", "comment": null}, "destination_id": {"type": "STRING", "index": 2, "name": "destination_id", "comment": null}, "free_type": {"type": "STRING", "index": 3, "name": "free_type", "comment": null}, "measured_date": {"type": "TIMESTAMP", "index": 4, "name": "measured_date", "comment": null}, "schema_name": {"type": "STRING", "index": 5, "name": "schema_name", "comment": null}, "sync_type": {"type": "STRING", "index": 6, "name": "sync_type", "comment": null}, "table_name": {"type": "STRING", "index": 7, "name": "table_name", "comment": null}, "updated_at": {"type": "DATETIME", "index": 8, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 9, "name": "_fivetran_synced", "comment": null}, "incremental_rows": {"type": "INT64", "index": 10, "name": "incremental_rows", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 988, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 10, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.incremental_mar"}, "source.fivetran_log.fivetran_platform.user": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_1", "name": "user", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "STRING", "index": 1, "name": "id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 3, "name": "created_at", "comment": null}, "email": {"type": "STRING", "index": 4, "name": "email", "comment": null}, "email_disabled": {"type": "BOOL", "index": 5, "name": "email_disabled", "comment": null}, "family_name": {"type": "STRING", "index": 6, "name": "family_name", "comment": null}, "given_name": {"type": "STRING", "index": 7, "name": "given_name", "comment": null}, "phone": {"type": "INT64", "index": 8, "name": "phone", "comment": null}, "verified": {"type": "BOOL", "index": 9, "name": "verified", "comment": null}}, "stats": {"num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 133, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.user"}}, "errors": null}
\ No newline at end of file
+{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.7.3", "generated_at": "2023-12-12T19:09:33.038503Z", "invocation_id": "c0fa594b-cab7-478a-aeb0-a325788070ef", "env": {}}, "nodes": {"model.fivetran_log.fivetran_platform__connector_status": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "FIVETRAN_PLATFORM__CONNECTOR_STATUS", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_ID": {"type": "TEXT", "index": 1, "name": "CONNECTOR_ID", "comment": null}, "CONNECTOR_NAME": {"type": "TEXT", "index": 2, "name": "CONNECTOR_NAME", "comment": null}, "CONNECTOR_TYPE": {"type": "TEXT", "index": 3, "name": "CONNECTOR_TYPE", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 4, "name": "DESTINATION_ID", "comment": null}, "DESTINATION_NAME": {"type": "TEXT", "index": 5, "name": "DESTINATION_NAME", "comment": null}, "CONNECTOR_HEALTH": {"type": "TEXT", "index": 6, "name": "CONNECTOR_HEALTH", "comment": null}, "LAST_SUCCESSFUL_SYNC_COMPLETED_AT": {"type": "TIMESTAMP_NTZ", "index": 7, "name": "LAST_SUCCESSFUL_SYNC_COMPLETED_AT", "comment": null}, "LAST_SYNC_STARTED_AT": {"type": "TIMESTAMP_NTZ", "index": 8, "name": "LAST_SYNC_STARTED_AT", "comment": null}, "LAST_SYNC_COMPLETED_AT": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "LAST_SYNC_COMPLETED_AT", "comment": null}, "SET_UP_AT": {"type": "TIMESTAMP_NTZ", "index": 10, "name": "SET_UP_AT", "comment": null}, "NUMBER_OF_SCHEMA_CHANGES_LAST_MONTH": {"type": "NUMBER", "index": 11, "name": "NUMBER_OF_SCHEMA_CHANGES_LAST_MONTH", "comment": null}, "ERRORS_SINCE_LAST_COMPLETED_SYNC": {"type": "TEXT", "index": 12, "name": "ERRORS_SINCE_LAST_COMPLETED_SYNC", "comment": null}, "WARNINGS_SINCE_LAST_COMPLETED_SYNC": {"type": "TEXT", "index": 13, "name": "WARNINGS_SINCE_LAST_COMPLETED_SYNC", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4608, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__connector_status"}, "seed.fivetran_log_integration_tests.account": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "ACCOUNT", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "COUNTRY": {"type": "NUMBER", "index": 3, "name": "COUNTRY", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "CREATED_AT", "comment": null}, "NAME": {"type": "TEXT", "index": 5, "name": "NAME", "comment": null}, "STATUS": {"type": "TEXT", "index": 6, "name": "STATUS", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.account"}, "model.fivetran_log.fivetran_platform__schema_changelog": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "FIVETRAN_PLATFORM__SCHEMA_CHANGELOG", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_ID": {"type": "TEXT", "index": 1, "name": "CONNECTOR_ID", "comment": null}, "CONNECTOR_NAME": {"type": "TEXT", "index": 2, "name": "CONNECTOR_NAME", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 3, "name": "DESTINATION_ID", "comment": null}, "DESTINATION_NAME": {"type": "TEXT", "index": 4, "name": "DESTINATION_NAME", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 5, "name": "CREATED_AT", "comment": null}, "EVENT_SUBTYPE": {"type": "TEXT", "index": 6, "name": "EVENT_SUBTYPE", "comment": null}, "MESSAGE_DATA": {"type": "TEXT", "index": 7, "name": "MESSAGE_DATA", "comment": null}, "TABLE_NAME": {"type": "VARIANT", "index": 8, "name": "TABLE_NAME", "comment": null}, "SCHEMA_NAME": {"type": "VARIANT", "index": 9, "name": "SCHEMA_NAME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__schema_changelog"}, "model.fivetran_log.fivetran_platform__audit_user_activity": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "FIVETRAN_PLATFORM__AUDIT_USER_ACTIVITY", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DATE_DAY": {"type": "TIMESTAMP_NTZ", "index": 1, "name": "DATE_DAY", "comment": null}, "DAY_NAME": {"type": "TEXT", "index": 2, "name": "DAY_NAME", "comment": null}, "DAY_OF_MONTH": {"type": "NUMBER", "index": 3, "name": "DAY_OF_MONTH", "comment": null}, "OCCURRED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "OCCURRED_AT", "comment": null}, "DESTINATION_NAME": {"type": "TEXT", "index": 5, "name": "DESTINATION_NAME", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 6, "name": "DESTINATION_ID", "comment": null}, "CONNECTOR_NAME": {"type": "TEXT", "index": 7, "name": "CONNECTOR_NAME", "comment": null}, "CONNECTOR_ID": {"type": "TEXT", "index": 8, "name": "CONNECTOR_ID", "comment": null}, "EMAIL": {"type": "VARIANT", "index": 9, "name": "EMAIL", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 10, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 11, "name": "LAST_NAME", "comment": null}, "USER_ID": {"type": "TEXT", "index": 12, "name": "USER_ID", "comment": null}, "DESTINATION_ROLE": {"type": "TEXT", "index": 13, "name": "DESTINATION_ROLE", "comment": null}, "EVENT_TYPE": {"type": "TEXT", "index": 14, "name": "EVENT_TYPE", "comment": null}, "EVENT_SUBTYPE": {"type": "TEXT", "index": 15, "name": "EVENT_SUBTYPE", "comment": null}, "MESSAGE_DATA": {"type": "TEXT", "index": 16, "name": "MESSAGE_DATA", "comment": null}, "LOG_ID": {"type": "TEXT", "index": 17, "name": "LOG_ID", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5120, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__audit_user_activity"}, "model.fivetran_log.stg_fivetran_platform__connector": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__CONNECTOR", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_ID": {"type": "TEXT", "index": 1, "name": "CONNECTOR_ID", "comment": null}, "CONNECTOR_NAME": {"type": "TEXT", "index": 2, "name": "CONNECTOR_NAME", "comment": null}, "CONNECTOR_TYPE": {"type": "TEXT", "index": 3, "name": "CONNECTOR_TYPE", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 4, "name": "DESTINATION_ID", "comment": null}, "CONNECTING_USER_ID": {"type": "TEXT", "index": 5, "name": "CONNECTING_USER_ID", "comment": null}, "IS_PAUSED": {"type": "BOOLEAN", "index": 6, "name": "IS_PAUSED", "comment": null}, "SET_UP_AT": {"type": "TIMESTAMP_NTZ", "index": 7, "name": "SET_UP_AT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__connector"}, "model.fivetran_log.stg_fivetran_platform__log": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__LOG", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"LOG_ID": {"type": "TEXT", "index": 1, "name": "LOG_ID", "comment": null}, "SYNC_ID": {"type": "TEXT", "index": 2, "name": "SYNC_ID", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "CREATED_AT", "comment": null}, "CONNECTOR_ID": {"type": "TEXT", "index": 4, "name": "CONNECTOR_ID", "comment": null}, "EVENT_TYPE": {"type": "TEXT", "index": 5, "name": "EVENT_TYPE", "comment": null}, "MESSAGE_DATA": {"type": "TEXT", "index": 6, "name": "MESSAGE_DATA", "comment": null}, "EVENT_SUBTYPE": {"type": "TEXT", "index": 7, "name": "EVENT_SUBTYPE", "comment": null}, "TRANSFORMATION_ID": {"type": "TEXT", "index": 8, "name": "TRANSFORMATION_ID", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 30, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5632, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__log"}, "seed.fivetran_log_integration_tests.destination": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "DESTINATION", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "ACCOUNT_ID": {"type": "TEXT", "index": 3, "name": "ACCOUNT_ID", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "CREATED_AT", "comment": null}, "NAME": {"type": "TEXT", "index": 5, "name": "NAME", "comment": null}, "REGION": {"type": "TEXT", "index": 6, "name": "REGION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.destination"}, "model.fivetran_log.fivetran_platform__usage_mar_destination_history": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "FIVETRAN_PLATFORM__USAGE_MAR_DESTINATION_HISTORY", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"MEASURED_MONTH": {"type": "DATE", "index": 1, "name": "MEASURED_MONTH", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 2, "name": "DESTINATION_ID", "comment": null}, "DESTINATION_NAME": {"type": "TEXT", "index": 3, "name": "DESTINATION_NAME", "comment": null}, "CREDITS_SPENT": {"type": "NUMBER", "index": 4, "name": "CREDITS_SPENT", "comment": null}, "DOLLARS_SPENT": {"type": "FLOAT", "index": 5, "name": "DOLLARS_SPENT", "comment": null}, "FREE_MONTHLY_ACTIVE_ROWS": {"type": "NUMBER", "index": 6, "name": "FREE_MONTHLY_ACTIVE_ROWS", "comment": null}, "PAID_MONTHLY_ACTIVE_ROWS": {"type": "NUMBER", "index": 7, "name": "PAID_MONTHLY_ACTIVE_ROWS", "comment": null}, "TOTAL_MONTHLY_ACTIVE_ROWS": {"type": "NUMBER", "index": 8, "name": "TOTAL_MONTHLY_ACTIVE_ROWS", "comment": null}, "CREDITS_SPENT_PER_MILLION_MAR": {"type": "NUMBER", "index": 9, "name": "CREDITS_SPENT_PER_MILLION_MAR", "comment": null}, "MAR_PER_CREDIT_SPENT": {"type": "NUMBER", "index": 10, "name": "MAR_PER_CREDIT_SPENT", "comment": null}, "AMOUNT_SPENT_PER_MILLION_MAR": {"type": "NUMBER", "index": 11, "name": "AMOUNT_SPENT_PER_MILLION_MAR", "comment": null}, "MAR_PER_AMOUNT_SPENT": {"type": "NUMBER", "index": 12, "name": "MAR_PER_AMOUNT_SPENT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__usage_mar_destination_history"}, "model.fivetran_log.stg_fivetran_platform__account": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__ACCOUNT", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ACCOUNT_ID": {"type": "TEXT", "index": 1, "name": "ACCOUNT_ID", "comment": null}, "COUNTRY": {"type": "NUMBER", "index": 2, "name": "COUNTRY", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "CREATED_AT", "comment": null}, "ACCOUNT_NAME": {"type": "TEXT", "index": 4, "name": "ACCOUNT_NAME", "comment": null}, "STATUS": {"type": "TEXT", "index": 5, "name": "STATUS", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__account"}, "model.fivetran_log.fivetran_platform__audit_table": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "FIVETRAN_PLATFORM__AUDIT_TABLE", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_ID": {"type": "TEXT", "index": 1, "name": "CONNECTOR_ID", "comment": null}, "CONNECTOR_NAME": {"type": "TEXT", "index": 2, "name": "CONNECTOR_NAME", "comment": null}, "SCHEMA_NAME": {"type": "TEXT", "index": 3, "name": "SCHEMA_NAME", "comment": null}, "TABLE_NAME": {"type": "VARIANT", "index": 4, "name": "TABLE_NAME", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 5, "name": "DESTINATION_ID", "comment": null}, "DESTINATION_NAME": {"type": "TEXT", "index": 6, "name": "DESTINATION_NAME", "comment": null}, "WRITE_TO_TABLE_START": {"type": "TIMESTAMP_NTZ", "index": 7, "name": "WRITE_TO_TABLE_START", "comment": null}, "WRITE_TO_TABLE_END": {"type": "TIMESTAMP_NTZ", "index": 8, "name": "WRITE_TO_TABLE_END", "comment": null}, "SYNC_START": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "SYNC_START", "comment": null}, "SYNC_END": {"type": "TIMESTAMP_NTZ", "index": 10, "name": "SYNC_END", "comment": null}, "SUM_ROWS_REPLACED_OR_INSERTED": {"type": "NUMBER", "index": 11, "name": "SUM_ROWS_REPLACED_OR_INSERTED", "comment": null}, "SUM_ROWS_UPDATED": {"type": "NUMBER", "index": 12, "name": "SUM_ROWS_UPDATED", "comment": null}, "SUM_ROWS_DELETED": {"type": "NUMBER", "index": 13, "name": "SUM_ROWS_DELETED", "comment": null}, "UNIQUE_TABLE_SYNC_KEY": {"type": "TEXT", "index": 14, "name": "UNIQUE_TABLE_SYNC_KEY", "comment": null}, "SYNC_START_DAY": {"type": "TIMESTAMP_NTZ", "index": 15, "name": "SYNC_START_DAY", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 6, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 6144, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__audit_table"}, "seed.fivetran_log_integration_tests.incremental_mar": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "INCREMENTAL_MAR", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_ID": {"type": "TEXT", "index": 1, "name": "CONNECTOR_ID", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 2, "name": "DESTINATION_ID", "comment": null}, "FREE_TYPE": {"type": "TEXT", "index": 3, "name": "FREE_TYPE", "comment": null}, "MEASURED_DATE": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "MEASURED_DATE", "comment": null}, "SCHEMA_NAME": {"type": "TEXT", "index": 5, "name": "SCHEMA_NAME", "comment": null}, "SYNC_TYPE": {"type": "TEXT", "index": 6, "name": "SYNC_TYPE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 7, "name": "TABLE_NAME", "comment": null}, "UPDATED_AT": {"type": "TIMESTAMP_NTZ", "index": 8, "name": "UPDATED_AT", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "_FIVETRAN_SYNCED", "comment": null}, "INCREMENTAL_ROWS": {"type": "NUMBER", "index": 10, "name": "INCREMENTAL_ROWS", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 10, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4096, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.incremental_mar"}, "model.fivetran_log.stg_fivetran_platform__destination": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__DESTINATION", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "ACCOUNT_ID": {"type": "TEXT", "index": 2, "name": "ACCOUNT_ID", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "CREATED_AT", "comment": null}, "DESTINATION_NAME": {"type": "TEXT", "index": 4, "name": "DESTINATION_NAME", "comment": null}, "REGION": {"type": "TEXT", "index": 5, "name": "REGION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__destination"}, "model.fivetran_log.stg_fivetran_platform__incremental_mar": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__INCREMENTAL_MAR", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_NAME": {"type": "TEXT", "index": 1, "name": "CONNECTOR_NAME", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 2, "name": "DESTINATION_ID", "comment": null}, "FREE_TYPE": {"type": "TEXT", "index": 3, "name": "FREE_TYPE", "comment": null}, "MEASURED_DATE": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "MEASURED_DATE", "comment": null}, "SCHEMA_NAME": {"type": "TEXT", "index": 5, "name": "SCHEMA_NAME", "comment": null}, "SYNC_TYPE": {"type": "TEXT", "index": 6, "name": "SYNC_TYPE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 7, "name": "TABLE_NAME", "comment": null}, "UPDATED_AT": {"type": "TIMESTAMP_NTZ", "index": 8, "name": "UPDATED_AT", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "_FIVETRAN_SYNCED", "comment": null}, "INCREMENTAL_ROWS": {"type": "NUMBER", "index": 10, "name": "INCREMENTAL_ROWS", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 10, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4096, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__incremental_mar"}, "seed.fivetran_log_integration_tests.log": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "LOG", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "TIME_STAMP": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "TIME_STAMP", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "_FIVETRAN_SYNCED", "comment": null}, "CONNECTOR_ID": {"type": "TEXT", "index": 4, "name": "CONNECTOR_ID", "comment": null}, "EVENT": {"type": "TEXT", "index": 5, "name": "EVENT", "comment": null}, "MESSAGE_DATA": {"type": "TEXT", "index": 6, "name": "MESSAGE_DATA", "comment": null}, "MESSAGE_EVENT": {"type": "TEXT", "index": 7, "name": "MESSAGE_EVENT", "comment": null}, "TRANSFORMATION_ID": {"type": "TEXT", "index": 8, "name": "TRANSFORMATION_ID", "comment": null}, "SYNC_ID": {"type": "TEXT", "index": 9, "name": "SYNC_ID", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 30, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 6144, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.log"}, "seed.fivetran_log_integration_tests.user": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "USER", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "CREATED_AT", "comment": null}, "EMAIL": {"type": "TEXT", "index": 4, "name": "EMAIL", "comment": null}, "EMAIL_DISABLED": {"type": "BOOLEAN", "index": 5, "name": "EMAIL_DISABLED", "comment": null}, "FAMILY_NAME": {"type": "TEXT", "index": 6, "name": "FAMILY_NAME", "comment": null}, "GIVEN_NAME": {"type": "TEXT", "index": 7, "name": "GIVEN_NAME", "comment": null}, "PHONE": {"type": "NUMBER", "index": 8, "name": "PHONE", "comment": null}, "VERIFIED": {"type": "BOOLEAN", "index": 9, "name": "VERIFIED", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3584, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.user"}, "model.fivetran_log.stg_fivetran_platform__usage_cost": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__USAGE_COST", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "MEASURED_MONTH": {"type": "TEXT", "index": 2, "name": "MEASURED_MONTH", "comment": null}, "DOLLARS_SPENT": {"type": "FLOAT", "index": 3, "name": "DOLLARS_SPENT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 4, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__usage_cost"}, "model.fivetran_log.stg_fivetran_platform__log_tmp": {"metadata": {"type": "VIEW", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__LOG_TMP", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "TIME_STAMP": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "TIME_STAMP", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "_FIVETRAN_SYNCED", "comment": null}, "CONNECTOR_ID": {"type": "TEXT", "index": 4, "name": "CONNECTOR_ID", "comment": null}, "EVENT": {"type": "TEXT", "index": 5, "name": "EVENT", "comment": null}, "MESSAGE_DATA": {"type": "TEXT", "index": 6, "name": "MESSAGE_DATA", "comment": null}, "MESSAGE_EVENT": {"type": "TEXT", "index": 7, "name": "MESSAGE_EVENT", "comment": null}, "TRANSFORMATION_ID": {"type": "TEXT", "index": 8, "name": "TRANSFORMATION_ID", "comment": null}, "SYNC_ID": {"type": "TEXT", "index": 9, "name": "SYNC_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__log_tmp"}, "seed.fivetran_log_integration_tests.destination_membership": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "DESTINATION_MEMBERSHIP", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "USER_ID": {"type": "TEXT", "index": 2, "name": "USER_ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "_FIVETRAN_SYNCED", "comment": null}, "ACTIVATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "ACTIVATED_AT", "comment": null}, "JOINED_AT": {"type": "TIMESTAMP_NTZ", "index": 5, "name": "JOINED_AT", "comment": null}, "ROLE": {"type": "TEXT", "index": 6, "name": "ROLE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.destination_membership"}, "seed.fivetran_log_integration_tests.connector": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "CONNECTOR", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_ID": {"type": "TEXT", "index": 1, "name": "CONNECTOR_ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "CONNECTING_USER_ID": {"type": "TEXT", "index": 3, "name": "CONNECTING_USER_ID", "comment": null}, "CONNECTOR_NAME": {"type": "TEXT", "index": 4, "name": "CONNECTOR_NAME", "comment": null}, "CONNECTOR_TYPE": {"type": "TEXT", "index": 5, "name": "CONNECTOR_TYPE", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 6, "name": "DESTINATION_ID", "comment": null}, "PAUSED": {"type": "BOOLEAN", "index": 7, "name": "PAUSED", "comment": null}, "SIGNED_UP": {"type": "TIMESTAMP_NTZ", "index": 8, "name": "SIGNED_UP", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.connector"}, "model.fivetran_log.stg_fivetran_platform__destination_membership": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__DESTINATION_MEMBERSHIP", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "USER_ID": {"type": "TEXT", "index": 2, "name": "USER_ID", "comment": null}, "ACTIVATED_AT": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "ACTIVATED_AT", "comment": null}, "JOINED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "JOINED_AT", "comment": null}, "DESTINATION_ROLE": {"type": "TEXT", "index": 5, "name": "DESTINATION_ROLE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__destination_membership"}, "model.fivetran_log.stg_fivetran_platform__credits_used": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__CREDITS_USED", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "MEASURED_MONTH": {"type": "TEXT", "index": 2, "name": "MEASURED_MONTH", "comment": null}, "CREDITS_SPENT": {"type": "NUMBER", "index": 3, "name": "CREDITS_SPENT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__credits_used"}, "model.fivetran_log.fivetran_platform__mar_table_history": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "FIVETRAN_PLATFORM__MAR_TABLE_HISTORY", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_NAME": {"type": "TEXT", "index": 1, "name": "CONNECTOR_NAME", "comment": null}, "SCHEMA_NAME": {"type": "TEXT", "index": 2, "name": "SCHEMA_NAME", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 4, "name": "DESTINATION_ID", "comment": null}, "MEASURED_MONTH": {"type": "TIMESTAMP_NTZ", "index": 5, "name": "MEASURED_MONTH", "comment": null}, "LAST_MEASURED_AT": {"type": "DATE", "index": 6, "name": "LAST_MEASURED_AT", "comment": null}, "FREE_MONTHLY_ACTIVE_ROWS": {"type": "NUMBER", "index": 7, "name": "FREE_MONTHLY_ACTIVE_ROWS", "comment": null}, "PAID_MONTHLY_ACTIVE_ROWS": {"type": "NUMBER", "index": 8, "name": "PAID_MONTHLY_ACTIVE_ROWS", "comment": null}, "TOTAL_MONTHLY_ACTIVE_ROWS": {"type": "NUMBER", "index": 9, "name": "TOTAL_MONTHLY_ACTIVE_ROWS", "comment": null}, "CONNECTOR_TYPE": {"type": "TEXT", "index": 10, "name": "CONNECTOR_TYPE", "comment": null}, "CONNECTOR_ID": {"type": "TEXT", "index": 11, "name": "CONNECTOR_ID", "comment": null}, "DESTINATION_NAME": {"type": "TEXT", "index": 12, "name": "DESTINATION_NAME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__mar_table_history"}, "model.fivetran_log.stg_fivetran_platform__connector_tmp": {"metadata": {"type": "VIEW", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__CONNECTOR_TMP", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_ID": {"type": "TEXT", "index": 1, "name": "CONNECTOR_ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "CONNECTING_USER_ID": {"type": "TEXT", "index": 3, "name": "CONNECTING_USER_ID", "comment": null}, "CONNECTOR_NAME": {"type": "TEXT", "index": 4, "name": "CONNECTOR_NAME", "comment": null}, "CONNECTOR_TYPE": {"type": "TEXT", "index": 5, "name": "CONNECTOR_TYPE", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 6, "name": "DESTINATION_ID", "comment": null}, "PAUSED": {"type": "BOOLEAN", "index": 7, "name": "PAUSED", "comment": null}, "SIGNED_UP": {"type": "TIMESTAMP_NTZ", "index": 8, "name": "SIGNED_UP", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__connector_tmp"}, "seed.fivetran_log_integration_tests.credits_used": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "CREDITS_USED", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "MEASURED_MONTH": {"type": "TEXT", "index": 2, "name": "MEASURED_MONTH", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "_FIVETRAN_SYNCED", "comment": null}, "CREDITS_CONSUMED": {"type": "NUMBER", "index": 4, "name": "CREDITS_CONSUMED", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.credits_used"}, "seed.fivetran_log_integration_tests.usage_cost": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "USAGE_COST", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "MEASURED_MONTH": {"type": "TEXT", "index": 2, "name": "MEASURED_MONTH", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "_FIVETRAN_SYNCED", "comment": null}, "AMOUNT": {"type": "FLOAT", "index": 4, "name": "AMOUNT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 4, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.usage_cost"}, "model.fivetran_log.fivetran_platform__connector_daily_events": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "FIVETRAN_PLATFORM__CONNECTOR_DAILY_EVENTS", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DATE_DAY": {"type": "DATE", "index": 1, "name": "DATE_DAY", "comment": null}, "CONNECTOR_NAME": {"type": "TEXT", "index": 2, "name": "CONNECTOR_NAME", "comment": null}, "CONNECTOR_ID": {"type": "TEXT", "index": 3, "name": "CONNECTOR_ID", "comment": null}, "CONNECTOR_TYPE": {"type": "TEXT", "index": 4, "name": "CONNECTOR_TYPE", "comment": null}, "DESTINATION_NAME": {"type": "TEXT", "index": 5, "name": "DESTINATION_NAME", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 6, "name": "DESTINATION_ID", "comment": null}, "COUNT_API_CALLS": {"type": "NUMBER", "index": 7, "name": "COUNT_API_CALLS", "comment": null}, "COUNT_RECORD_MODIFICATIONS": {"type": "NUMBER", "index": 8, "name": "COUNT_RECORD_MODIFICATIONS", "comment": null}, "COUNT_SCHEMA_CHANGES": {"type": "NUMBER", "index": 9, "name": "COUNT_SCHEMA_CHANGES", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2926, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 29184, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__connector_daily_events"}, "model.fivetran_log.stg_fivetran_platform__user": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__USER", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"USER_ID": {"type": "TEXT", "index": 1, "name": "USER_ID", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "CREATED_AT", "comment": null}, "EMAIL": {"type": "TEXT", "index": 3, "name": "EMAIL", "comment": null}, "HAS_DISABLED_EMAIL_NOTIFICATIONS": {"type": "BOOLEAN", "index": 4, "name": "HAS_DISABLED_EMAIL_NOTIFICATIONS", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 5, "name": "LAST_NAME", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 6, "name": "FIRST_NAME", "comment": null}, "PHONE": {"type": "NUMBER", "index": 7, "name": "PHONE", "comment": null}, "IS_VERIFIED": {"type": "BOOLEAN", "index": 8, "name": "IS_VERIFIED", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__user"}}, "sources": {"source.fivetran_log.fivetran_platform.account": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "ACCOUNT", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "COUNTRY": {"type": "NUMBER", "index": 3, "name": "COUNTRY", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "CREATED_AT", "comment": null}, "NAME": {"type": "TEXT", "index": 5, "name": "NAME", "comment": null}, "STATUS": {"type": "TEXT", "index": 6, "name": "STATUS", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.account"}, "source.fivetran_log.fivetran_platform.destination": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "DESTINATION", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "ACCOUNT_ID": {"type": "TEXT", "index": 3, "name": "ACCOUNT_ID", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "CREATED_AT", "comment": null}, "NAME": {"type": "TEXT", "index": 5, "name": "NAME", "comment": null}, "REGION": {"type": "TEXT", "index": 6, "name": "REGION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.destination"}, "source.fivetran_log.fivetran_platform.incremental_mar": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "INCREMENTAL_MAR", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_ID": {"type": "TEXT", "index": 1, "name": "CONNECTOR_ID", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 2, "name": "DESTINATION_ID", "comment": null}, "FREE_TYPE": {"type": "TEXT", "index": 3, "name": "FREE_TYPE", "comment": null}, "MEASURED_DATE": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "MEASURED_DATE", "comment": null}, "SCHEMA_NAME": {"type": "TEXT", "index": 5, "name": "SCHEMA_NAME", "comment": null}, "SYNC_TYPE": {"type": "TEXT", "index": 6, "name": "SYNC_TYPE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 7, "name": "TABLE_NAME", "comment": null}, "UPDATED_AT": {"type": "TIMESTAMP_NTZ", "index": 8, "name": "UPDATED_AT", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "_FIVETRAN_SYNCED", "comment": null}, "INCREMENTAL_ROWS": {"type": "NUMBER", "index": 10, "name": "INCREMENTAL_ROWS", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 10, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4096, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.incremental_mar"}, "source.fivetran_log.fivetran_platform.log": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "LOG", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "TIME_STAMP": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "TIME_STAMP", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "_FIVETRAN_SYNCED", "comment": null}, "CONNECTOR_ID": {"type": "TEXT", "index": 4, "name": "CONNECTOR_ID", "comment": null}, "EVENT": {"type": "TEXT", "index": 5, "name": "EVENT", "comment": null}, "MESSAGE_DATA": {"type": "TEXT", "index": 6, "name": "MESSAGE_DATA", "comment": null}, "MESSAGE_EVENT": {"type": "TEXT", "index": 7, "name": "MESSAGE_EVENT", "comment": null}, "TRANSFORMATION_ID": {"type": "TEXT", "index": 8, "name": "TRANSFORMATION_ID", "comment": null}, "SYNC_ID": {"type": "TEXT", "index": 9, "name": "SYNC_ID", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 30, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 6144, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.log"}, "source.fivetran_log.fivetran_platform.user": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "USER", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "CREATED_AT", "comment": null}, "EMAIL": {"type": "TEXT", "index": 4, "name": "EMAIL", "comment": null}, "EMAIL_DISABLED": {"type": "BOOLEAN", "index": 5, "name": "EMAIL_DISABLED", "comment": null}, "FAMILY_NAME": {"type": "TEXT", "index": 6, "name": "FAMILY_NAME", "comment": null}, "GIVEN_NAME": {"type": "TEXT", "index": 7, "name": "GIVEN_NAME", "comment": null}, "PHONE": {"type": "NUMBER", "index": 8, "name": "PHONE", "comment": null}, "VERIFIED": {"type": "BOOLEAN", "index": 9, "name": "VERIFIED", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3584, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.user"}, "source.fivetran_log.fivetran_platform.destination_membership": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "DESTINATION_MEMBERSHIP", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "USER_ID": {"type": "TEXT", "index": 2, "name": "USER_ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "_FIVETRAN_SYNCED", "comment": null}, "ACTIVATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "ACTIVATED_AT", "comment": null}, "JOINED_AT": {"type": "TIMESTAMP_NTZ", "index": 5, "name": "JOINED_AT", "comment": null}, "ROLE": {"type": "TEXT", "index": 6, "name": "ROLE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.destination_membership"}, "source.fivetran_log.fivetran_platform.connector": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "CONNECTOR", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_ID": {"type": "TEXT", "index": 1, "name": "CONNECTOR_ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "CONNECTING_USER_ID": {"type": "TEXT", "index": 3, "name": "CONNECTING_USER_ID", "comment": null}, "CONNECTOR_NAME": {"type": "TEXT", "index": 4, "name": "CONNECTOR_NAME", "comment": null}, "CONNECTOR_TYPE": {"type": "TEXT", "index": 5, "name": "CONNECTOR_TYPE", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 6, "name": "DESTINATION_ID", "comment": null}, "PAUSED": {"type": "BOOLEAN", "index": 7, "name": "PAUSED", "comment": null}, "SIGNED_UP": {"type": "TIMESTAMP_NTZ", "index": 8, "name": "SIGNED_UP", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.connector"}, "source.fivetran_log.fivetran_platform.credits_used": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "CREDITS_USED", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "MEASURED_MONTH": {"type": "TEXT", "index": 2, "name": "MEASURED_MONTH", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "_FIVETRAN_SYNCED", "comment": null}, "CREDITS_CONSUMED": {"type": "NUMBER", "index": 4, "name": "CREDITS_CONSUMED", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.credits_used"}, "source.fivetran_log.fivetran_platform.usage_cost": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "USAGE_COST", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "MEASURED_MONTH": {"type": "TEXT", "index": 2, "name": "MEASURED_MONTH", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "_FIVETRAN_SYNCED", "comment": null}, "AMOUNT": {"type": "FLOAT", "index": 4, "name": "AMOUNT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 4, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.usage_cost"}}, "errors": null}
\ No newline at end of file
diff --git a/docs/manifest.json b/docs/manifest.json
index 802f22a2..2090c526 100644
--- a/docs/manifest.json
+++ b/docs/manifest.json
@@ -1 +1 @@
-{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v11.json", "dbt_version": "1.7.0", "generated_at": "2023-11-14T18:04:11.390367Z", "invocation_id": "5e424184-132f-49e4-8bc7-f99dbda88d2d", "env": {}, "project_name": "fivetran_log_integration_tests", "project_id": "601c934d3c286a01c58ed00bc69f8e64", "user_id": "2bfa9082-ea6e-467b-abdc-d0514ab111d9", "send_anonymous_usage_stats": true, "adapter_type": "bigquery"}, "nodes": {"seed.fivetran_log_integration_tests.log": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1", "name": "log", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "log.csv", "original_file_path": "seeds/log.csv", "unique_id": "seed.fivetran_log_integration_tests.log", "fqn": ["fivetran_log_integration_tests", "log"], "alias": "log", "checksum": {"name": "sha256", "checksum": "3637d563f8916ee1a902edb08e4cd17c35bb975b7b6ca34093b553853e58edcc"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "time_stamp": "timestamp", "transformation_id": "string"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"time_stamp": "timestamp", "transformation_id": "{{ 'string' if target.type in ('bigquery', 'spark', 'databricks') else 'varchar' }}"}}, "created_at": 1699984808.404237, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1`.`log`", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/jamie_dbt_dev/dbt_packages/fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.destination_membership": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1", "name": "destination_membership", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "destination_membership.csv", "original_file_path": "seeds/destination_membership.csv", "unique_id": "seed.fivetran_log_integration_tests.destination_membership", "fqn": ["fivetran_log_integration_tests", "destination_membership"], "alias": "destination_membership", "checksum": {"name": "sha256", "checksum": "ea1c1b6a3929e8d4de990970c8cc497af21e2a5e12c1623be69462c22a3b0e1a"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "activated_at": "timestamp", "joined_at": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"activated_at": "timestamp", "joined_at": "timestamp"}}, "created_at": 1699984808.4131432, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1`.`destination_membership`", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/jamie_dbt_dev/dbt_packages/fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.credits_used": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1", "name": "credits_used", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "credits_used.csv", "original_file_path": "seeds/credits_used.csv", "unique_id": "seed.fivetran_log_integration_tests.credits_used", "fqn": ["fivetran_log_integration_tests", "credits_used"], "alias": "credits_used", "checksum": {"name": "sha256", "checksum": "b6954f4070acaf5073fc4c4001c3ab8ebc254e0ddbe2226ba063e0cbc3001d7f"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "credits_consumed": "int64"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"credits_consumed": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"}}, "created_at": 1699984808.414675, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1`.`credits_used`", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/jamie_dbt_dev/dbt_packages/fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.destination": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1", "name": "destination", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "destination.csv", "original_file_path": "seeds/destination.csv", "unique_id": "seed.fivetran_log_integration_tests.destination", "fqn": ["fivetran_log_integration_tests", "destination"], "alias": "destination", "checksum": {"name": "sha256", "checksum": "0f6955f215269c7d8754298fb9485f3196765564fccf9a138cf02a8ccb160ab3"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "created_at": "timestamp", "id": "string"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"created_at": "timestamp", "id": "{{ 'string' if target.type in ('bigquery', 'spark', 'databricks') else 'varchar' }}"}}, "created_at": 1699984808.416704, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1`.`destination`", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/jamie_dbt_dev/dbt_packages/fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.connector": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1", "name": "connector", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "connector.csv", "original_file_path": "seeds/connector.csv", "unique_id": "seed.fivetran_log_integration_tests.connector", "fqn": ["fivetran_log_integration_tests", "connector"], "alias": "connector", "checksum": {"name": "sha256", "checksum": "8b9be1f60c7b2e33da88c97eb66a3241cb6fffad4af3e7e32c355f8f27c0c34c"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "signed_up": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"signed_up": "timestamp"}}, "created_at": 1699984808.418196, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1`.`connector`", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/jamie_dbt_dev/dbt_packages/fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.user": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1", "name": "user", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "user.csv", "original_file_path": "seeds/user.csv", "unique_id": "seed.fivetran_log_integration_tests.user", "fqn": ["fivetran_log_integration_tests", "user"], "alias": "user", "checksum": {"name": "sha256", "checksum": "ce690544aed43600d42695a8fdf5e1fa14c342c04b22cadcbdb0934a0cf92a0e"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "created_at": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"created_at": "timestamp"}}, "created_at": 1699984808.419648, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1`.`user`", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/jamie_dbt_dev/dbt_packages/fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.account": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1", "name": "account", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "account.csv", "original_file_path": "seeds/account.csv", "unique_id": "seed.fivetran_log_integration_tests.account", "fqn": ["fivetran_log_integration_tests", "account"], "alias": "account", "checksum": {"name": "sha256", "checksum": "ec33e80835ab8169b97dd17dd2699f84862f798de4c2d0a90c8d261a111d3495"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "created_at": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"created_at": "timestamp"}}, "created_at": 1699984808.4210932, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1`.`account`", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/jamie_dbt_dev/dbt_packages/fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.usage_cost": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1", "name": "usage_cost", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "usage_cost.csv", "original_file_path": "seeds/usage_cost.csv", "unique_id": "seed.fivetran_log_integration_tests.usage_cost", "fqn": ["fivetran_log_integration_tests", "usage_cost"], "alias": "usage_cost", "checksum": {"name": "sha256", "checksum": "3cbe3dadc6ca6dd2383cd5172fe2688bccf65af0b6bc30a7583c85aa41185a58"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"_fivetran_synced": "timestamp"}}, "created_at": 1699984808.42256, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1`.`usage_cost`", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/jamie_dbt_dev/dbt_packages/fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.incremental_mar": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1", "name": "incremental_mar", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "incremental_mar.csv", "original_file_path": "seeds/incremental_mar.csv", "unique_id": "seed.fivetran_log_integration_tests.incremental_mar", "fqn": ["fivetran_log_integration_tests", "incremental_mar"], "alias": "incremental_mar", "checksum": {"name": "sha256", "checksum": "e567d62bbb002d465ce48fea541f7d075cd7ceb5c82f439f4a9d4e715bd13018"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "measured_date": "timestamp", "incremental_rows": "int64"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"measured_date": "timestamp", "incremental_rows": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"}}, "created_at": 1699984808.424148, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1`.`incremental_mar`", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/jamie_dbt_dev/dbt_packages/fivetran_log/integration_tests", "depends_on": {"macros": []}}, "model.fivetran_log.fivetran_platform__schema_changelog": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__schema_changelog", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__schema_changelog.sql", "original_file_path": "models/fivetran_platform__schema_changelog.sql", "unique_id": "model.fivetran_log.fivetran_platform__schema_changelog", "fqn": ["fivetran_log", "fivetran_platform__schema_changelog"], "alias": "fivetran_platform__schema_changelog", "checksum": {"name": "sha256", "checksum": "0006c4b6dfe16e3cf9e16976ff820226e2e4cae760bfb0d9cbfa12aae063cd13"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table capturing information around each kind of schema change made to a connector. Schema changes include altering and creating tables, changing the schema configuration, and creating schemas. \n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector whose schema was changed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination that the table is being written to.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the schema was changed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_subtype": {"name": "event_subtype", "description": "Type of schema change event. One of 'alter_table', 'create_table', 'change_schema_config', 'create_schema'.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_data": {"name": "message_data", "description": "The details of the event in JSON format.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Name of the table, if a table is being altered or created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "Name of the schema, if a schema or table is being created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1699984808.762638, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__schema_changelog`", "raw_code": "with schema_changes as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__log') }}\n\n    where event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n),\n\nconnector as (\n\n    select *\n    from {{ ref('fivetran_platform__connector_status') }}\n),\n\nadd_connector_info as (\n\n    select \n        schema_changes.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n\n    from schema_changes join connector using(connector_id)\n),\n\nfinal as (\n\n    select\n        connector_id,\n        connector_name,\n        destination_id,\n        destination_name,\n        created_at,\n        event_subtype,\n        message_data,\n\n        case \n        when event_subtype = 'alter_table' then {{ fivetran_utils.json_parse(string='message_data', string_path=['table']) }} \n        when event_subtype = 'create_table' then {{ fivetran_utils.json_parse(string='message_data', string_path=['name']) }} \n        else null end as table_name,\n\n        case \n        when event_subtype = 'create_schema' or event_subtype = 'create_table' then {{ fivetran_utils.json_parse(string='message_data', string_path=['schema']) }} \n        else null end as schema_name\n    \n    from add_connector_info\n)\n\nselect * from final\norder by created_at desc, connector_id", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "fivetran_platform__connector_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_utils.json_parse"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.fivetran_platform__connector_status"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__schema_changelog.sql", "compiled": true, "compiled_code": "with schema_changes as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log`\n\n    where event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n),\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__connector_status`\n),\n\nadd_connector_info as (\n\n    select \n        schema_changes.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n\n    from schema_changes join connector using(connector_id)\n),\n\nfinal as (\n\n    select\n        connector_id,\n        connector_name,\n        destination_id,\n        destination_name,\n        created_at,\n        event_subtype,\n        message_data,\n\n        case \n        when event_subtype = 'alter_table' then \n\n \n  json_extract_scalar(message_data, '$.table')\n\n \n        when event_subtype = 'create_table' then \n\n \n  json_extract_scalar(message_data, '$.name')\n\n \n        else null end as table_name,\n\n        case \n        when event_subtype = 'create_schema' or event_subtype = 'create_table' then \n\n \n  json_extract_scalar(message_data, '$.schema')\n\n \n        else null end as schema_name\n    \n    from add_connector_info\n)\n\nselect * from final\norder by created_at desc, connector_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__connector_daily_events": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__connector_daily_events", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__connector_daily_events.sql", "original_file_path": "models/fivetran_platform__connector_daily_events.sql", "unique_id": "model.fivetran_log.fivetran_platform__connector_daily_events", "fqn": ["fivetran_log", "fivetran_platform__connector_daily_events"], "alias": "fivetran_platform__connector_daily_events", "checksum": {"name": "sha256", "checksum": "44ca08df0d0610d70edd073ed4ad10a7af1919db3075c4974a0cffe876f3cf40"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of each connector's daily history of the quantity of api calls, schema changes, and records modified, starting at the connector's setup date. \n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination loading data from this connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "date_day": {"name": "date_day", "description": "Date on which the number of api calls for the connector is measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "count_api_calls": {"name": "count_api_calls", "description": "The number of api call events logged for this connector on this day.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "count_record_modifications": {"name": "count_record_modifications", "description": "The sum of all records modified (includes updates, inserts, and deletes).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "count_schema_changes": {"name": "count_schema_changes", "description": "The number of schema change events for this connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1699984808.7598379, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__connector_daily_events`", "raw_code": "-- depends_on: {{ var('connector') }}\n\nwith connector as (\n    \n    select * \n    from {{ ref('fivetran_platform__connector_status') }}\n),\n\n-- grab api calls, schema changes, and record modifications\nlog_events as (\n\n    select \n        connector_id,\n        cast( {{ dbt.date_trunc('day', 'created_at') }} as date) as date_day,\n        case \n            when event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config') then 'schema_change' \n            else event_subtype end as event_subtype,\n\n        sum(case when event_subtype = 'records_modified' then cast( {{ fivetran_utils.json_parse(string='message_data', string_path=['count']) }} as {{ dbt.type_int()}} )\n        else 1 end) as count_events \n\n    from {{ ref('stg_fivetran_platform__log') }}\n\n    where event_subtype in ('api_call', \n                            'records_modified', \n                            'create_table', 'alter_table', 'create_schema', 'change_schema_config') -- all schema changes\n                            \n        and connector_id is not null\n\n    group by 1,2,3\n),\n\npivot_out_events as (\n\n    select\n        connector_id,\n        date_day,\n        max(case when event_subtype = 'api_call' then count_events else 0 end) as count_api_calls,\n        max(case when event_subtype = 'records_modified' then count_events else 0 end) as count_record_modifications,\n        max(case when event_subtype = 'schema_change' then count_events else 0 end) as count_schema_changes\n\n    from log_events\n    group by 1,2\n),\n\nconnector_event_counts as (\n\n    select\n        pivot_out_events.date_day,\n        pivot_out_events.count_api_calls,\n        pivot_out_events.count_record_modifications,\n        pivot_out_events.count_schema_changes,\n        connector.connector_name,\n        connector.connector_id,\n        connector.connector_type,\n        connector.destination_name,\n        connector.destination_id,\n        connector.set_up_at\n    from\n    connector left join pivot_out_events \n        on pivot_out_events.connector_id = connector.connector_id\n),\n\nspine as (\n\n    {% if execute %}\n    {% set first_date_query %}\n        select  min( signed_up ) as min_date from {{ var('connector') }}\n    {% endset %}\n    {% set first_date = run_query(first_date_query).columns[0][0]|string %}\n    \n    {% else %} {% set first_date = \"2016-01-01\" %}\n    {% endif %}\n\n    {{ dbt_utils.date_spine(\n        datepart = \"day\", \n        start_date =  \"cast('\" ~ first_date[0:10] ~ \"' as date)\", \n        end_date = dbt.dateadd(\"week\", 1, dbt.date_trunc('day', dbt.current_timestamp_backcompat())) \n        ) \n    }} \n),\n\nconnector_event_history as (\n\n    select\n        cast(spine.date_day as date) as date_day,\n        connector_event_counts.connector_name,\n        connector_event_counts.connector_id,\n        connector_event_counts.connector_type,\n        connector_event_counts.destination_name,\n        connector_event_counts.destination_id,\n        max(case \n            when cast(spine.date_day as date) = connector_event_counts.date_day then connector_event_counts.count_api_calls\n            else 0\n        end) as count_api_calls,\n        max(case \n            when cast(spine.date_day as date) = connector_event_counts.date_day then connector_event_counts.count_record_modifications\n            else 0\n        end) as count_record_modifications,\n        max(case \n            when cast(spine.date_day as date) = connector_event_counts.date_day then connector_event_counts.count_schema_changes\n            else 0\n        end) as count_schema_changes\n    from\n    spine join connector_event_counts\n        on spine.date_day  >= cast( {{ dbt.date_trunc('day', 'connector_event_counts.set_up_at') }} as date)\n\n    group by 1,2,3,4,5,6\n),\n\n-- now rejoin spine to get a complete calendar\njoin_event_history as (\n    \n    select\n        spine.date_day,\n        connector_event_history.connector_name,\n        connector_event_history.connector_id,\n        connector_event_history.connector_type,\n        connector_event_history.destination_name,\n        connector_event_history.destination_id,\n        max(connector_event_history.count_api_calls) as count_api_calls,\n        max(connector_event_history.count_record_modifications) as count_record_modifications,\n        max(connector_event_history.count_schema_changes) as count_schema_changes\n\n    from\n    spine left join connector_event_history\n        on cast(spine.date_day as date) = connector_event_history.date_day\n\n    group by 1,2,3,4,5,6\n),\n\nfinal as (\n\n    select *\n    from join_event_history\n\n    where cast(date_day as timestamp) <= {{ dbt.current_timestamp_backcompat() }}\n\n    order by date_day desc\n)\n\nselect *\nfrom final", "language": "sql", "refs": [{"name": "fivetran_platform__connector_status", "package": null, "version": null}, {"name": "stg_fivetran_platform__log", "package": null, "version": null}], "sources": [["fivetran_platform", "connector"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.fivetran_utils.json_parse", "macro.dbt.type_int", "macro.dbt.current_timestamp_backcompat", "macro.dbt.dateadd", "macro.dbt_utils.date_spine", "macro.dbt.run_query"], "nodes": ["source.fivetran_log.fivetran_platform.connector", "model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.stg_fivetran_platform__log"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__connector_daily_events.sql", "compiled": true, "compiled_code": "-- depends_on: `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`connector`\n\nwith connector as (\n    \n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__connector_status`\n),\n\n-- grab api calls, schema changes, and record modifications\nlog_events as (\n\n    select \n        connector_id,\n        cast( timestamp_trunc(\n        cast(created_at as timestamp),\n        day\n    ) as date) as date_day,\n        case \n            when event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config') then 'schema_change' \n            else event_subtype end as event_subtype,\n\n        sum(case when event_subtype = 'records_modified' then cast( \n\n \n  json_extract_scalar(message_data, '$.count')\n\n as INT64 )\n        else 1 end) as count_events \n\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log`\n\n    where event_subtype in ('api_call', \n                            'records_modified', \n                            'create_table', 'alter_table', 'create_schema', 'change_schema_config') -- all schema changes\n                            \n        and connector_id is not null\n\n    group by 1,2,3\n),\n\npivot_out_events as (\n\n    select\n        connector_id,\n        date_day,\n        max(case when event_subtype = 'api_call' then count_events else 0 end) as count_api_calls,\n        max(case when event_subtype = 'records_modified' then count_events else 0 end) as count_record_modifications,\n        max(case when event_subtype = 'schema_change' then count_events else 0 end) as count_schema_changes\n\n    from log_events\n    group by 1,2\n),\n\nconnector_event_counts as (\n\n    select\n        pivot_out_events.date_day,\n        pivot_out_events.count_api_calls,\n        pivot_out_events.count_record_modifications,\n        pivot_out_events.count_schema_changes,\n        connector.connector_name,\n        connector.connector_id,\n        connector.connector_type,\n        connector.destination_name,\n        connector.destination_id,\n        connector.set_up_at\n    from\n    connector left join pivot_out_events \n        on pivot_out_events.connector_id = connector.connector_id\n),\n\nspine as (\n\n    \n    \n    \n    \n    \n\n    \n\n\n\n\n\nwith rawdata as (\n\n    \n\n    \n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    \n    p0.generated_number * power(2, 0)\n     + \n    \n    p1.generated_number * power(2, 1)\n     + \n    \n    p2.generated_number * power(2, 2)\n     + \n    \n    p3.generated_number * power(2, 3)\n     + \n    \n    p4.generated_number * power(2, 4)\n     + \n    \n    p5.generated_number * power(2, 5)\n     + \n    \n    p6.generated_number * power(2, 6)\n     + \n    \n    p7.generated_number * power(2, 7)\n     + \n    \n    p8.generated_number * power(2, 8)\n     + \n    \n    p9.generated_number * power(2, 9)\n     + \n    \n    p10.generated_number * power(2, 10)\n    \n    \n    + 1\n    as generated_number\n\n    from\n\n    \n    p as p0\n     cross join \n    \n    p as p1\n     cross join \n    \n    p as p2\n     cross join \n    \n    p as p3\n     cross join \n    \n    p as p4\n     cross join \n    \n    p as p5\n     cross join \n    \n    p as p6\n     cross join \n    \n    p as p7\n     cross join \n    \n    p as p8\n     cross join \n    \n    p as p9\n     cross join \n    \n    p as p10\n    \n    \n\n    )\n\n    select *\n    from unioned\n    where generated_number <= 1705\n    order by generated_number\n\n\n\n),\n\nall_periods as (\n\n    select (\n        \n\n        datetime_add(\n            cast( cast('2019-03-22' as date) as datetime),\n        interval row_number() over (order by 1) - 1 day\n        )\n\n\n    ) as date_day\n    from rawdata\n\n),\n\nfiltered as (\n\n    select *\n    from all_periods\n    where date_day <= \n\n        datetime_add(\n            cast( timestamp_trunc(\n        cast(current_timestamp as timestamp),\n        day\n    ) as datetime),\n        interval 1 week\n        )\n\n\n\n)\n\nselect * from filtered\n\n \n),\n\nconnector_event_history as (\n\n    select\n        cast(spine.date_day as date) as date_day,\n        connector_event_counts.connector_name,\n        connector_event_counts.connector_id,\n        connector_event_counts.connector_type,\n        connector_event_counts.destination_name,\n        connector_event_counts.destination_id,\n        max(case \n            when cast(spine.date_day as date) = connector_event_counts.date_day then connector_event_counts.count_api_calls\n            else 0\n        end) as count_api_calls,\n        max(case \n            when cast(spine.date_day as date) = connector_event_counts.date_day then connector_event_counts.count_record_modifications\n            else 0\n        end) as count_record_modifications,\n        max(case \n            when cast(spine.date_day as date) = connector_event_counts.date_day then connector_event_counts.count_schema_changes\n            else 0\n        end) as count_schema_changes\n    from\n    spine join connector_event_counts\n        on spine.date_day  >= cast( timestamp_trunc(\n        cast(connector_event_counts.set_up_at as timestamp),\n        day\n    ) as date)\n\n    group by 1,2,3,4,5,6\n),\n\n-- now rejoin spine to get a complete calendar\njoin_event_history as (\n    \n    select\n        spine.date_day,\n        connector_event_history.connector_name,\n        connector_event_history.connector_id,\n        connector_event_history.connector_type,\n        connector_event_history.destination_name,\n        connector_event_history.destination_id,\n        max(connector_event_history.count_api_calls) as count_api_calls,\n        max(connector_event_history.count_record_modifications) as count_record_modifications,\n        max(connector_event_history.count_schema_changes) as count_schema_changes\n\n    from\n    spine left join connector_event_history\n        on cast(spine.date_day as date) = connector_event_history.date_day\n\n    group by 1,2,3,4,5,6\n),\n\nfinal as (\n\n    select *\n    from join_event_history\n\n    where cast(date_day as timestamp) <= current_timestamp\n\n    order by date_day desc\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__audit_user_activity": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__audit_user_activity", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__audit_user_activity.sql", "original_file_path": "models/fivetran_platform__audit_user_activity.sql", "unique_id": "model.fivetran_log.fivetran_platform__audit_user_activity", "fqn": ["fivetran_log", "fivetran_platform__audit_user_activity"], "alias": "fivetran_platform__audit_user_activity", "checksum": {"name": "sha256", "checksum": "72d7d1bf6cafc362fa9109818038285fdb92a6f883fe935e26ede47273b45dc0"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Each record represents a user-triggered action in your Fivetran instance.This model is intended for audit-trail purposes, as it can be very helpful when trying to trace a user action to a [log event](https://fivetran.com/docs/logs#logeventlist) such as a schema change, sync frequency update,  manual update, broken connection, etc.\n", "columns": {"date_day": {"name": "date_day", "description": "Date on which the user action occurred.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "day_name": {"name": "day_name", "description": "Abbreviated weekday name of the date on which this user action occurred (e.g. Mon, Tues, Wed)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "day_of_month": {"name": "day_of_month", "description": "Day of the month on which this user action occurred (e.g. 2022-03-06 --> 6).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "occurred_at": {"name": "occurred_at", "description": "Timestamp of when the event was logged.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "UI-facing name of the destination on which the user action was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` on which the user action was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector that the user acted upon.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "Foreign key referencing the `connector` that the user acted upon.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "Account email of the user who triggered the action.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "Given name of the user who triggered the action.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "Surname of the user who triggered the action.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "Foreign key referencing the `user` who triggered the action.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_role": {"name": "destination_role", "description": "The acting user's permissions for this individual destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_type": {"name": "event_type", "description": "The umbrella event type. Events can be classified as a warning, an error, or just an information log. Typically = 'INFO' for user-triggered actions.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_subtype": {"name": "event_subtype", "description": "The routine involved in the log event, defined [here](https://fivetran.com/docs/logs#logevents).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_data": {"name": "message_data", "description": "The details of the event in JSON format.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "log_id": {"name": "log_id", "description": "Unique ID of the log record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1699984808.764708, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__audit_user_activity`", "raw_code": "with logs as (\n\n    select \n        *,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['actor']) }} as actor_email\n    from {{ ref('stg_fivetran_platform__log') }}\n),\n\nuser_logs as (\n\n    select *\n    from logs\n    where actor_email is not null \n        and lower(actor_email) != 'fivetran'\n),\n\nconnector as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__connector') }}\n),\n\ndestination as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__destination') }}\n),\n\n{%- if var('fivetran_platform_using_user', true) %}\nusers as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__user') }}\n),\n\n    {%- if var('fivetran_platform_using_destination_membership', true) %}\n    destination_membership as (\n\n        select *\n        from {{ ref('stg_fivetran_platform__destination_membership') }}\n    ),\n    {% endif -%}\n\n{% endif -%}\n\nfinal as (\n\n    select\n        {{ dbt.date_trunc('day', 'user_logs.created_at') }} as date_day,\n        {{ dbt_date.day_name('user_logs.created_at') }} as day_name,\n        {{ dbt_date.day_of_month('user_logs.created_at') }} as day_of_month,\n        user_logs.created_at as occurred_at,\n        destination.destination_name,\n        destination.destination_id,\n        connector.connector_name,\n        connector.connector_id,\n        user_logs.actor_email as email,\n{%- if var('fivetran_platform_using_user', true) %}\n        users.first_name,\n        users.last_name,\n        users.user_id,\n    {%- if var('fivetran_platform_using_destination_membership', true) %}\n        destination_membership.destination_role,\n    {% endif -%}\n{% endif -%}\n\n        user_logs.event_type, -- should always be INFO for user-triggered actions but include just in case\n        user_logs.event_subtype,\n        user_logs.message_data,\n        user_logs.log_id\n\n    from user_logs\n    left join connector\n        on user_logs.connector_id = connector.connector_id\n    left join destination\n        on connector.destination_id = destination.destination_id\n\n{%- if var('fivetran_platform_using_user', true) %}\n    left join users \n        on lower(users.email) = lower(user_logs.actor_email)\n\n    {%- if var('fivetran_platform_using_destination_membership', true) %}\n    left join destination_membership\n        on destination.destination_id = destination_membership.destination_id\n        and users.user_id = destination_membership.user_id\n\n    {% endif -%}\n{% endif -%}\n\n)\n\nselect *\nfrom final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "stg_fivetran_platform__connector", "package": null, "version": null}, {"name": "stg_fivetran_platform__destination", "package": null, "version": null}, {"name": "stg_fivetran_platform__user", "package": null, "version": null}, {"name": "stg_fivetran_platform__destination_membership", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_utils.json_parse", "macro.dbt.date_trunc", "macro.dbt_date.day_name", "macro.dbt_date.day_of_month"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination", "model.fivetran_log.stg_fivetran_platform__user", "model.fivetran_log.stg_fivetran_platform__destination_membership"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__audit_user_activity.sql", "compiled": true, "compiled_code": "with logs as (\n\n    select \n        *,\n        \n\n \n  json_extract_scalar(message_data, '$.actor')\n\n as actor_email\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log`\n),\n\nuser_logs as (\n\n    select *\n    from logs\n    where actor_email is not null \n        and lower(actor_email) != 'fivetran'\n),\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__connector`\n),\n\ndestination as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__destination`\n),\nusers as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__user`\n),\n    destination_membership as (\n\n        select *\n        from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__destination_membership`\n    ),\n    final as (\n\n    select\n        timestamp_trunc(\n        cast(user_logs.created_at as timestamp),\n        day\n    ) as date_day,\n        format_date('%a', cast(user_logs.created_at as date)) as day_name,\n        extract(day from user_logs.created_at) as day_of_month,\n        user_logs.created_at as occurred_at,\n        destination.destination_name,\n        destination.destination_id,\n        connector.connector_name,\n        connector.connector_id,\n        user_logs.actor_email as email,\n        users.first_name,\n        users.last_name,\n        users.user_id,\n        destination_membership.destination_role,\n    user_logs.event_type, -- should always be INFO for user-triggered actions but include just in case\n        user_logs.event_subtype,\n        user_logs.message_data,\n        user_logs.log_id\n\n    from user_logs\n    left join connector\n        on user_logs.connector_id = connector.connector_id\n    left join destination\n        on connector.destination_id = destination.destination_id\n    left join users \n        on lower(users.email) = lower(user_logs.actor_email)\n    left join destination_membership\n        on destination.destination_id = destination_membership.destination_id\n        and users.user_id = destination_membership.user_id\n\n    )\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__connector_status": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__connector_status", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__connector_status.sql", "original_file_path": "models/fivetran_platform__connector_status.sql", "unique_id": "model.fivetran_log.fivetran_platform__connector_status", "fqn": ["fivetran_log", "fivetran_platform__connector_status"], "alias": "fivetran_platform__connector_status", "checksum": {"name": "sha256", "checksum": "d403267d0fb02ffe79cbc3f986f607df335cacdacf887afa0a5d1124761a3db6"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of each destination's connector and details surrounding its  connection and data-sync status.\n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination loading data from this connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_health": {"name": "connector_health", "description": "Status of the connector's data flow. Can be `\"broken\"`, `\"incomplete\"`, `\"connected\"`, `\"paused\"`, `\"initial sync in progress\"`, or `\"priority first sync\"`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_successful_sync_completed_at": {"name": "last_successful_sync_completed_at", "description": "Timestamp of when the last sync attempt was completed. This could be either a failure or a successful sync.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_sync_started_at": {"name": "last_sync_started_at", "description": "Timestamp of when the last sync was started. Note that if new data comes in after a sync has  begun, the new data will not be included in this sync.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_sync_completed_at": {"name": "last_sync_completed_at", "description": "Timestamp of when the last sync was completed.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "set_up_at": {"name": "set_up_at", "description": "Timestamp of when the connector was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "number_of_schema_changes_last_month": {"name": "number_of_schema_changes_last_month", "description": "The number of schema changes (creating tables or schemas and altering tables) in the past 30 days.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "errors_since_last_completed_sync": {"name": "errors_since_last_completed_sync", "description": "Aggregated line-separated list of error messages (in JSON format) raised synce the last  sync completion. \n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "warnings_since_last_completed_sync": {"name": "warnings_since_last_completed_sync", "description": "Aggregated line-separated list of warning messages (in JSON format) raised synce the last  sync completion. \n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1699984808.7552562, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__connector_status`", "raw_code": "with transformation_removal as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__log') }}\n    where transformation_id is null\n\n),\n\nconnector_log as (\n    select \n        *,\n        sum( case when event_subtype in ('sync_start') then 1 else 0 end) over ( partition by connector_id \n            order by created_at rows unbounded preceding) as sync_batch_id\n    from transformation_removal\n    -- only looking at errors, warnings, and syncs here\n    where event_type = 'SEVERE'\n        or event_type = 'WARNING'\n        or event_subtype like 'sync%'\n        or (event_subtype = 'status' \n            and {{ fivetran_utils.json_parse(string=\"message_data\", string_path=[\"status\"]) }} = 'RESCHEDULED'\n            \n            and {{ fivetran_utils.json_parse(string=\"message_data\", string_path=[\"reason\"]) }} like '%intended behavior%'\n            ) -- for priority-first syncs. these should be captured by event_type = 'WARNING' but let's make sure\n        or (event_subtype = 'status' \n            and {{ fivetran_utils.json_parse(string=\"message_data\", string_path=[\"status\"]) }} = 'SUCCESSFUL'\n        )\n        -- whole reason is \"We have rescheduled the connector to force flush data from the forward sync into your destination. This is intended behavior and means that the connector is working as expected.\"\n),\n\nschema_changes as (\n\n    select\n        connector_id,\n        count(*) as number_of_schema_changes_last_month\n\n    from {{ ref('stg_fivetran_platform__log') }}\n\n    where \n        {{ dbt.datediff('created_at', dbt.current_timestamp_backcompat(), 'day') }} <= 30\n        and event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n\n    group by 1\n\n),\n\nconnector as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__connector') }}\n\n),\n\ndestination as (\n\n    select * \n    from {{ ref('stg_fivetran_platform__destination') }}\n),\n\nconnector_metrics as (\n\n    select\n        connector.connector_id,\n        connector.connector_name,\n        connector.connector_type,\n        connector.destination_id,\n        connector.is_paused,\n        connector.set_up_at,\n        max(case when connector_log.event_subtype = 'sync_start' then connector_log.created_at else null end) as last_sync_started_at,\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.created_at else null end) as last_sync_completed_at,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"status\"]) }} ='SUCCESSFUL'\n            then connector_log.created_at else null end) as last_successful_sync_completed_at,\n\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.sync_batch_id else null end) as last_sync_batch_id,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"status\"]) }} ='RESCHEDULED'\n                and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"reason\"]) }} like '%intended behavior%'\n            then connector_log.created_at else null end) as last_priority_first_sync_completed_at,\n                \n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.created_at else null end) as last_error_at,\n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.sync_batch_id else null end) as last_error_batch,\n        max(case when event_type = 'WARNING' then connector_log.created_at else null end) as last_warning_at\n\n    from connector \n    left join connector_log \n        on connector_log.connector_id = connector.connector_id\n    {{ dbt_utils.group_by(n=6) }}\n\n),\n\nconnector_health as (\n\n    select\n        *,\n        case \n            -- connector is paused\n            when is_paused then 'paused'\n\n            -- a sync has never been attempted\n            when last_sync_started_at is null then 'incomplete'\n\n            -- a priority-first sync has occurred, but a normal sync has not\n            when last_priority_first_sync_completed_at is not null and last_sync_completed_at is null then 'priority first sync'\n\n            -- a priority sync has occurred more recently than a normal one (may occurr if the connector has been paused and resumed)\n            when last_priority_first_sync_completed_at > last_sync_completed_at then 'priority first sync'\n\n            -- a sync has been attempted, but not completed, and it's not due to errors. also a priority-first sync hasn't\n            when last_sync_completed_at is null and last_error_at is null then 'initial sync in progress'\n\n            -- the last attempted sync had an error\n            when last_sync_batch_id = last_error_batch then 'broken'\n\n            -- there's never been a successful sync and there have been errors\n            when last_sync_completed_at is null and last_error_at is not null then 'broken'\n\n        else 'connected' end as connector_health\n\n    from connector_metrics\n),\n\n-- Joining with log to grab pertinent error/warning messagees\nconnector_recent_logs as (\n\n    select \n        connector_health.connector_id,\n        connector_health.connector_name,\n        connector_health.connector_type,\n        connector_health.destination_id,\n        connector_health.connector_health,\n        connector_health.last_successful_sync_completed_at,\n        connector_health.last_sync_started_at,\n        connector_health.last_sync_completed_at,\n        connector_health.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n    from connector_health \n    left join connector_log \n        on connector_log.connector_id = connector_health.connector_id\n        -- limiting relevance to since the last successful sync completion (if there has been one)\n        and connector_log.created_at > coalesce(connector_health.last_sync_completed_at, connector_health.last_priority_first_sync_completed_at, '2000-01-01') \n        -- only looking at errors and warnings (excluding syncs - both normal and priority first)\n        and connector_log.event_type != 'INFO' \n        -- need to explicitly avoid priority first statuses because they are of event_type WARNING\n        and not (connector_log.event_subtype = 'status' \n            and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"status\"]) }} ='RESCHEDULED'\n            and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"reason\"]) }} like '%intended behavior%')\n\n    {{ dbt_utils.group_by(n=12) }} -- de-duping error messages\n    \n\n),\n\nfinal as (\n\n    select\n        connector_recent_logs.connector_id,\n        connector_recent_logs.connector_name,\n        connector_recent_logs.connector_type,\n        connector_recent_logs.destination_id,\n        destination.destination_name,\n        connector_recent_logs.connector_health,\n        connector_recent_logs.last_successful_sync_completed_at,\n        connector_recent_logs.last_sync_started_at,\n        connector_recent_logs.last_sync_completed_at,\n        connector_recent_logs.set_up_at,\n        coalesce(schema_changes.number_of_schema_changes_last_month, 0) as number_of_schema_changes_last_month\n        \n        {% if var('fivetran_platform_using_sync_alert_messages', true) %}\n        , {{ fivetran_utils.string_agg(\"distinct case when connector_recent_logs.event_type = 'SEVERE' then connector_recent_logs.message_data else null end\", \"'\\\\n'\") }} as errors_since_last_completed_sync\n        , {{ fivetran_utils.string_agg(\"distinct case when connector_recent_logs.event_type = 'WARNING' then connector_recent_logs.message_data else null end\", \"'\\\\n'\") }} as warnings_since_last_completed_sync\n        {% endif %}\n\n    from connector_recent_logs\n    left join schema_changes \n        on connector_recent_logs.connector_id = schema_changes.connector_id \n\n    join destination on destination.destination_id = connector_recent_logs.destination_id\n    {{ dbt_utils.group_by(n=11) }}\n)\n\nselect * from final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "stg_fivetran_platform__connector", "package": null, "version": null}, {"name": "stg_fivetran_platform__destination", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_utils.json_parse", "macro.dbt.current_timestamp_backcompat", "macro.dbt.datediff", "macro.dbt_utils.group_by", "macro.fivetran_utils.string_agg"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__connector_status.sql", "compiled": true, "compiled_code": "with transformation_removal as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log`\n    where transformation_id is null\n\n),\n\nconnector_log as (\n    select \n        *,\n        sum( case when event_subtype in ('sync_start') then 1 else 0 end) over ( partition by connector_id \n            order by created_at rows unbounded preceding) as sync_batch_id\n    from transformation_removal\n    -- only looking at errors, warnings, and syncs here\n    where event_type = 'SEVERE'\n        or event_type = 'WARNING'\n        or event_subtype like 'sync%'\n        or (event_subtype = 'status' \n            and \n\n \n  json_extract_scalar(message_data, '$.status')\n\n = 'RESCHEDULED'\n            \n            and \n\n \n  json_extract_scalar(message_data, '$.reason')\n\n like '%intended behavior%'\n            ) -- for priority-first syncs. these should be captured by event_type = 'WARNING' but let's make sure\n        or (event_subtype = 'status' \n            and \n\n \n  json_extract_scalar(message_data, '$.status')\n\n = 'SUCCESSFUL'\n        )\n        -- whole reason is \"We have rescheduled the connector to force flush data from the forward sync into your destination. This is intended behavior and means that the connector is working as expected.\"\n),\n\nschema_changes as (\n\n    select\n        connector_id,\n        count(*) as number_of_schema_changes_last_month\n\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log`\n\n    where \n        \n\n    datetime_diff(\n        cast(current_timestamp as datetime),\n        cast(created_at as datetime),\n        day\n    )\n\n   <= 30\n        and event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n\n    group by 1\n\n),\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__connector`\n\n),\n\ndestination as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__destination`\n),\n\nconnector_metrics as (\n\n    select\n        connector.connector_id,\n        connector.connector_name,\n        connector.connector_type,\n        connector.destination_id,\n        connector.is_paused,\n        connector.set_up_at,\n        max(case when connector_log.event_subtype = 'sync_start' then connector_log.created_at else null end) as last_sync_started_at,\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.created_at else null end) as last_sync_completed_at,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and \n\n \n  json_extract_scalar(connector_log.message_data, '$.status')\n\n ='SUCCESSFUL'\n            then connector_log.created_at else null end) as last_successful_sync_completed_at,\n\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.sync_batch_id else null end) as last_sync_batch_id,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and \n\n \n  json_extract_scalar(connector_log.message_data, '$.status')\n\n ='RESCHEDULED'\n                and \n\n \n  json_extract_scalar(connector_log.message_data, '$.reason')\n\n like '%intended behavior%'\n            then connector_log.created_at else null end) as last_priority_first_sync_completed_at,\n                \n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.created_at else null end) as last_error_at,\n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.sync_batch_id else null end) as last_error_batch,\n        max(case when event_type = 'WARNING' then connector_log.created_at else null end) as last_warning_at\n\n    from connector \n    left join connector_log \n        on connector_log.connector_id = connector.connector_id\n    group by 1,2,3,4,5,6\n\n),\n\nconnector_health as (\n\n    select\n        *,\n        case \n            -- connector is paused\n            when is_paused then 'paused'\n\n            -- a sync has never been attempted\n            when last_sync_started_at is null then 'incomplete'\n\n            -- a priority-first sync has occurred, but a normal sync has not\n            when last_priority_first_sync_completed_at is not null and last_sync_completed_at is null then 'priority first sync'\n\n            -- a priority sync has occurred more recently than a normal one (may occurr if the connector has been paused and resumed)\n            when last_priority_first_sync_completed_at > last_sync_completed_at then 'priority first sync'\n\n            -- a sync has been attempted, but not completed, and it's not due to errors. also a priority-first sync hasn't\n            when last_sync_completed_at is null and last_error_at is null then 'initial sync in progress'\n\n            -- the last attempted sync had an error\n            when last_sync_batch_id = last_error_batch then 'broken'\n\n            -- there's never been a successful sync and there have been errors\n            when last_sync_completed_at is null and last_error_at is not null then 'broken'\n\n        else 'connected' end as connector_health\n\n    from connector_metrics\n),\n\n-- Joining with log to grab pertinent error/warning messagees\nconnector_recent_logs as (\n\n    select \n        connector_health.connector_id,\n        connector_health.connector_name,\n        connector_health.connector_type,\n        connector_health.destination_id,\n        connector_health.connector_health,\n        connector_health.last_successful_sync_completed_at,\n        connector_health.last_sync_started_at,\n        connector_health.last_sync_completed_at,\n        connector_health.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n    from connector_health \n    left join connector_log \n        on connector_log.connector_id = connector_health.connector_id\n        -- limiting relevance to since the last successful sync completion (if there has been one)\n        and connector_log.created_at > coalesce(connector_health.last_sync_completed_at, connector_health.last_priority_first_sync_completed_at, '2000-01-01') \n        -- only looking at errors and warnings (excluding syncs - both normal and priority first)\n        and connector_log.event_type != 'INFO' \n        -- need to explicitly avoid priority first statuses because they are of event_type WARNING\n        and not (connector_log.event_subtype = 'status' \n            and \n\n \n  json_extract_scalar(connector_log.message_data, '$.status')\n\n ='RESCHEDULED'\n            and \n\n \n  json_extract_scalar(connector_log.message_data, '$.reason')\n\n like '%intended behavior%')\n\n    group by 1,2,3,4,5,6,7,8,9,10,11,12 -- de-duping error messages\n    \n\n),\n\nfinal as (\n\n    select\n        connector_recent_logs.connector_id,\n        connector_recent_logs.connector_name,\n        connector_recent_logs.connector_type,\n        connector_recent_logs.destination_id,\n        destination.destination_name,\n        connector_recent_logs.connector_health,\n        connector_recent_logs.last_successful_sync_completed_at,\n        connector_recent_logs.last_sync_started_at,\n        connector_recent_logs.last_sync_completed_at,\n        connector_recent_logs.set_up_at,\n        coalesce(schema_changes.number_of_schema_changes_last_month, 0) as number_of_schema_changes_last_month\n        \n        \n        , \n    string_agg(distinct case when connector_recent_logs.event_type = 'SEVERE' then connector_recent_logs.message_data else null end, '\\n')\n\n as errors_since_last_completed_sync\n        , \n    string_agg(distinct case when connector_recent_logs.event_type = 'WARNING' then connector_recent_logs.message_data else null end, '\\n')\n\n as warnings_since_last_completed_sync\n        \n\n    from connector_recent_logs\n    left join schema_changes \n        on connector_recent_logs.connector_id = schema_changes.connector_id \n\n    join destination on destination.destination_id = connector_recent_logs.destination_id\n    group by 1,2,3,4,5,6,7,8,9,10,11\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__usage_mar_destination_history": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__usage_mar_destination_history", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__usage_mar_destination_history.sql", "original_file_path": "models/fivetran_platform__usage_mar_destination_history.sql", "unique_id": "model.fivetran_log.fivetran_platform__usage_mar_destination_history", "fqn": ["fivetran_log", "fivetran_platform__usage_mar_destination_history"], "alias": "fivetran_platform__usage_mar_destination_history", "checksum": {"name": "sha256", "checksum": "ab962816e746f200a9c00116b692d52ec9ff28c4344cf390b431dc4d9d6aa24f"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of each destination's usage and active volume, per month. Includes the  usage per million MAR and MAR per usage. Usage either refers to a dollar or credit amount, depending on customer's pricing model. Read more about the relationship between usage and MAR [here](https://www.fivetran.com/legal/service-consumption-table).\n", "columns": {"measured_month": {"name": "measured_month", "description": "The month (yyyy-mm-01) of the usage/MAR measurement.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse housing the active rows.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination as it appears in the UI.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "free_monthly_active_rows": {"name": "free_monthly_active_rows", "description": "The number of free active rows measured in the destination for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_monthly_active_rows": {"name": "paid_monthly_active_rows", "description": "The number of paid active rows measured in the destination for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_monthly_active_rows": {"name": "total_monthly_active_rows", "description": "The total number of active rows measured in the destination for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "credits_spent_per_million_mar": {"name": "credits_spent_per_million_mar", "description": "The ratio of credits spent that month per every million active rows synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mar_per_credit_spent": {"name": "mar_per_credit_spent", "description": "The ratio of the month's active volume to credits spent.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "amount_spent_per_million_mar": {"name": "amount_spent_per_million_mar", "description": "The ratio of amount spent that month per every million active rows synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mar_per_amount_spent": {"name": "mar_per_amount_spent", "description": "The ratio of the month's active volume to amount spent.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "credits_spent": {"name": "credits_spent", "description": "The number of credits used by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dollars_spent": {"name": "dollars_spent", "description": "The dollar amount used by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1699984808.7583401, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__usage_mar_destination_history`", "raw_code": "with table_mar as (\n    \n    select *\n    from {{ ref('fivetran_platform__mar_table_history') }}\n),\n\ncredits_used as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__credits_used') }}\n),\n\nuseage_cost as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__usage_cost') }}\n),\n\ndestination_mar as (\n\n    select \n        measured_month,\n        destination_id,\n        destination_name,\n        sum(free_monthly_active_rows) as free_monthly_active_rows,\n        sum(paid_monthly_active_rows) as paid_monthly_active_rows,\n        sum(total_monthly_active_rows) as total_monthly_active_rows\n    from table_mar\n    group by 1,2,3\n),\n\nusage as (\n\n    select \n        coalesce(credits_used.destination_id, useage_cost.destination_id) as destination_id,\n        credits_used.credits_spent,\n        useage_cost.dollars_spent,\n        cast(concat(coalesce(credits_used.measured_month,useage_cost.measured_month), '-01') as date) as measured_month -- match date format to join with MAR table\n    from credits_used\n    full outer join useage_cost\n        on useage_cost.measured_month = credits_used.measured_month\n        and useage_cost.destination_id = credits_used.destination_id\n),\n\njoin_usage_mar as (\n\n    select \n        destination_mar.measured_month,\n        destination_mar.destination_id,\n        destination_mar.destination_name,\n        usage.credits_spent,\n        usage.dollars_spent,\n        destination_mar.free_monthly_active_rows,\n        destination_mar.paid_monthly_active_rows,\n        destination_mar.total_monthly_active_rows,\n\n        -- credit and usage mar calculations\n        round( cast(nullif(usage.credits_spent,0) * 1000000.0 as {{ dbt.type_numeric() }}) / cast(nullif(destination_mar.total_monthly_active_rows,0) as {{ dbt.type_numeric() }}), 2) as credits_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as {{ dbt.type_numeric() }}) / cast(nullif(usage.credits_spent,0) as {{ dbt.type_numeric() }}), 0) as mar_per_credit_spent,\n        round( cast(nullif(usage.dollars_spent,0) * 1000000.0 as {{ dbt.type_numeric() }}) / cast(nullif(destination_mar.total_monthly_active_rows,0) as {{ dbt.type_numeric() }}), 2) as amount_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as {{ dbt.type_numeric() }}) / cast(nullif(usage.dollars_spent,0) as {{ dbt.type_numeric() }}), 0) as mar_per_amount_spent\n    from destination_mar \n    left join usage \n        on destination_mar.measured_month = cast(usage.measured_month as timestamp)\n        and destination_mar.destination_id = usage.destination_id\n)\n\nselect * \nfrom join_usage_mar\norder by measured_month desc", "language": "sql", "refs": [{"name": "fivetran_platform__mar_table_history", "package": null, "version": null}, {"name": "stg_fivetran_platform__credits_used", "package": null, "version": null}, {"name": "stg_fivetran_platform__usage_cost", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_numeric"], "nodes": ["model.fivetran_log.fivetran_platform__mar_table_history", "model.fivetran_log.stg_fivetran_platform__credits_used", "model.fivetran_log.stg_fivetran_platform__usage_cost"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__usage_mar_destination_history.sql", "compiled": true, "compiled_code": "with table_mar as (\n    \n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__mar_table_history`\n),\n\ncredits_used as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__credits_used`\n),\n\nuseage_cost as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__usage_cost`\n),\n\ndestination_mar as (\n\n    select \n        measured_month,\n        destination_id,\n        destination_name,\n        sum(free_monthly_active_rows) as free_monthly_active_rows,\n        sum(paid_monthly_active_rows) as paid_monthly_active_rows,\n        sum(total_monthly_active_rows) as total_monthly_active_rows\n    from table_mar\n    group by 1,2,3\n),\n\nusage as (\n\n    select \n        coalesce(credits_used.destination_id, useage_cost.destination_id) as destination_id,\n        credits_used.credits_spent,\n        useage_cost.dollars_spent,\n        cast(concat(coalesce(credits_used.measured_month,useage_cost.measured_month), '-01') as date) as measured_month -- match date format to join with MAR table\n    from credits_used\n    full outer join useage_cost\n        on useage_cost.measured_month = credits_used.measured_month\n        and useage_cost.destination_id = credits_used.destination_id\n),\n\njoin_usage_mar as (\n\n    select \n        destination_mar.measured_month,\n        destination_mar.destination_id,\n        destination_mar.destination_name,\n        usage.credits_spent,\n        usage.dollars_spent,\n        destination_mar.free_monthly_active_rows,\n        destination_mar.paid_monthly_active_rows,\n        destination_mar.total_monthly_active_rows,\n\n        -- credit and usage mar calculations\n        round( cast(nullif(usage.credits_spent,0) * 1000000.0 as numeric) / cast(nullif(destination_mar.total_monthly_active_rows,0) as numeric), 2) as credits_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as numeric) / cast(nullif(usage.credits_spent,0) as numeric), 0) as mar_per_credit_spent,\n        round( cast(nullif(usage.dollars_spent,0) * 1000000.0 as numeric) / cast(nullif(destination_mar.total_monthly_active_rows,0) as numeric), 2) as amount_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as numeric) / cast(nullif(usage.dollars_spent,0) as numeric), 0) as mar_per_amount_spent\n    from destination_mar \n    left join usage \n        on destination_mar.measured_month = cast(usage.measured_month as timestamp)\n        and destination_mar.destination_id = usage.destination_id\n)\n\nselect * \nfrom join_usage_mar\norder by measured_month desc", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__audit_table": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__audit_table", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__audit_table.sql", "original_file_path": "models/fivetran_platform__audit_table.sql", "unique_id": "model.fivetran_log.fivetran_platform__audit_table", "fqn": ["fivetran_log", "fivetran_platform__audit_table"], "alias": "fivetran_platform__audit_table", "checksum": {"name": "sha256", "checksum": "23c2f818b00582996f1e9abfaf45ffdfe435167ccea059b7f3986302e0ddb88e"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "incremental", "incremental_strategy": "insert_overwrite", "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": "unique_table_sync_key", "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "partition_by": {"field": "sync_start", "data_type": "timestamp", "granularity": "day"}, "file_format": "parquet"}, "tags": [], "description": "Table replacing the deprecated `fivetran_audit` table. For each table written to in a sync, captures timestamps and row quantities around table syncs. Each record represents a table being written to in a connector sync. Note: the quantities here will not match the deprecated `fivetran_audit` table completely, as `fivetran_audit` reported on pre-duplicated data loads.\n", "columns": {"unique_table_sync_key": {"name": "unique_table_sync_key", "description": "Primary key of this table, hashed on `schema_name`, `connector_id`, `destination_id`, `table_name`, and `unique_table_sync_key`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "Name of the schema. In cases when the schema is not provided the connector_name is used.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Name of the table being written to.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination that the table is being written to.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "write_to_table_start": {"name": "write_to_table_start", "description": "Timestamp of when Fivetran began to write to this table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "write_to_table_end": {"name": "write_to_table_end", "description": "Timestamp of when Fivetran finished writing to this table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_start": {"name": "sync_start", "description": "Timestamp of when this connector-level sync began.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_end": {"name": "sync_end", "description": "Timestamp of when this connector-level sync finished, if successful.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sum_rows_replaced_or_inserted": {"name": "sum_rows_replaced_or_inserted", "description": "Sum of the rows replaced or inserted into this table during a sync.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sum_rows_updated": {"name": "sum_rows_updated", "description": "Sum of the rows updated in this table during a sync.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sum_rows_deleted": {"name": "sum_rows_deleted", "description": "Sum of the rows deleted from this table during a sync.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_start_day": {"name": "sync_start_day", "description": "The `sync_start` field truncated to the `day`. This field is used for partitioning in Databricks while using the `insert_overwrite` incremental method.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "incremental", "schema": "fivetran_platform", "unique_key": "unique_table_sync_key", "partition_by": {"field": "sync_start", "data_type": "timestamp", "granularity": "day"}, "incremental_strategy": "insert_overwrite", "file_format": "parquet"}, "created_at": 1699984808.7617521, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__audit_table`", "raw_code": "{{ config(\n    materialized='incremental',\n    unique_key='unique_table_sync_key',\n    partition_by={\n        'field': 'sync_start',\n        'data_type': 'timestamp',\n        'granularity': 'day'\n    } if target.type == 'bigquery' else ['sync_start_day'],\n    incremental_strategy='insert_overwrite' if target.type in ('bigquery', 'spark', 'databricks') else 'delete+insert',\n    file_format='parquet'\n) }}\n\nwith sync_log as (\n    \n    select \n        *,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['table']) }} as table_name\n    from {{ ref('stg_fivetran_platform__log') }}\n    where event_subtype in ('sync_start', 'sync_end', 'write_to_table_start', 'write_to_table_end', 'records_modified')\n\n    {% if is_incremental() %}\n\n    -- Capture the latest timestamp in a call statement instead of a subquery for optimizing BQ costs on incremental runs\n    {%- call statement('max_sync_start', fetch_result=True) -%}\n        select date(max(sync_start)) from {{ this }}\n    {%- endcall -%}\n\n    -- load the result from the above query into a new variable\n    {%- set query_result = load_result('max_sync_start') -%}\n\n    -- the query_result is stored as a dataframe. Therefore, we want to now store it as a singular value.\n    {%- set max_sync_start = query_result['data'][0][0] -%}\n\n    -- compare the new batch of data to the latest sync already stored in this model\n    and date(created_at) > '{{ max_sync_start }}'\n\n    {% endif %}\n),\n\n\nconnector as (\n\n    select *\n    from {{ ref('fivetran_platform__connector_status') }}\n),\n\nadd_connector_info as (\n\n    select \n        sync_log.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n    from sync_log \n    left join connector\n        on connector.connector_id = sync_log.connector_id\n),\n\nsync_timestamps as (\n\n    select\n        connector_id,\n        connector_name,\n        table_name,\n        event_subtype,\n        destination_id,\n        destination_name,\n        created_at as write_to_table_start,\n        min(case when event_subtype = 'write_to_table_end' then created_at else null end) \n            over (partition by connector_id, table_name order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as write_to_table_end,\n\n        max(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between UNBOUNDED PRECEDING and CURRENT ROW) as sync_start,\n\n        min(case when event_subtype = 'sync_end' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as sync_end, -- coalesce with next_sync_start\n\n        min(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as next_sync_start\n    from add_connector_info\n),\n\n-- this will be the base for every record in the final CTE\nlimit_to_table_starts as (\n\n    select *\n    from sync_timestamps \n    where event_subtype = 'write_to_table_start'\n),\n\nrecords_modified_log as (\n\n    select \n        connector_id,\n        created_at,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['table']) }} as table_name,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['schema']) }} as schema_name,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['operationType']) }} as operation_type,\n        cast ({{ fivetran_utils.json_parse(string='message_data', string_path=['count']) }} as {{ dbt.type_int() }}) as row_count\n    from sync_log \n    where event_subtype = 'records_modified'\n\n),\n\nsum_records_modified as (\n\n    select\n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name) as schema_name,\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end as sync_end,\n        sum(case when records_modified_log.operation_type = 'REPLACED_OR_INSERTED' then records_modified_log.row_count else 0 end) as sum_rows_replaced_or_inserted,\n        sum(case when records_modified_log.operation_type = 'UPDATED' then records_modified_log.row_count else 0 end) as sum_rows_updated,\n        sum(case when records_modified_log.operation_type = 'DELETED' then records_modified_log.row_count else 0 end) as sum_rows_deleted\n    from limit_to_table_starts\n    left join records_modified_log on \n        limit_to_table_starts.connector_id = records_modified_log.connector_id\n        and limit_to_table_starts.table_name = records_modified_log.table_name\n\n        -- confine it to one sync\n        and records_modified_log.created_at > limit_to_table_starts.sync_start \n        and records_modified_log.created_at < coalesce(limit_to_table_starts.sync_end, limit_to_table_starts.next_sync_start) \n\n    {{ dbt_utils.group_by(n=10) }}\n),\n\nfinal as (\n\n    select \n        *,\n        {{ dbt_utils.generate_surrogate_key(['schema_name','connector_id', 'destination_id', 'table_name', 'write_to_table_start']) }} as unique_table_sync_key, -- for incremental materialization \n        {{ dbt.date_trunc('day', 'sync_start') }} as sync_start_day -- for partitioning in databricks\n    from sum_records_modified\n)\n\nselect *\nfrom final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "fivetran_platform__connector_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_utils.json_parse", "macro.dbt.is_incremental", "macro.dbt.type_int", "macro.dbt_utils.group_by", "macro.dbt_utils.generate_surrogate_key", "macro.dbt.date_trunc", "macro.dbt.statement"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.fivetran_platform__connector_status"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__audit_table.sql", "compiled": true, "compiled_code": "\n\nwith sync_log as (\n    \n    select \n        *,\n        \n\n \n  json_extract_scalar(message_data, '$.table')\n\n as table_name\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log`\n    where event_subtype in ('sync_start', 'sync_end', 'write_to_table_start', 'write_to_table_end', 'records_modified')\n\n    \n\n    -- Capture the latest timestamp in a call statement instead of a subquery for optimizing BQ costs on incremental runs-- load the result from the above query into a new variable-- the query_result is stored as a dataframe. Therefore, we want to now store it as a singular value.-- compare the new batch of data to the latest sync already stored in this model\n    and date(created_at) > '2021-12-10'\n\n    \n),\n\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__connector_status`\n),\n\nadd_connector_info as (\n\n    select \n        sync_log.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n    from sync_log \n    left join connector\n        on connector.connector_id = sync_log.connector_id\n),\n\nsync_timestamps as (\n\n    select\n        connector_id,\n        connector_name,\n        table_name,\n        event_subtype,\n        destination_id,\n        destination_name,\n        created_at as write_to_table_start,\n        min(case when event_subtype = 'write_to_table_end' then created_at else null end) \n            over (partition by connector_id, table_name order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as write_to_table_end,\n\n        max(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between UNBOUNDED PRECEDING and CURRENT ROW) as sync_start,\n\n        min(case when event_subtype = 'sync_end' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as sync_end, -- coalesce with next_sync_start\n\n        min(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as next_sync_start\n    from add_connector_info\n),\n\n-- this will be the base for every record in the final CTE\nlimit_to_table_starts as (\n\n    select *\n    from sync_timestamps \n    where event_subtype = 'write_to_table_start'\n),\n\nrecords_modified_log as (\n\n    select \n        connector_id,\n        created_at,\n        \n\n \n  json_extract_scalar(message_data, '$.table')\n\n as table_name,\n        \n\n \n  json_extract_scalar(message_data, '$.schema')\n\n as schema_name,\n        \n\n \n  json_extract_scalar(message_data, '$.operationType')\n\n as operation_type,\n        cast (\n\n \n  json_extract_scalar(message_data, '$.count')\n\n as INT64) as row_count\n    from sync_log \n    where event_subtype = 'records_modified'\n\n),\n\nsum_records_modified as (\n\n    select\n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name) as schema_name,\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end as sync_end,\n        sum(case when records_modified_log.operation_type = 'REPLACED_OR_INSERTED' then records_modified_log.row_count else 0 end) as sum_rows_replaced_or_inserted,\n        sum(case when records_modified_log.operation_type = 'UPDATED' then records_modified_log.row_count else 0 end) as sum_rows_updated,\n        sum(case when records_modified_log.operation_type = 'DELETED' then records_modified_log.row_count else 0 end) as sum_rows_deleted\n    from limit_to_table_starts\n    left join records_modified_log on \n        limit_to_table_starts.connector_id = records_modified_log.connector_id\n        and limit_to_table_starts.table_name = records_modified_log.table_name\n\n        -- confine it to one sync\n        and records_modified_log.created_at > limit_to_table_starts.sync_start \n        and records_modified_log.created_at < coalesce(limit_to_table_starts.sync_end, limit_to_table_starts.next_sync_start) \n\n    group by 1,2,3,4,5,6,7,8,9,10\n),\n\nfinal as (\n\n    select \n        *,\n        to_hex(md5(cast(coalesce(cast(schema_name as string), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(connector_id as string), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(destination_id as string), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(table_name as string), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(write_to_table_start as string), '_dbt_utils_surrogate_key_null_') as string))) as unique_table_sync_key, -- for incremental materialization \n        timestamp_trunc(\n        cast(sync_start as timestamp),\n        day\n    ) as sync_start_day -- for partitioning in databricks\n    from sum_records_modified\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__mar_table_history": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__mar_table_history", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__mar_table_history.sql", "original_file_path": "models/fivetran_platform__mar_table_history.sql", "unique_id": "model.fivetran_log.fivetran_platform__mar_table_history", "fqn": ["fivetran_log", "fivetran_platform__mar_table_history"], "alias": "fivetran_platform__mar_table_history", "checksum": {"name": "sha256", "checksum": "0a2dd3c4c64744071133d2a5e46e555eb203cfc648e003fd4a2928d7e2889727"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of each table's monthly active rows (MAR) for all connectors, destinations, and schemas, per month. Read more about how monthly active rows are defined and calculated  [here](https://fivetran.com/docs/getting-started/consumption-based-pricing).\n", "columns": {"connector_name": {"name": "connector_name", "description": "Name of the connector loading this table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "System-generated uniqu ID of the connector loading this table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "Name of the schema in which the table lives.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Name of the table whose MAR was measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm-01) of the measurement.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_measured_at": {"name": "last_measured_at", "description": "Timestamp of when the last MAR measurement for the month was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "free_monthly_active_rows": {"name": "free_monthly_active_rows", "description": "The number of free active rows measured in the table for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_monthly_active_rows": {"name": "paid_monthly_active_rows", "description": "The number of paid active rows measured in the table for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_monthly_active_rows": {"name": "total_monthly_active_rows", "description": "The total number of active rows measured in the table for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination as it appears in the UI.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1699984808.756969, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__mar_table_history`", "raw_code": "with incremental_mar as (\n\n    select\n        *,\n        {{ dbt.date_trunc('month', 'measured_date') }} as measured_month\n\n    from {{ ref('stg_fivetran_platform__incremental_mar') }}\n),\n\nconnector as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__connector') }}\n),\n\ndestination as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__destination') }}\n),\n\nordered_mar as (\n\n    select\n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        max(measured_date) as last_measured_at,\n        sum(incremental_rows) as incremental_rows,\n        sum(coalesce(case when lower(free_type) = 'paid'\n            then incremental_rows\n        end, 0)) as paid_monthly_active_rows,\n        sum(coalesce(case when lower(free_type) != 'paid'\n            then incremental_rows\n        end, 0)) as free_monthly_active_rows\n\n    from incremental_mar\n    {{dbt_utils.group_by(5)}}\n),\n\nlatest_mar as (\n    select \n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        date(last_measured_at) as last_measured_at,\n        free_monthly_active_rows,\n        paid_monthly_active_rows,\n        (free_monthly_active_rows + paid_monthly_active_rows) as total_monthly_active_rows\n\n    from ordered_mar\n),\n\nmar_join as (\n\n    select\n        latest_mar.*,\n        connector.connector_type,\n        connector.connector_id,\n        destination.destination_name\n\n    from latest_mar\n    join connector\n        on latest_mar.connector_name = connector.connector_name\n        and latest_mar.destination_id = connector.destination_id\n    join destination on latest_mar.destination_id = destination.destination_id\n)\n\nselect * from mar_join\norder by measured_month desc, destination_id, connector_name", "language": "sql", "refs": [{"name": "stg_fivetran_platform__incremental_mar", "package": null, "version": null}, {"name": "stg_fivetran_platform__connector", "package": null, "version": null}, {"name": "stg_fivetran_platform__destination", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt_utils.group_by"], "nodes": ["model.fivetran_log.stg_fivetran_platform__incremental_mar", "model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__mar_table_history.sql", "compiled": true, "compiled_code": "with incremental_mar as (\n\n    select\n        *,\n        timestamp_trunc(\n        cast(measured_date as timestamp),\n        month\n    ) as measured_month\n\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__incremental_mar`\n),\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__connector`\n),\n\ndestination as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__destination`\n),\n\nordered_mar as (\n\n    select\n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        max(measured_date) as last_measured_at,\n        sum(incremental_rows) as incremental_rows,\n        sum(coalesce(case when lower(free_type) = 'paid'\n            then incremental_rows\n        end, 0)) as paid_monthly_active_rows,\n        sum(coalesce(case when lower(free_type) != 'paid'\n            then incremental_rows\n        end, 0)) as free_monthly_active_rows\n\n    from incremental_mar\n    group by 1,2,3,4,5\n),\n\nlatest_mar as (\n    select \n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        date(last_measured_at) as last_measured_at,\n        free_monthly_active_rows,\n        paid_monthly_active_rows,\n        (free_monthly_active_rows + paid_monthly_active_rows) as total_monthly_active_rows\n\n    from ordered_mar\n),\n\nmar_join as (\n\n    select\n        latest_mar.*,\n        connector.connector_type,\n        connector.connector_id,\n        destination.destination_name\n\n    from latest_mar\n    join connector\n        on latest_mar.connector_name = connector.connector_name\n        and latest_mar.destination_id = connector.destination_id\n    join destination on latest_mar.destination_id = destination.destination_id\n)\n\nselect * from mar_join\norder by measured_month desc, destination_id, connector_name", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__user": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__user", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__user.sql", "original_file_path": "models/staging/stg_fivetran_platform__user.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__user", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__user"], "alias": "stg_fivetran_platform__user", "checksum": {"name": "sha256", "checksum": "a061bd0449c3600b417d561bac0464e00be250488cdd3d266e3693aec4cee7b3"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of users given access to this Fivetran account.", "columns": {"user_id": {"name": "user_id", "description": "Unique ID of the user's account", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the user was created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "Email associated with the user.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "has_disabled_email_notifications": {"name": "has_disabled_email_notifications", "description": "Boolean of whether they have disabled all email notifications.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "User's last name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "User's first name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "phone": {"name": "phone", "description": "Phone number associated with user.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "is_verified": {"name": "is_verified", "description": "Boolean that indicates whether the user has verified their email address in the account creation process.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform", "enabled": true}, "created_at": 1699984808.884013, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__user`", "raw_code": "{{ config(enabled=var('fivetran_platform_using_user', True)) }}\n\nwith base as (\n\n    select * \n    from {{ var('user') }}\n),\n\nfields as (\n\n    select\n        id as user_id,\n        cast(created_at as {{ dbt.type_timestamp() }}) as created_at,\n        email,\n        email_disabled as has_disabled_email_notifications,\n        family_name as last_name,\n        given_name as first_name,\n        phone,\n        verified as is_verified\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "user"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.user"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__user.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`user`\n),\n\nfields as (\n\n    select\n        id as user_id,\n        cast(created_at as timestamp) as created_at,\n        email,\n        email_disabled as has_disabled_email_notifications,\n        family_name as last_name,\n        given_name as first_name,\n        phone,\n        verified as is_verified\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__destination_membership": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__destination_membership", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__destination_membership.sql", "original_file_path": "models/staging/stg_fivetran_platform__destination_membership.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__destination_membership", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__destination_membership"], "alias": "stg_fivetran_platform__destination_membership", "checksum": {"name": "sha256", "checksum": "da8ba27410a264f15f17cd9fd774299fb5fc88fa2f07f898ead71aed3f7f91e8"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of the users given access to this destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the ID of the `destination` that the user is  amember of.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "Foreign key referencing the ID of the `user` belonging to the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "activated_at": {"name": "activated_at", "description": "Timestamp of when the user was activated in the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "joined_at": {"name": "joined_at", "description": "Timestamp when the user was added to the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_role": {"name": "destination_role", "description": "The user's permissions for this individual destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform", "enabled": true}, "created_at": 1699984808.8832798, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__destination_membership`", "raw_code": "{{ config(enabled=var('fivetran_platform_using_destination_membership', True)) }}\n\nwith base as (\n    \n    select * from {{ var('destination_membership') }}\n),\n\nfields as (\n\n    select\n        destination_id,\n        user_id,\n        cast(activated_at as {{ dbt.type_timestamp() }}) as activated_at,\n        cast(joined_at as {{ dbt.type_timestamp() }}) as joined_at,\n        role as destination_role\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "destination_membership"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.destination_membership"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__destination_membership.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n    \n    select * from `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`destination_membership`\n),\n\nfields as (\n\n    select\n        destination_id,\n        user_id,\n        cast(activated_at as timestamp) as activated_at,\n        cast(joined_at as timestamp) as joined_at,\n        role as destination_role\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__credits_used": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__credits_used", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__credits_used.sql", "original_file_path": "models/staging/stg_fivetran_platform__credits_used.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__credits_used", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__credits_used"], "alias": "stg_fivetran_platform__credits_used", "checksum": {"name": "sha256", "checksum": "a3cbd320d43b57e49856ef3d120ba91addccaa9280d74645ff168c94af2cdc7d"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of the credits used by the customer per month for each destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that was used.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm) of the usage activity.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "credits_spent": {"name": "credits_spent", "description": "The total credits used by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1699984808.8809412, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__credits_used`", "raw_code": "{% if var('fivetran_platform__credits_pricing', does_table_exist('credits_used')) %}\n\nwith base as (\n\n    select * \n    from {{ var('credits_used') }}\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        credits_consumed as credits_spent\n    from base\n)\n\nselect * \nfrom fields\n\n{% else %}\n\nselect\n    cast(null as {{ dbt.type_string() }}) as destination_id,\n    cast(null as {{ dbt.type_string() }}) as measured_month,\n    cast(null as {{ dbt.type_int() }}) as credits_spent\n\n{% endif %}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_log.does_table_exist", "macro.dbt.type_string", "macro.dbt.type_int"], "nodes": []}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__credits_used.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`credits_used`\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        credits_consumed as credits_spent\n    from base\n)\n\nselect * \nfrom fields\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__usage_cost": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__usage_cost", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__usage_cost.sql", "original_file_path": "models/staging/stg_fivetran_platform__usage_cost.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__usage_cost", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__usage_cost"], "alias": "stg_fivetran_platform__usage_cost", "checksum": {"name": "sha256", "checksum": "740b47d6acccb2dd3708fe6bdd5c1bde9c127cc3eefa8bee2ddd8cec30b9d1c8"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of the amount spent by the customer per month for each destination. Amount is represented in USD.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that was used.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm) of the usage activity.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dollars_spent": {"name": "dollars_spent", "description": "The total amount spent by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1699984808.881261, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__usage_cost`", "raw_code": "{% if var('fivetran_platform__usage_pricing', does_table_exist('usage_cost')) %}\nwith base as (\n\n    select * \n    from {{ var('usage_cost') }}\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        amount as dollars_spent\n    from base\n)\n\nselect * \nfrom fields\n\n{% else %}\n\nselect\n    cast(null as {{ dbt.type_string() }}) as destination_id,\n    cast(null as {{ dbt.type_string() }}) as measured_month,\n    cast(null as {{ dbt.type_int() }}) as dollars_spent\n\n{% endif %}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_log.does_table_exist", "macro.dbt.type_string", "macro.dbt.type_int"], "nodes": []}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__usage_cost.sql", "compiled": true, "compiled_code": "\nwith base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`usage_cost`\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        amount as dollars_spent\n    from base\n)\n\nselect * \nfrom fields\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__destination": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__destination", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__destination.sql", "original_file_path": "models/staging/stg_fivetran_platform__destination.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__destination", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__destination"], "alias": "stg_fivetran_platform__destination", "checksum": {"name": "sha256", "checksum": "59e204b797ea6e878de36084e5d3bede69c4f652a31ba542528434ae07ea29c8"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of the destinations that have data loaded into them. For each declared source, there will be just one record.", "columns": {"destination_id": {"name": "destination_id", "description": "Unique ID of the destination warehouse", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "account_id": {"name": "account_id", "description": "Foreign key referencing the fivetran `account` associated with the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the destination was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination warehouse.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "region": {"name": "region", "description": "Geographical region of the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1699984808.881642, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__destination`", "raw_code": "with base as (\n\n    select * \n    from {{ var('destination') }}\n),\n\nfields as (\n\n    select\n        id as destination_id,\n        account_id,\n        cast(created_at as {{ dbt.type_timestamp() }}) as created_at,\n        name as destination_name,\n        region\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "destination"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.destination"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__destination.sql", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`destination`\n),\n\nfields as (\n\n    select\n        id as destination_id,\n        account_id,\n        cast(created_at as timestamp) as created_at,\n        name as destination_name,\n        region\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__log": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__log", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__log.sql", "original_file_path": "models/staging/stg_fivetran_platform__log.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__log", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__log"], "alias": "stg_fivetran_platform__log", "checksum": {"name": "sha256", "checksum": "3d7152127b8635b875e7bba19eeca061435b6c0550540fed56cd174a4b3dbd24"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of logged events related to data syncs. More info on error logs  [here](https://fivetran.com/docs/logs/fivetran-log#errorlogs)\n", "columns": {"log_id": {"name": "log_id", "description": "Unique ID of the log record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_id": {"name": "sync_id", "description": "Identifies which sync the event is associated with.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the event was logged.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "The name of the `connector` that the logged event pertains to.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_type": {"name": "event_type", "description": "The umbrella event type. Events can be classified as a warning, an error, or just an information log.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_data": {"name": "message_data", "description": "The details of the event in JSON format.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_subtype": {"name": "event_subtype", "description": "The routine involved in the log, defined [here](https://fivetran.com/docs/logs#logevents).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "transformation_id": {"name": "transformation_id", "description": "Foreign key referencing the `transformation` if the event refers to a transformation run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1699984808.882378, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log`", "raw_code": "with base as (\n\n    select * \n    from {{ ref('stg_fivetran_platform__log_tmp') }}\n),\n\nfields as (\n    select\n        {{\n            fivetran_utils.fill_staging_columns(\n                source_columns=adapter.get_columns_in_relation(ref('stg_fivetran_platform__log_tmp')),\n                staging_columns=get_log_columns()\n            )\n        }}\n    from base\n),\n\nfinal as (\n\n    select\n        id as log_id, \n        sync_id,\n        cast(time_stamp as {{ dbt.type_timestamp() }}) as created_at,\n        connector_id, -- Note: the connector_id column used to erroneously equal the connector_name, NOT its id.\n        case when transformation_id is not null and event is null then 'TRANSFORMATION'\n        else event end as event_type, \n        message_data,\n        case \n        when transformation_id is not null and message_data like '%has succeeded%' then 'transformation run success'\n        when transformation_id is not null and message_data like '%has failed%' then 'transformation run failed'\n        else message_event end as event_subtype,\n        transformation_id\n    from fields\n)\n\nselect * \nfrom final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log_tmp", "package": null, "version": null}, {"name": "stg_fivetran_platform__log_tmp", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_log.get_log_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt.type_timestamp"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log_tmp"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__log.sql", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log_tmp`\n),\n\nfields as (\n    select\n        \n    \n    \n    _fivetran_synced\n    \n as \n    \n    _fivetran_synced\n    \n, \n    \n    \n    connector_id\n    \n as \n    \n    connector_id\n    \n, \n    \n    \n    event\n    \n as \n    \n    event\n    \n, \n    \n    \n    id\n    \n as \n    \n    id\n    \n, \n    \n    \n    message_data\n    \n as \n    \n    message_data\n    \n, \n    \n    \n    message_event\n    \n as \n    \n    message_event\n    \n, \n    \n    \n    sync_id\n    \n as \n    \n    sync_id\n    \n, \n    \n    \n    time_stamp\n    \n as \n    \n    time_stamp\n    \n, \n    \n    \n    transformation_id\n    \n as \n    \n    transformation_id\n    \n\n\n\n    from base\n),\n\nfinal as (\n\n    select\n        id as log_id, \n        sync_id,\n        cast(time_stamp as timestamp) as created_at,\n        connector_id, -- Note: the connector_id column used to erroneously equal the connector_name, NOT its id.\n        case when transformation_id is not null and event is null then 'TRANSFORMATION'\n        else event end as event_type, \n        message_data,\n        case \n        when transformation_id is not null and message_data like '%has succeeded%' then 'transformation run success'\n        when transformation_id is not null and message_data like '%has failed%' then 'transformation run failed'\n        else message_event end as event_subtype,\n        transformation_id\n    from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__incremental_mar": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__incremental_mar", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__incremental_mar.sql", "original_file_path": "models/staging/stg_fivetran_platform__incremental_mar.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__incremental_mar", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__incremental_mar"], "alias": "stg_fivetran_platform__incremental_mar", "checksum": {"name": "sha256", "checksum": "e9d206751314e30b94366c9d94ed110146767669605db72745ff1807226304f0"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of **monthly active row (MAR)** measurements made by table per date.  Each measurement is calculated cumulatively for the month and includes all types of mar (paid, free, etc.)\n", "columns": {"connector_name": {"name": "connector_name", "description": "The *name* of the connector being measured. Note - this is erroneously named and will be fixed soon by Fivetran.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` whose table is being measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "free_type": {"name": "free_type", "description": "If it is free MAR, the value indicates the type of free MAR. For paid MAR, the value is `PAID`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_date": {"name": "measured_date", "description": "Timestamp of when the MAR measurement was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "incremental_rows": {"name": "incremental_rows", "description": "The number of new distinct primary keys on the current day synced for the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_type": {"name": "sync_type", "description": "This defines whether the sync for which MAR calculated is HISTORICAL or INCREMENTAL. Currently, the available value is UNKNOWN.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "The name of the connector's schema that houses the measured table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "The name of the table whose MAR was measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Timestamp of when the record was last updated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1699984808.8800051, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__incremental_mar`", "raw_code": "with base as (\n\n    select * \n    from {{ var('incremental_mar') }}\n),\n\nfields as (\n\n    select\n        connector_id as connector_name,\n        destination_id,\n        free_type,\n        cast(measured_date as {{ dbt.type_timestamp() }}) as measured_date,\n        schema_name,\n        sync_type,\n        table_name,\n        updated_at,\n        _fivetran_synced,\n        incremental_rows\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "incremental_mar"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.incremental_mar"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__incremental_mar.sql", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`incremental_mar`\n),\n\nfields as (\n\n    select\n        connector_id as connector_name,\n        destination_id,\n        free_type,\n        cast(measured_date as timestamp) as measured_date,\n        schema_name,\n        sync_type,\n        table_name,\n        updated_at,\n        _fivetran_synced,\n        incremental_rows\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__connector": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__connector", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__connector.sql", "original_file_path": "models/staging/stg_fivetran_platform__connector.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__connector", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__connector"], "alias": "stg_fivetran_platform__connector", "checksum": {"name": "sha256", "checksum": "26bc8050ae36226bbee0e978acbd6e5bdaccbb2d73f66d609bcd82f199c4b6ef"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of all connectors loading data into warehouses. Note that deleted connectors  are not removed, but can be identified by having an older _fivetran_synced field relative  to other connectors.\n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated destination-unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connecting_user_id": {"name": "connecting_user_id", "description": "Foreign key referencing the `user` who set up the connection.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Individual name of the connector. Note that this could be different from the `incremental_mar.schema_name`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "is_paused": {"name": "is_paused", "description": "Boolean that is true if the connector's sync is currently paused.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "set_up_at": {"name": "set_up_at", "description": "Timestamp of when the connection was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1699984808.880606, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__connector`", "raw_code": "with base as (\n\n    select * \n    from {{ ref('stg_fivetran_platform__connector_tmp') }}\n),\n\nfields as (\n    select\n        {{\n            fivetran_utils.fill_staging_columns(\n                source_columns=adapter.get_columns_in_relation(ref('stg_fivetran_platform__connector_tmp')),\n                staging_columns=get_connector_columns()\n            )\n        }}\n        ,row_number() over ( partition by connector_name, destination_id order by _fivetran_synced desc ) as nth_last_record\n    from base\n),\n\nfinal as (\n\n    select \n        connector_id,\n        connector_name,\n        coalesce(connector_type_id, connector_type) as connector_type,\n        destination_id,\n        connecting_user_id,\n        paused as is_paused,\n        signed_up as set_up_at\n    from fields\n\n    -- Only look at the most recent one\n    where nth_last_record = 1\n)\n\nselect * \nfrom final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__connector_tmp", "package": null, "version": null}, {"name": "stg_fivetran_platform__connector_tmp", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_log.get_connector_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.fivetran_log.stg_fivetran_platform__connector_tmp"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__connector.sql", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__connector_tmp`\n),\n\nfields as (\n    select\n        \n    cast(null as boolean) as \n    \n    _fivetran_deleted\n    \n , \n    \n    \n    _fivetran_synced\n    \n as \n    \n    _fivetran_synced\n    \n, \n    \n    \n    connecting_user_id\n    \n as \n    \n    connecting_user_id\n    \n, \n    \n    \n    connector_id\n    \n as \n    \n    connector_id\n    \n, \n    \n    \n    connector_name\n    \n as \n    \n    connector_name\n    \n, \n    \n    \n    connector_type\n    \n as \n    \n    connector_type\n    \n, \n    cast(null as string) as \n    \n    connector_type_id\n    \n , \n    \n    \n    destination_id\n    \n as \n    \n    destination_id\n    \n, \n    \n    \n    paused\n    \n as \n    \n    paused\n    \n, \n    cast(null as INT64) as \n    \n    service_version\n    \n , \n    \n    \n    signed_up\n    \n as \n    \n    signed_up\n    \n\n\n\n        ,row_number() over ( partition by connector_name, destination_id order by _fivetran_synced desc ) as nth_last_record\n    from base\n),\n\nfinal as (\n\n    select \n        connector_id,\n        connector_name,\n        coalesce(connector_type_id, connector_type) as connector_type,\n        destination_id,\n        connecting_user_id,\n        paused as is_paused,\n        signed_up as set_up_at\n    from fields\n\n    -- Only look at the most recent one\n    where nth_last_record = 1\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__account": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__account", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__account.sql", "original_file_path": "models/staging/stg_fivetran_platform__account.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__account", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__account"], "alias": "stg_fivetran_platform__account", "checksum": {"name": "sha256", "checksum": "877d7ad3b526b29b2806da63bbb80eceaab46ac8b530a132361bb0c2ab74a20a"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of information on this Fivetran account.", "columns": {"account_id": {"name": "account_id", "description": "Unique ID of the account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "country": {"name": "country", "description": "Country of the account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the account was created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "account_name": {"name": "account_name", "description": "Name of the Fivetran account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of the Fivetran account (ie trial, frozen).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1699984808.882915, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__account`", "raw_code": "with base as (\n    \n    select * \n    from {{ var('account') }}\n),\n\nfields as (\n\n    select\n        id as account_id,\n        country,\n        cast(created_at as {{ dbt.type_timestamp() }}) as created_at,\n        name as account_name,\n        status\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "account"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.account"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__account.sql", "compiled": true, "compiled_code": "with base as (\n    \n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`account`\n),\n\nfields as (\n\n    select\n        id as account_id,\n        country,\n        cast(created_at as timestamp) as created_at,\n        name as account_name,\n        status\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__connector_tmp": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__connector_tmp", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/tmp/stg_fivetran_platform__connector_tmp.sql", "original_file_path": "models/staging/tmp/stg_fivetran_platform__connector_tmp.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__connector_tmp", "fqn": ["fivetran_log", "staging", "tmp", "stg_fivetran_platform__connector_tmp"], "alias": "stg_fivetran_platform__connector_tmp", "checksum": {"name": "sha256", "checksum": "37733092912c2e3514778a0a8826e3c673dc46b5202e6319f1f193da6e453a9e"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "fivetran_platform"}, "created_at": 1699984808.708134, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__connector_tmp`", "raw_code": "select *\nfrom {{ var('connector') }}", "language": "sql", "refs": [], "sources": [["fivetran_platform", "connector"]], "metrics": [], "depends_on": {"macros": [], "nodes": ["source.fivetran_log.fivetran_platform.connector"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/tmp/stg_fivetran_platform__connector_tmp.sql", "compiled": true, "compiled_code": "select *\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`connector`", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__log_tmp": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__log_tmp", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/tmp/stg_fivetran_platform__log_tmp.sql", "original_file_path": "models/staging/tmp/stg_fivetran_platform__log_tmp.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__log_tmp", "fqn": ["fivetran_log", "staging", "tmp", "stg_fivetran_platform__log_tmp"], "alias": "stg_fivetran_platform__log_tmp", "checksum": {"name": "sha256", "checksum": "9e05b5b47bbe8eb4004c8113700379a9432e90318d78d548db6f933fd549ed1b"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "fivetran_platform"}, "created_at": 1699984808.712847, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log_tmp`", "raw_code": "select *\nfrom {{ var('log') }}", "language": "sql", "refs": [], "sources": [["fivetran_platform", "log"]], "metrics": [], "depends_on": {"macros": [], "nodes": ["source.fivetran_log.fivetran_platform.log"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/tmp/stg_fivetran_platform__log_tmp.sql", "compiled": true, "compiled_code": "select *\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`log`", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_id", "destination_id"], "model": "{{ get_where_subquery(ref('fivetran_platform__connector_status')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id"], "alias": "dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43"}, "created_at": 1699984808.80905, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__connector_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__connector_status"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__connector_status`\n    group by connector_id, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__connector_status", "attached_node": "model.fivetran_log.fivetran_platform__connector_status"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_id", "destination_id", "schema_name", "table_name", "measured_month"], "model": "{{ get_where_subquery(ref('fivetran_platform__mar_table_history')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month"], "alias": "dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8"}, "created_at": 1699984808.8166661, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__mar_table_history", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__mar_table_history"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, schema_name, table_name, measured_month\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__mar_table_history`\n    group by connector_id, destination_id, schema_name, table_name, measured_month\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__mar_table_history", "attached_node": "model.fivetran_log.fivetran_platform__mar_table_history"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["destination_id", "measured_month"], "model": "{{ get_where_subquery(ref('fivetran_platform__usage_mar_destination_history')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month"], "alias": "dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b"}, "created_at": 1699984808.81934, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__usage_mar_destination_history", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        destination_id, measured_month\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__usage_mar_destination_history`\n    group by destination_id, measured_month\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__usage_mar_destination_history", "attached_node": "model.fivetran_log.fivetran_platform__usage_mar_destination_history"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_id", "destination_id", "date_day"], "model": "{{ get_where_subquery(ref('fivetran_platform__connector_daily_events')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day"], "alias": "dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1"}, "created_at": 1699984808.8219829, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__connector_daily_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__connector_daily_events"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, date_day\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__connector_daily_events`\n    group by connector_id, destination_id, date_day\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__connector_daily_events", "attached_node": "model.fivetran_log.fivetran_platform__connector_daily_events"}, "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "unique_table_sync_key", "model": "{{ get_where_subquery(ref('fivetran_platform__audit_table')) }}"}, "namespace": null}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "unique_fivetran_platform__audit_table_unique_table_sync_key", "resource_type": "test", "package_name": "fivetran_log", "path": "unique_fivetran_platform__audit_table_unique_table_sync_key.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7", "fqn": ["fivetran_log", "unique_fivetran_platform__audit_table_unique_table_sync_key"], "alias": "unique_fivetran_platform__audit_table_unique_table_sync_key", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1699984808.824499, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "fivetran_platform__audit_table", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__audit_table"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/unique_fivetran_platform__audit_table_unique_table_sync_key.sql", "compiled": true, "compiled_code": "\n    \n    \n\nwith dbt_test__target as (\n\n  select unique_table_sync_key as unique_field\n  from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__audit_table`\n  where unique_table_sync_key is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "unique_table_sync_key", "file_key_name": "models.fivetran_platform__audit_table", "attached_node": "model.fivetran_log.fivetran_platform__audit_table"}, "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "unique_table_sync_key", "model": "{{ get_where_subquery(ref('fivetran_platform__audit_table')) }}"}, "namespace": null}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "not_null_fivetran_platform__audit_table_unique_table_sync_key", "resource_type": "test", "package_name": "fivetran_log", "path": "not_null_fivetran_platform__audit_table_unique_table_sync_key.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af", "fqn": ["fivetran_log", "not_null_fivetran_platform__audit_table_unique_table_sync_key"], "alias": "not_null_fivetran_platform__audit_table_unique_table_sync_key", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1699984808.826289, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "fivetran_platform__audit_table", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__audit_table"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/not_null_fivetran_platform__audit_table_unique_table_sync_key.sql", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect unique_table_sync_key\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__audit_table`\nwhere unique_table_sync_key is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "unique_table_sync_key", "file_key_name": "models.fivetran_platform__audit_table", "attached_node": "model.fivetran_log.fivetran_platform__audit_table"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_id", "destination_id", "message_data", "created_at"], "model": "{{ get_where_subquery(ref('fivetran_platform__schema_changelog')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at"], "alias": "dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd"}, "created_at": 1699984808.827436, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__schema_changelog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__schema_changelog"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, message_data, created_at\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__schema_changelog`\n    group by connector_id, destination_id, message_data, created_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__schema_changelog", "attached_node": "model.fivetran_log.fivetran_platform__schema_changelog"}, "test.fivetran_log.unique_fivetran_platform__audit_user_activity_log_id.2662c08a2a": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "log_id", "model": "{{ get_where_subquery(ref('fivetran_platform__audit_user_activity')) }}"}, "namespace": null}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "unique_fivetran_platform__audit_user_activity_log_id", "resource_type": "test", "package_name": "fivetran_log", "path": "unique_fivetran_platform__audit_user_activity_log_id.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.unique_fivetran_platform__audit_user_activity_log_id.2662c08a2a", "fqn": ["fivetran_log", "unique_fivetran_platform__audit_user_activity_log_id"], "alias": "unique_fivetran_platform__audit_user_activity_log_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1699984808.8301408, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "fivetran_platform__audit_user_activity", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__audit_user_activity"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/unique_fivetran_platform__audit_user_activity_log_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\nwith dbt_test__target as (\n\n  select log_id as unique_field\n  from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__audit_user_activity`\n  where log_id is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "log_id", "file_key_name": "models.fivetran_platform__audit_user_activity", "attached_node": "model.fivetran_log.fivetran_platform__audit_user_activity"}, "test.fivetran_log.not_null_fivetran_platform__audit_user_activity_log_id.db973498ba": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "log_id", "model": "{{ get_where_subquery(ref('fivetran_platform__audit_user_activity')) }}"}, "namespace": null}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "not_null_fivetran_platform__audit_user_activity_log_id", "resource_type": "test", "package_name": "fivetran_log", "path": "not_null_fivetran_platform__audit_user_activity_log_id.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.not_null_fivetran_platform__audit_user_activity_log_id.db973498ba", "fqn": ["fivetran_log", "not_null_fivetran_platform__audit_user_activity_log_id"], "alias": "not_null_fivetran_platform__audit_user_activity_log_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1699984808.83127, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "fivetran_platform__audit_user_activity", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__audit_user_activity"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/not_null_fivetran_platform__audit_user_activity_log_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect log_id\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__audit_user_activity`\nwhere log_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "log_id", "file_key_name": "models.fivetran_platform__audit_user_activity", "attached_node": "model.fivetran_log.fivetran_platform__audit_user_activity"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_name", "destination_id"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__connector')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id"], "alias": "dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62"}, "created_at": 1699984808.884524, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__connector", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__connector"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_name, destination_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__connector`\n    group by connector_name, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__connector", "attached_node": "model.fivetran_log.stg_fivetran_platform__connector"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["measured_month", "destination_id"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__credits_used')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id"], "alias": "dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68"}, "created_at": 1699984808.8872588, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__credits_used", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__credits_used"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        measured_month, destination_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__credits_used`\n    group by measured_month, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__credits_used", "attached_node": "model.fivetran_log.stg_fivetran_platform__credits_used"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["measured_month", "destination_id"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__usage_cost')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id"], "alias": "dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945"}, "created_at": 1699984808.889899, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__usage_cost", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__usage_cost"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        measured_month, destination_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__usage_cost`\n    group by measured_month, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__usage_cost", "attached_node": "model.fivetran_log.stg_fivetran_platform__usage_cost"}, "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "destination_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__destination')) }}"}, "namespace": null}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "unique_stg_fivetran_platform__destination_destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "unique_stg_fivetran_platform__destination_destination_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed", "fqn": ["fivetran_log", "staging", "unique_stg_fivetran_platform__destination_destination_id"], "alias": "unique_stg_fivetran_platform__destination_destination_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1699984808.892562, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__destination", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__destination"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/unique_stg_fivetran_platform__destination_destination_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\nwith dbt_test__target as (\n\n  select destination_id as unique_field\n  from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__destination`\n  where destination_id is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "destination_id", "file_key_name": "models.stg_fivetran_platform__destination", "attached_node": "model.fivetran_log.stg_fivetran_platform__destination"}, "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "destination_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__destination')) }}"}, "namespace": null}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "not_null_stg_fivetran_platform__destination_destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "not_null_stg_fivetran_platform__destination_destination_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780", "fqn": ["fivetran_log", "staging", "not_null_stg_fivetran_platform__destination_destination_id"], "alias": "not_null_stg_fivetran_platform__destination_destination_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1699984808.893688, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__destination", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__destination"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/not_null_stg_fivetran_platform__destination_destination_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect destination_id\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__destination`\nwhere destination_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "destination_id", "file_key_name": "models.stg_fivetran_platform__destination", "attached_node": "model.fivetran_log.stg_fivetran_platform__destination"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["log_id", "created_at"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__log')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at"], "alias": "dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5"}, "created_at": 1699984808.894828, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        log_id, created_at\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log`\n    group by log_id, created_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__log", "attached_node": "model.fivetran_log.stg_fivetran_platform__log"}, "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "account_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__account')) }}"}, "namespace": null}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "unique_stg_fivetran_platform__account_account_id", "resource_type": "test", "package_name": "fivetran_log", "path": "unique_stg_fivetran_platform__account_account_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc", "fqn": ["fivetran_log", "staging", "unique_stg_fivetran_platform__account_account_id"], "alias": "unique_stg_fivetran_platform__account_account_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1699984808.8974662, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__account", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__account"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/unique_stg_fivetran_platform__account_account_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\nwith dbt_test__target as (\n\n  select account_id as unique_field\n  from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__account`\n  where account_id is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "account_id", "file_key_name": "models.stg_fivetran_platform__account", "attached_node": "model.fivetran_log.stg_fivetran_platform__account"}, "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "account_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__account')) }}"}, "namespace": null}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "not_null_stg_fivetran_platform__account_account_id", "resource_type": "test", "package_name": "fivetran_log", "path": "not_null_stg_fivetran_platform__account_account_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e", "fqn": ["fivetran_log", "staging", "not_null_stg_fivetran_platform__account_account_id"], "alias": "not_null_stg_fivetran_platform__account_account_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1699984808.898599, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__account", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__account"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/not_null_stg_fivetran_platform__account_account_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect account_id\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__account`\nwhere account_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "account_id", "file_key_name": "models.stg_fivetran_platform__account", "attached_node": "model.fivetran_log.stg_fivetran_platform__account"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["destination_id", "user_id"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__destination_membership')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id"], "alias": "dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede"}, "created_at": 1699984808.899743, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__destination_membership", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__destination_membership"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        destination_id, user_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__destination_membership`\n    group by destination_id, user_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__destination_membership", "attached_node": "model.fivetran_log.stg_fivetran_platform__destination_membership"}, "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "user_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__user')) }}"}, "namespace": null}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "unique_stg_fivetran_platform__user_user_id", "resource_type": "test", "package_name": "fivetran_log", "path": "unique_stg_fivetran_platform__user_user_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9", "fqn": ["fivetran_log", "staging", "unique_stg_fivetran_platform__user_user_id"], "alias": "unique_stg_fivetran_platform__user_user_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1699984808.9024022, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__user", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__user"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/unique_stg_fivetran_platform__user_user_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\nwith dbt_test__target as (\n\n  select user_id as unique_field\n  from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__user`\n  where user_id is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "user_id", "file_key_name": "models.stg_fivetran_platform__user", "attached_node": "model.fivetran_log.stg_fivetran_platform__user"}, "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "user_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__user')) }}"}, "namespace": null}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "not_null_stg_fivetran_platform__user_user_id", "resource_type": "test", "package_name": "fivetran_log", "path": "not_null_stg_fivetran_platform__user_user_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0", "fqn": ["fivetran_log", "staging", "not_null_stg_fivetran_platform__user_user_id"], "alias": "not_null_stg_fivetran_platform__user_user_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1699984808.903528, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__user", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__user"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/not_null_stg_fivetran_platform__user_user_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect user_id\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__user`\nwhere user_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "user_id", "file_key_name": "models.stg_fivetran_platform__user", "attached_node": "model.fivetran_log.stg_fivetran_platform__user"}}, "sources": {"source.fivetran_log.fivetran_platform.incremental_mar": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1", "name": "incremental_mar", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.incremental_mar", "fqn": ["fivetran_log", "staging", "fivetran_platform", "incremental_mar"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "incremental_mar", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 96, "period": "hour"}, "filter": null}, "external": null, "description": "Table of **monthly active row (MAR)** measurements made by table per date.  Each measurement is calculated cumulatively for the month and includes all types of mar (paid, free, etc.)\n", "columns": {"connector_id": {"name": "connector_id", "description": "The *name* of the connector being measured. Note - this is erroneously named and will be fixed soon by Fivetran.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` whose table is being measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "free_type": {"name": "free_type", "description": "If it is free MAR, the value indicates the type of free MAR. For paid MAR, the value is `PAID`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_date": {"name": "measured_date", "description": "Timestamp of when the MAR measurement was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "incremental_rows": {"name": "incremental_rows", "description": "The number of new distinct primary keys on the current day synced for the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_type": {"name": "sync_type", "description": "This defines whether the sync for which MAR calculated is HISTORICAL or INCREMENTAL. Currently, the available value is UNKNOWN.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "The name of the connector's schema that houses the measured table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "The name of the table whose MAR was measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Timestamp of when the record was last updated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1`.`incremental_mar`", "created_at": 1699984808.9052072}, "source.fivetran_log.fivetran_platform.connector": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1", "name": "connector", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.connector", "fqn": ["fivetran_log", "staging", "fivetran_platform", "connector"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "connector", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of all connectors loading data into warehouses. Note that deleted connectors  are not removed, but can be identified by having an older _fivetran_synced field relative  to other connectors.\n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connecting_user_id": {"name": "connecting_user_id", "description": "Foreign key referencing the `user` who set up the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Individual name of the connector. Note that this could be different from the `incremental_mar.schema_name`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paused": {"name": "paused", "description": "Boolean that is true if the connector's sync is currently paused.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "signed_up": {"name": "signed_up", "description": "Timestamp of when the connection was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1`.`connector`", "created_at": 1699984808.905329}, "source.fivetran_log.fivetran_platform.credits_used": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1", "name": "credits_used", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.credits_used", "fqn": ["fivetran_log", "staging", "fivetran_platform", "credits_used"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "credits_used", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of the credits used by the customer per month within each destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the credits were used on", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm) in which the credits were consumed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "credits_consumed": {"name": "credits_consumed", "description": "The number of credits used by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1`.`credits_used`", "created_at": 1699984808.9054232}, "source.fivetran_log.fivetran_platform.usage_cost": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1", "name": "usage_cost", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.usage_cost", "fqn": ["fivetran_log", "staging", "fivetran_platform", "usage_cost"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "usage_cost", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of the credits used by the customer per month within each destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the credits were used on", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm) in which the credits were consumed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "amount": {"name": "amount", "description": "The dollar amount associated with the cost of your connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1`.`usage_cost`", "created_at": 1699984808.90551}, "source.fivetran_log.fivetran_platform.destination": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1", "name": "destination", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.destination", "fqn": ["fivetran_log", "staging", "fivetran_platform", "destination"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "destination", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of the destinations that have data loaded into them. For each declared source, there will be just one record.", "columns": {"id": {"name": "id", "description": "Unique ID of the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "account_id": {"name": "account_id", "description": "Foreign key referencing the fivetran `account` associated with the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the destination was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "Name of the destination warehouse.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "region": {"name": "region", "description": "Geographical region of the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1`.`destination`", "created_at": 1699984808.905597}, "source.fivetran_log.fivetran_platform.log": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1", "name": "log", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.log", "fqn": ["fivetran_log", "staging", "fivetran_platform", "log"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "log", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 96, "period": "hour"}, "filter": null}, "external": null, "description": "Table of logged events related to data syncs. More info on error logs [here](https://fivetran.com/docs/logs/fivetran-log#errorlogs).", "columns": {"id": {"name": "id", "description": "Contains either `connector_name` (for app/api logs), `transformation_id` (for transformation logs),  or the value `\"system\"` (for system generated logs).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "time_stamp": {"name": "time_stamp", "description": "Timestamp of when the event was logged.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "The *name* of the connector being logged. Note - this is erroneously named and will be fixed soon by Fivetran.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event": {"name": "event", "description": "The umbrella event type. Events can be classified as a warning, an error, or just an information log.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_data": {"name": "message_data", "description": "The details of the event in JSON format.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_event": {"name": "message_event", "description": "The routine involved in the log, defined [here](https://fivetran.com/docs/logs#logevents).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "transformation_id": {"name": "transformation_id", "description": "Foreign key referencing the `transformation` if the event refers to a transformation run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_id": {"name": "sync_id", "description": "Identifies which sync the event is associated with.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1`.`log`", "created_at": 1699984808.9056928}, "source.fivetran_log.fivetran_platform.account": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1", "name": "account", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.account", "fqn": ["fivetran_log", "staging", "fivetran_platform", "account"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "account", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of information on this Fivetran account.", "columns": {"id": {"name": "id", "description": "Unique ID of the account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "country": {"name": "country", "description": "Country of the account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the account was created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "Name of the Fivetran account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of the Fivetran account (ie trial, frozen).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1`.`account`", "created_at": 1699984808.905781}, "source.fivetran_log.fivetran_platform.destination_membership": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1", "name": "destination_membership", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.destination_membership", "fqn": ["fivetran_log", "staging", "fivetran_platform", "destination_membership"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "destination_membership", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of the users given access to this destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the ID of the `destination` that the user is a member of.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "Foreign key referencing the ID of the `user` who has access to the destination", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "activated_at": {"name": "activated_at", "description": "Timestamp of when the user was activated in the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "joined_at": {"name": "joined_at", "description": "Timestamp of when the user was added to the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "role": {"name": "role", "description": "The user's permissions for this individual destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {"enabled": true}, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1`.`destination_membership`", "created_at": 1699984808.9058769}, "source.fivetran_log.fivetran_platform.user": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_1", "name": "user", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.user", "fqn": ["fivetran_log", "staging", "fivetran_platform", "user"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "user", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of users given access to this Fivetran account.", "columns": {"id": {"name": "id", "description": "Unique ID of the user's account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the user was created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "Email associated with the user.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "email_disabled": {"name": "email_disabled", "description": "Boolean of whether they have disabled all email notifications.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "family_name": {"name": "family_name", "description": "User's last name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "given_name": {"name": "given_name", "description": "User's first name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "phone": {"name": "phone", "description": "Phone number associated with user.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "verified": {"name": "verified", "description": "Boolean that indicates whether the user has verified their email address in the account creation process.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {"enabled": true}, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1`.`user`", "created_at": 1699984808.9059782}}, "macros": {"macro.dbt_bigquery.date_sharded_table": {"name": "date_sharded_table", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/etc.sql", "original_file_path": "macros/etc.sql", "unique_id": "macro.dbt_bigquery.date_sharded_table", "macro_sql": "{% macro date_sharded_table(base_name) %}\n    {{ return(base_name ~ \"[DBT__PARTITION_DATE]\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.572279, "supported_languages": null}, "macro.dbt_bigquery.grant_access_to": {"name": "grant_access_to", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/etc.sql", "original_file_path": "macros/etc.sql", "unique_id": "macro.dbt_bigquery.grant_access_to", "macro_sql": "{% macro grant_access_to(entity, entity_type, role, grant_target_dict) -%}\n  {% do adapter.grant_access_to(entity, entity_type, role, grant_target_dict) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.5725272, "supported_languages": null}, "macro.dbt_bigquery.get_partitions_metadata": {"name": "get_partitions_metadata", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/etc.sql", "original_file_path": "macros/etc.sql", "unique_id": "macro.dbt_bigquery.get_partitions_metadata", "macro_sql": "\n\n{%- macro get_partitions_metadata(table) -%}\n  {%- if execute -%}\n    {%- set res = adapter.get_partitions_metadata(table) -%}\n    {{- return(res) -}}\n  {%- endif -%}\n  {{- return(None) -}}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.5728278, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_catalog": {"name": "bigquery__get_catalog", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_catalog", "macro_sql": "{% macro bigquery__get_catalog(information_schema, schemas) -%}\n\n  {%- if (schemas | length) == 0 -%}\n    {# Hopefully nothing cares about the columns we return when there are no rows #}\n    {%- set query  = \"select 1 as id limit 0\" -%}\n  {%- else -%}\n\n  {%- set query -%}\n    with materialized_views as (\n        select\n            table_catalog as project_id,\n            table_schema as dataset_id,\n            table_name as table_id\n        from {{ information_schema.replace(information_schema_view='MATERIALIZED_VIEWS') }}\n    ),\n    tables as (\n        select\n            tables.project_id as table_database,\n            tables.dataset_id as table_schema,\n            tables.table_id as original_table_name,\n\n            concat(tables.project_id, '.', tables.dataset_id, '.', tables.table_id) as relation_id,\n\n            tables.row_count,\n            tables.size_bytes as size_bytes,\n            case\n                when materialized_views.table_id is not null then 'materialized view'\n                when tables.type = 1 then 'table'\n                when tables.type = 2 then 'view'\n                else 'external'\n            end as table_type,\n\n            REGEXP_CONTAINS(tables.table_id, '^.+[0-9]{8}$') and coalesce(type, 0) = 1 as is_date_shard,\n            REGEXP_EXTRACT(tables.table_id, '^(.+)[0-9]{8}$') as shard_base_name,\n            REGEXP_EXTRACT(tables.table_id, '^.+([0-9]{8})$') as shard_name\n\n        from {{ information_schema.replace(information_schema_view='__TABLES__') }} tables\n        left join materialized_views\n            on materialized_views.project_id = tables.project_id\n            and materialized_views.dataset_id = tables.dataset_id\n            and materialized_views.table_id = tables.table_id\n        where (\n          {%- for schema in schemas -%}\n            upper(tables.dataset_id) = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n          {%- endfor -%}\n        )\n    ),\n\n    table_options as (\n        select\n            concat(table_catalog, '.', table_schema, '.', table_name) as relation_id,\n            JSON_VALUE(option_value) as table_comment\n\n        from {{ information_schema.replace(information_schema_view='TABLE_OPTIONS') }}\n        where option_name = 'description'\n    ),\n    extracted as (\n\n        select *,\n            case\n                when is_date_shard then shard_base_name\n                else original_table_name\n            end as table_name\n\n        from tables\n\n    ),\n\n    unsharded_tables as (\n\n        select\n            table_database,\n            table_schema,\n            table_name,\n            coalesce(table_type, 'external') as table_type,\n            is_date_shard,\n\n            struct(\n                min(shard_name) as shard_min,\n                max(shard_name) as shard_max,\n                count(*) as shard_count\n            ) as table_shards,\n\n            sum(size_bytes) as size_bytes,\n            sum(row_count) as row_count,\n\n            max(relation_id) as relation_id\n\n        from extracted\n        group by 1,2,3,4,5\n\n    ),\n\n    info_schema_columns as (\n\n        select\n            concat(table_catalog, '.', table_schema, '.', table_name) as relation_id,\n            table_catalog as table_database,\n            table_schema,\n            table_name,\n\n            -- use the \"real\" column name from the paths query below\n            column_name as base_column_name,\n            ordinal_position as column_index,\n\n            is_partitioning_column,\n            clustering_ordinal_position\n\n        from {{ information_schema.replace(information_schema_view='COLUMNS') }}\n        where ordinal_position is not null\n\n    ),\n\n    info_schema_column_paths as (\n\n        select\n            concat(table_catalog, '.', table_schema, '.', table_name) as relation_id,\n            field_path as column_name,\n            data_type as column_type,\n            column_name as base_column_name,\n            description as column_comment\n\n        from {{ information_schema.replace(information_schema_view='COLUMN_FIELD_PATHS') }}\n\n    ),\n\n    columns as (\n\n        select * except (base_column_name)\n        from info_schema_columns\n        join info_schema_column_paths using (relation_id, base_column_name)\n\n    ),\n\n    column_stats as (\n\n        select\n            table_database,\n            table_schema,\n            table_name,\n            max(relation_id) as relation_id,\n            max(case when is_partitioning_column = 'YES' then 1 else 0 end) = 1 as is_partitioned,\n            max(case when is_partitioning_column = 'YES' then column_name else null end) as partition_column,\n            max(case when clustering_ordinal_position is not null then 1 else 0 end) = 1 as is_clustered,\n            array_to_string(\n                array_agg(\n                    case\n                        when clustering_ordinal_position is not null then column_name\n                        else null\n                    end ignore nulls\n                    order by clustering_ordinal_position\n                ), ', '\n            ) as clustering_columns\n\n        from columns\n        group by 1,2,3\n\n    )\n\n    select\n        unsharded_tables.table_database,\n        unsharded_tables.table_schema,\n        case\n            when is_date_shard then concat(unsharded_tables.table_name, '*')\n            else unsharded_tables.table_name\n        end as table_name,\n        unsharded_tables.table_type,\n        table_options.table_comment,\n\n        -- coalesce name and type for External tables - these columns are not\n        -- present in the COLUMN_FIELD_PATHS resultset\n        coalesce(columns.column_name, '<unknown>') as column_name,\n        -- invent a row number to account for nested fields -- BQ does\n        -- not treat these nested properties as independent fields\n        row_number() over (\n            partition by relation_id\n            order by columns.column_index, columns.column_name\n        ) as column_index,\n        coalesce(columns.column_type, '<unknown>') as column_type,\n        columns.column_comment,\n\n        'Shard count' as `stats__date_shards__label`,\n        table_shards.shard_count as `stats__date_shards__value`,\n        'The number of date shards in this table' as `stats__date_shards__description`,\n        is_date_shard as `stats__date_shards__include`,\n\n        'Shard (min)' as `stats__date_shard_min__label`,\n        table_shards.shard_min as `stats__date_shard_min__value`,\n        'The first date shard in this table' as `stats__date_shard_min__description`,\n        is_date_shard as `stats__date_shard_min__include`,\n\n        'Shard (max)' as `stats__date_shard_max__label`,\n        table_shards.shard_max as `stats__date_shard_max__value`,\n        'The last date shard in this table' as `stats__date_shard_max__description`,\n        is_date_shard as `stats__date_shard_max__include`,\n\n        '# Rows' as `stats__num_rows__label`,\n        row_count as `stats__num_rows__value`,\n        'Approximate count of rows in this table' as `stats__num_rows__description`,\n        (unsharded_tables.table_type = 'table') as `stats__num_rows__include`,\n\n        'Approximate Size' as `stats__num_bytes__label`,\n        size_bytes as `stats__num_bytes__value`,\n        'Approximate size of table as reported by BigQuery' as `stats__num_bytes__description`,\n        (unsharded_tables.table_type = 'table') as `stats__num_bytes__include`,\n\n        'Partitioned By' as `stats__partitioning_type__label`,\n        partition_column as `stats__partitioning_type__value`,\n        'The partitioning column for this table' as `stats__partitioning_type__description`,\n        is_partitioned as `stats__partitioning_type__include`,\n\n        'Clustered By' as `stats__clustering_fields__label`,\n        clustering_columns as `stats__clustering_fields__value`,\n        'The clustering columns for this table' as `stats__clustering_fields__description`,\n        is_clustered as `stats__clustering_fields__include`\n\n    -- join using relation_id (an actual relation, not a shard prefix) to make\n    -- sure that column metadata is picked up through the join. This will only\n    -- return the column information for the \"max\" table in a date-sharded table set\n    from unsharded_tables\n    left join table_options using (relation_id)\n    left join columns using (relation_id)\n    left join column_stats using (relation_id)\n  {%- endset -%}\n\n  {%- endif -%}\n\n  {{ return(run_query(query)) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.577316, "supported_languages": null}, "macro.dbt_bigquery.bigquery__create_table_as": {"name": "bigquery__create_table_as", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__create_table_as", "macro_sql": "{% macro bigquery__create_table_as(temporary, relation, compiled_code, language='sql') -%}\n  {%- if language == 'sql' -%}\n    {%- set raw_partition_by = config.get('partition_by', none) -%}\n    {%- set raw_cluster_by = config.get('cluster_by', none) -%}\n    {%- set sql_header = config.get('sql_header', none) -%}\n\n    {%- set partition_config = adapter.parse_partition_by(raw_partition_by) -%}\n    {%- if partition_config.time_ingestion_partitioning -%}\n    {%- set columns = get_columns_with_types_in_query_sql(sql) -%}\n    {%- set table_dest_columns_csv = columns_without_partition_fields_csv(partition_config, columns) -%}\n    {%- set columns = '(' ~ table_dest_columns_csv ~ ')' -%}\n    {%- endif -%}\n\n    {{ sql_header if sql_header is not none }}\n\n    create or replace table {{ relation }}\n      {%- set contract_config = config.get('contract') -%}\n      {%- if contract_config.enforced -%}\n        {{ get_assert_columns_equivalent(compiled_code) }}\n        {{ get_table_columns_and_constraints() }}\n        {%- set compiled_code = get_select_subquery(compiled_code) %}\n      {% else %}\n        {#-- cannot do contracts at the same time as time ingestion partitioning -#}\n        {{ columns }}\n      {% endif %}\n    {{ partition_by(partition_config) }}\n    {{ cluster_by(raw_cluster_by) }}\n\n    {{ bigquery_table_options(config, model, temporary) }}\n\n    {#-- PARTITION BY cannot be used with the AS query_statement clause.\n         https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#partition_expression\n    -#}\n    {%- if not partition_config.time_ingestion_partitioning %}\n    as (\n      {{ compiled_code }}\n    );\n    {%- endif %}\n  {%- elif language == 'python' -%}\n    {#--\n    N.B. Python models _can_ write to temp views HOWEVER they use a different session\n    and have already expired by the time they need to be used (I.E. in merges for incremental models)\n\n    TODO: Deep dive into spark sessions to see if we can reuse a single session for an entire\n    dbt invocation.\n     --#}\n\n    {#-- when a user wants to change the schema of an existing relation, they must intentionally drop the table in the dataset --#}\n    {%- set old_relation = adapter.get_relation(database=relation.database, schema=relation.schema, identifier=relation.identifier) -%}\n    {%- if (old_relation.is_table and (should_full_refresh())) -%}\n      {% do adapter.drop_relation(relation) %}\n    {%- endif -%}\n    {{ py_write_table(compiled_code=compiled_code, target_relation=relation.quote(database=False, schema=False, identifier=False)) }}\n  {%- else -%}\n    {% do exceptions.raise_compiler_error(\"bigquery__create_table_as macro didn't get supported language, it got %s\" % language) %}\n  {%- endif -%}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_bigquery.get_columns_with_types_in_query_sql", "macro.dbt_bigquery.columns_without_partition_fields_csv", "macro.dbt.get_assert_columns_equivalent", "macro.dbt.get_table_columns_and_constraints", "macro.dbt.get_select_subquery", "macro.dbt_bigquery.partition_by", "macro.dbt_bigquery.cluster_by", "macro.dbt_bigquery.bigquery_table_options", "macro.dbt.should_full_refresh", "macro.dbt_bigquery.py_write_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.5819578, "supported_languages": null}, "macro.dbt_bigquery.bigquery__create_view_as": {"name": "bigquery__create_view_as", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__create_view_as", "macro_sql": "{% macro bigquery__create_view_as(relation, sql) -%}\n  {%- set sql_header = config.get('sql_header', none) -%}\n\n  {{ sql_header if sql_header is not none }}\n\n  create or replace view {{ relation }}\n  {{ bigquery_view_options(config, model) }}\n  {%- set contract_config = config.get('contract') -%}\n  {%- if contract_config.enforced -%}\n    {{ get_assert_columns_equivalent(sql) }}\n  {%- endif %}\n  as {{ sql }};\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery_view_options", "macro.dbt.get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.58247, "supported_languages": null}, "macro.dbt_bigquery.bigquery__drop_schema": {"name": "bigquery__drop_schema", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__drop_schema", "macro_sql": "{% macro bigquery__drop_schema(relation) -%}\n  {{ adapter.drop_schema(relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.582613, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_columns_in_relation": {"name": "bigquery__get_columns_in_relation", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_columns_in_relation", "macro_sql": "{% macro bigquery__get_columns_in_relation(relation) -%}\n  {{ return(adapter.get_columns_in_relation(relation)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.582767, "supported_languages": null}, "macro.dbt_bigquery.bigquery__list_relations_without_caching": {"name": "bigquery__list_relations_without_caching", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__list_relations_without_caching", "macro_sql": "{% macro bigquery__list_relations_without_caching(schema_relation) -%}\n  {{ return(adapter.list_relations_without_caching(schema_relation)) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.5829172, "supported_languages": null}, "macro.dbt_bigquery.bigquery__list_schemas": {"name": "bigquery__list_schemas", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__list_schemas", "macro_sql": "{% macro bigquery__list_schemas(database) -%}\n  {{ return(adapter.list_schemas(database)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.5830731, "supported_languages": null}, "macro.dbt_bigquery.bigquery__check_schema_exists": {"name": "bigquery__check_schema_exists", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__check_schema_exists", "macro_sql": "{% macro bigquery__check_schema_exists(information_schema, schema) %}\n  {{ return(adapter.check_schema_exists(information_schema.database, schema)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.5832682, "supported_languages": null}, "macro.dbt_bigquery.bigquery__persist_docs": {"name": "bigquery__persist_docs", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__persist_docs", "macro_sql": "{% macro bigquery__persist_docs(relation, model, for_relation, for_columns) -%}\n  {% if for_columns and config.persist_column_docs() and model.columns %}\n    {% do alter_column_comment(relation, model.columns) %}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.583571, "supported_languages": null}, "macro.dbt_bigquery.bigquery__alter_column_comment": {"name": "bigquery__alter_column_comment", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__alter_column_comment", "macro_sql": "{% macro bigquery__alter_column_comment(relation, column_dict) -%}\n  {% do adapter.update_columns(relation, column_dict) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.583742, "supported_languages": null}, "macro.dbt_bigquery.bigquery__alter_relation_add_columns": {"name": "bigquery__alter_relation_add_columns", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__alter_relation_add_columns", "macro_sql": "{% macro bigquery__alter_relation_add_columns(relation, add_columns) %}\n\n  {% set sql -%}\n\n     alter {{ relation.type }} {{ relation }}\n        {% for column in add_columns %}\n          add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n        {% endfor %}\n\n  {%- endset -%}\n\n  {{ return(run_query(sql)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.584171, "supported_languages": null}, "macro.dbt_bigquery.bigquery__alter_relation_drop_columns": {"name": "bigquery__alter_relation_drop_columns", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__alter_relation_drop_columns", "macro_sql": "{% macro bigquery__alter_relation_drop_columns(relation, drop_columns) %}\n\n  {% set sql -%}\n\n     alter {{ relation.type }} {{ relation }}\n\n        {% for column in drop_columns %}\n          drop column {{ column.name }}{{ ',' if not loop.last }}\n        {% endfor %}\n\n  {%- endset -%}\n\n  {{ return(run_query(sql)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.584569, "supported_languages": null}, "macro.dbt_bigquery.bigquery__alter_column_type": {"name": "bigquery__alter_column_type", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__alter_column_type", "macro_sql": "{% macro bigquery__alter_column_type(relation, column_name, new_column_type) -%}\n  {#-- Changing a column's data type using a query requires you to scan the entire table.\n    The query charges can be significant if the table is very large.\n\n    https://cloud.google.com/bigquery/docs/manually-changing-schemas#changing_a_columns_data_type\n  #}\n  {% set relation_columns = get_columns_in_relation(relation) %}\n\n  {% set sql %}\n    select\n      {%- for col in relation_columns -%}\n        {% if col.column == column_name %}\n          CAST({{ col.quoted }} AS {{ new_column_type }}) AS {{ col.quoted }}\n        {%- else %}\n          {{ col.quoted }}\n        {%- endif %}\n        {%- if not loop.last %},{% endif -%}\n      {%- endfor %}\n    from {{ relation }}\n  {% endset %}\n\n  {% call statement('alter_column_type') %}\n    {{ create_table_as(False, relation, sql)}}\n  {%- endcall %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_columns_in_relation", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.5853481, "supported_languages": null}, "macro.dbt_bigquery.bigquery__test_unique": {"name": "bigquery__test_unique", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__test_unique", "macro_sql": "{% macro bigquery__test_unique(model, column_name) %}\n\nwith dbt_test__target as (\n\n  select {{ column_name }} as unique_field\n  from {{ model }}\n  where {{ column_name }} is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.585552, "supported_languages": null}, "macro.dbt_bigquery.bigquery__upload_file": {"name": "bigquery__upload_file", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__upload_file", "macro_sql": "{% macro bigquery__upload_file(local_file_path, database, table_schema, table_name) %}\n\n  {{ log(\"kwargs: \" ~ kwargs) }}\n\n  {% do adapter.upload_file(local_file_path, database, table_schema, table_name, kwargs=kwargs) %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.5858471, "supported_languages": null}, "macro.dbt_bigquery.bigquery__create_csv_table": {"name": "bigquery__create_csv_table", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "unique_id": "macro.dbt_bigquery.bigquery__create_csv_table", "macro_sql": "{% macro bigquery__create_csv_table(model, agate_table) %}\n    -- no-op\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.586232, "supported_languages": null}, "macro.dbt_bigquery.bigquery__reset_csv_table": {"name": "bigquery__reset_csv_table", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "unique_id": "macro.dbt_bigquery.bigquery__reset_csv_table", "macro_sql": "{% macro bigquery__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n    {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.586399, "supported_languages": null}, "macro.dbt_bigquery.bigquery__load_csv_rows": {"name": "bigquery__load_csv_rows", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "unique_id": "macro.dbt_bigquery.bigquery__load_csv_rows", "macro_sql": "{% macro bigquery__load_csv_rows(model, agate_table) %}\n\n  {%- set column_override = model['config'].get('column_types', {}) -%}\n  {{ adapter.load_dataframe(model['database'], model['schema'], model['alias'],\n  \t\t\t\t\t\t\tagate_table, column_override) }}\n\n  {% call statement() %}\n    alter table {{ this.render() }} set {{ bigquery_table_options(config, model) }}\n  {% endcall %}\n\n  {% if config.persist_relation_docs() and 'description' in model %}\n\n  \t{{ adapter.update_table_description(model['database'], model['schema'], model['alias'], model['description']) }}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_bigquery.bigquery_table_options"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.587198, "supported_languages": null}, "macro.dbt_bigquery.bigquery__handle_existing_table": {"name": "bigquery__handle_existing_table", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "unique_id": "macro.dbt_bigquery.bigquery__handle_existing_table", "macro_sql": "{% macro bigquery__handle_existing_table(full_refresh, old_relation) %}\n    {%- if full_refresh -%}\n      {{ adapter.drop_relation(old_relation) }}\n    {%- else -%}\n      {{ exceptions.relation_wrong_type(old_relation, 'view') }}\n    {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.587787, "supported_languages": null}, "macro.dbt_bigquery.materialization_view_bigquery": {"name": "materialization_view_bigquery", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "unique_id": "macro.dbt_bigquery.materialization_view_bigquery", "macro_sql": "{% materialization view, adapter='bigquery' -%}\n    -- grab current tables grants config for comparision later on\n    {% set grant_config = config.get('grants') %}\n\n    {% set to_return = bigquery__create_or_replace_view() %}\n\n    {% set target_relation = this.incorporate(type='view') %}\n\n    {% do persist_docs(target_relation, model) %}\n\n    {% if config.get('grant_access_to') %}\n      {% for grant_target_dict in config.get('grant_access_to') %}\n        {% do adapter.grant_access_to(this, 'view', None, grant_target_dict) %}\n      {% endfor %}\n    {% endif %}\n\n    {% do return(to_return) %}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_or_replace_view", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.588487, "supported_languages": ["sql"]}, "macro.dbt_bigquery.materialization_table_bigquery": {"name": "materialization_table_bigquery", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_bigquery.materialization_table_bigquery", "macro_sql": "{% materialization table, adapter='bigquery', supported_languages=['sql', 'python']-%}\n\n  {%- set language = model['language'] -%}\n  {%- set identifier = model['alias'] -%}\n  {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n  {%- set exists_not_as_table = (old_relation is not none and not old_relation.is_table) -%}\n  {%- set target_relation = api.Relation.create(database=database, schema=schema, identifier=identifier, type='table') -%}\n\n  -- grab current tables grants config for comparision later on\n  {%- set grant_config = config.get('grants') -%}\n\n  {{ run_hooks(pre_hooks) }}\n\n  {#\n      We only need to drop this thing if it is not a table.\n      If it _is_ already a table, then we can overwrite it without downtime\n      Unlike table -> view, no need for `--full-refresh`: dropping a view is no big deal\n  #}\n  {%- if exists_not_as_table -%}\n      {{ adapter.drop_relation(old_relation) }}\n  {%- endif -%}\n\n  -- build model\n  {%- set raw_partition_by = config.get('partition_by', none) -%}\n  {%- set partition_by = adapter.parse_partition_by(raw_partition_by) -%}\n  {%- set cluster_by = config.get('cluster_by', none) -%}\n  {% if not adapter.is_replaceable(old_relation, partition_by, cluster_by) %}\n    {% do log(\"Hard refreshing \" ~ old_relation ~ \" because it is not replaceable\") %}\n    {% do adapter.drop_relation(old_relation) %}\n  {% endif %}\n\n  -- build model\n  {%- call statement('main', language=language) -%}\n    {{ create_table_as(False, target_relation, compiled_code, language) }}\n  {%- endcall -%}\n\n  {{ run_hooks(post_hooks) }}\n\n  {% set should_revoke = should_revoke(old_relation, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.5923488, "supported_languages": ["sql", "python"]}, "macro.dbt_bigquery.py_write_table": {"name": "py_write_table", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_bigquery.py_write_table", "macro_sql": "{% macro py_write_table(compiled_code, target_relation) %}\nfrom pyspark.sql import SparkSession\n{%- set raw_partition_by = config.get('partition_by', none) -%}\n{%- set raw_cluster_by = config.get('cluster_by', none) -%}\n{%- set partition_config = adapter.parse_partition_by(raw_partition_by) %}\n\nspark = SparkSession.builder.appName('smallTest').getOrCreate()\n\nspark.conf.set(\"viewsEnabled\",\"true\")\nspark.conf.set(\"temporaryGcsBucket\",\"{{target.gcs_bucket}}\")\n\n{{ compiled_code }}\ndbt = dbtObj(spark.read.format(\"bigquery\").load)\ndf = model(dbt, spark)\n\n# COMMAND ----------\n# this is materialization code dbt generated, please do not modify\n\nimport pyspark\n# make sure pandas exists before using it\ntry:\n  import pandas\n  pandas_available = True\nexcept ImportError:\n  pandas_available = False\n\n# make sure pyspark.pandas exists before using it\ntry:\n  import pyspark.pandas\n  pyspark_pandas_api_available = True\nexcept ImportError:\n  pyspark_pandas_api_available = False\n\n# make sure databricks.koalas exists before using it\ntry:\n  import databricks.koalas\n  koalas_available = True\nexcept ImportError:\n  koalas_available = False\n\n# preferentially convert pandas DataFrames to pandas-on-Spark or Koalas DataFrames first\n# since they know how to convert pandas DataFrames better than `spark.createDataFrame(df)`\n# and converting from pandas-on-Spark to Spark DataFrame has no overhead\nif pyspark_pandas_api_available and pandas_available and isinstance(df, pandas.core.frame.DataFrame):\n  df = pyspark.pandas.frame.DataFrame(df)\nelif koalas_available and pandas_available and isinstance(df, pandas.core.frame.DataFrame):\n  df = databricks.koalas.frame.DataFrame(df)\n\n# convert to pyspark.sql.dataframe.DataFrame\nif isinstance(df, pyspark.sql.dataframe.DataFrame):\n  pass  # since it is already a Spark DataFrame\nelif pyspark_pandas_api_available and isinstance(df, pyspark.pandas.frame.DataFrame):\n  df = df.to_spark()\nelif koalas_available and isinstance(df, databricks.koalas.frame.DataFrame):\n  df = df.to_spark()\nelif pandas_available and isinstance(df, pandas.core.frame.DataFrame):\n  df = spark.createDataFrame(df)\nelse:\n  msg = f\"{type(df)} is not a supported type for dbt Python materialization\"\n  raise Exception(msg)\n\ndf.write \\\n  .mode(\"overwrite\") \\\n  .format(\"bigquery\") \\\n  .option(\"writeMethod\", \"indirect\").option(\"writeDisposition\", 'WRITE_TRUNCATE') \\\n  {%- if partition_config.data_type | lower in ('date','timestamp','datetime') %}\n  .option(\"partitionField\", \"{{- partition_config.field -}}\") \\\n  {%- if partition_config.granularity is not none %}\n  .option(\"partitionType\", \"{{- partition_config.granularity -}}\") \\\n  {%- endif %}\n  {%- endif %}\n  {%- if raw_cluster_by is not none %}\n  .option(\"clusteredFields\", \"{{- raw_cluster_by|join(',') -}}\") \\\n  {%- endif %}\n  .save(\"{{target_relation}}\")\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.593329, "supported_languages": null}, "macro.dbt_bigquery.materialization_copy_bigquery": {"name": "materialization_copy_bigquery", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/copy.sql", "original_file_path": "macros/materializations/copy.sql", "unique_id": "macro.dbt_bigquery.materialization_copy_bigquery", "macro_sql": "{% materialization copy, adapter='bigquery' -%}\n\n  {# Setup #}\n  {{ run_hooks(pre_hooks) }}\n\n  {% set destination = this.incorporate(type='table') %}\n\n  {# there can be several ref() or source() according to BQ copy API docs #}\n  {# cycle over ref() and source() to create source tables array #}\n  {% set source_array = [] %}\n  {% for ref_table in model.refs %}\n    {{ source_array.append(ref(ref_table.get('package'), ref_table.name, version=ref_table.get('version'))) }}\n  {% endfor %}\n\n  {% for src_table in model.sources %}\n    {{ source_array.append(source(*src_table)) }}\n  {% endfor %}\n\n  {# Call adapter copy_table function #}\n  {%- set result_str = adapter.copy_table(\n      source_array,\n      destination,\n      config.get('copy_materialization', default = 'table')) -%}\n\n  {{ store_result('main', response=result_str) }}\n\n  {# Clean up #}\n  {{ run_hooks(post_hooks) }}\n  {%- do apply_grants(target_relation, grant_config) -%}\n  {{ adapter.commit() }}\n\n  {{ return({'relations': [destination]}) }}\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.594739, "supported_languages": ["sql"]}, "macro.dbt_bigquery.dbt_bigquery_validate_get_incremental_strategy": {"name": "dbt_bigquery_validate_get_incremental_strategy", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_bigquery.dbt_bigquery_validate_get_incremental_strategy", "macro_sql": "{% macro dbt_bigquery_validate_get_incremental_strategy(config) %}\n  {#-- Find and validate the incremental strategy #}\n  {%- set strategy = config.get(\"incremental_strategy\") or 'merge' -%}\n\n  {% set invalid_strategy_msg -%}\n    Invalid incremental strategy provided: {{ strategy }}\n    Expected one of: 'merge', 'insert_overwrite'\n  {%- endset %}\n  {% if strategy not in ['merge', 'insert_overwrite'] %}\n    {% do exceptions.raise_compiler_error(invalid_strategy_msg) %}\n  {% endif %}\n\n  {% do return(strategy) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.596991, "supported_languages": null}, "macro.dbt_bigquery.source_sql_with_partition": {"name": "source_sql_with_partition", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_bigquery.source_sql_with_partition", "macro_sql": "{% macro source_sql_with_partition(partition_by, source_sql) %}\n\n  {%- if partition_by.time_ingestion_partitioning %}\n    {{ return(wrap_with_time_ingestion_partitioning_sql(partition_by, source_sql, False))  }}\n  {% else %}\n    {{ return(source_sql)  }}\n  {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.wrap_with_time_ingestion_partitioning_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.5972931, "supported_languages": null}, "macro.dbt_bigquery.bq_create_table_as": {"name": "bq_create_table_as", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_bigquery.bq_create_table_as", "macro_sql": "{% macro bq_create_table_as(partition_by, temporary, relation, compiled_code, language='sql') %}\n  {%- set _dbt_max_partition = declare_dbt_max_partition(this, partition_by, compiled_code, language) -%}\n  {% if partition_by.time_ingestion_partitioning and language == 'python' %}\n    {% do exceptions.raise_compiler_error(\n      \"Python models do not support ingestion time partitioning\"\n    ) %}\n  {% elif partition_by.time_ingestion_partitioning and language == 'sql' %}\n    {#-- Create the table before inserting data as ingestion time partitioned tables can't be created with the transformed data --#}\n    {% do run_query(create_table_as(temporary, relation, compiled_code)) %}\n    {{ return(_dbt_max_partition + bq_insert_into_ingestion_time_partitioned_table_sql(relation, compiled_code)) }}\n  {% else %}\n    {{ return(_dbt_max_partition + create_table_as(temporary, relation, compiled_code, language)) }}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.declare_dbt_max_partition", "macro.dbt.run_query", "macro.dbt.create_table_as", "macro.dbt_bigquery.bq_insert_into_ingestion_time_partitioned_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.598071, "supported_languages": null}, "macro.dbt_bigquery.bq_generate_incremental_build_sql": {"name": "bq_generate_incremental_build_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_bigquery.bq_generate_incremental_build_sql", "macro_sql": "{% macro bq_generate_incremental_build_sql(\n    strategy, tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists, copy_partitions, incremental_predicates\n) %}\n  {#-- if partitioned, use BQ scripting to get the range of partition values to be updated --#}\n  {% if strategy == 'insert_overwrite' %}\n\n    {% set build_sql = bq_generate_incremental_insert_overwrite_build_sql(\n        tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists, copy_partitions\n    ) %}\n\n  {% else %} {# strategy == 'merge' #}\n\n    {% set build_sql = bq_generate_incremental_merge_build_sql(\n        tmp_relation, target_relation, sql, unique_key, partition_by, dest_columns, tmp_relation_exists, incremental_predicates\n    ) %}\n\n  {% endif %}\n\n  {{ return(build_sql) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bq_generate_incremental_insert_overwrite_build_sql", "macro.dbt_bigquery.bq_generate_incremental_merge_build_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.5987399, "supported_languages": null}, "macro.dbt_bigquery.materialization_incremental_bigquery": {"name": "materialization_incremental_bigquery", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_bigquery.materialization_incremental_bigquery", "macro_sql": "{% materialization incremental, adapter='bigquery', supported_languages=['sql', 'python'] -%}\n\n  {%- set unique_key = config.get('unique_key') -%}\n  {%- set full_refresh_mode = (should_full_refresh()) -%}\n  {%- set language = model['language'] %}\n\n  {%- set target_relation = this %}\n  {%- set existing_relation = load_relation(this) %}\n  {%- set tmp_relation = make_temp_relation(this) %}\n\n  {#-- Validate early so we don't run SQL if the strategy is invalid --#}\n  {% set strategy = dbt_bigquery_validate_get_incremental_strategy(config) -%}\n\n  {%- set raw_partition_by = config.get('partition_by', none) -%}\n  {%- set partition_by = adapter.parse_partition_by(raw_partition_by) -%}\n  {%- set partitions = config.get('partitions', none) -%}\n  {%- set cluster_by = config.get('cluster_by', none) -%}\n\n  {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %}\n  {% set incremental_predicates = config.get('predicates', default=none) or config.get('incremental_predicates', default=none) %}\n\n   -- grab current tables grants config for comparison later on\n  {% set grant_config = config.get('grants') %}\n\n  {{ run_hooks(pre_hooks) }}\n\n  {% if partition_by.copy_partitions is true and strategy != 'insert_overwrite' %} {#-- We can't copy partitions with merge strategy --#}\n        {% set wrong_strategy_msg -%}\n        The 'copy_partitions' option requires the 'incremental_strategy' option to be set to 'insert_overwrite'.\n        {%- endset %}\n        {% do exceptions.raise_compiler_error(wrong_strategy_msg) %}\n\n  {% elif existing_relation is none %}\n      {%- call statement('main', language=language) -%}\n        {{ bq_create_table_as(partition_by, False, target_relation, compiled_code, language) }}\n      {%- endcall -%}\n\n  {% elif existing_relation.is_view %}\n      {#-- There's no way to atomically replace a view with a table on BQ --#}\n      {{ adapter.drop_relation(existing_relation) }}\n      {%- call statement('main', language=language) -%}\n        {{ bq_create_table_as(partition_by, False, target_relation, compiled_code, language) }}\n      {%- endcall -%}\n\n  {% elif full_refresh_mode %}\n      {#-- If the partition/cluster config has changed, then we must drop and recreate --#}\n      {% if not adapter.is_replaceable(existing_relation, partition_by, cluster_by) %}\n          {% do log(\"Hard refreshing \" ~ existing_relation ~ \" because it is not replaceable\") %}\n          {{ adapter.drop_relation(existing_relation) }}\n      {% endif %}\n      {%- call statement('main', language=language) -%}\n        {{ bq_create_table_as(partition_by, False, target_relation, compiled_code, language) }}\n      {%- endcall -%}\n\n  {% else %}\n    {%- if language == 'python' and strategy == 'insert_overwrite' -%}\n      {#-- This lets us move forward assuming no python will be directly templated into a query --#}\n      {%- set python_unsupported_msg -%}\n        The 'insert_overwrite' strategy is not yet supported for python models.\n      {%- endset %}\n      {% do exceptions.raise_compiler_error(python_unsupported_msg) %}\n    {%- endif -%}\n\n    {% set tmp_relation_exists = false %}\n    {% if on_schema_change != 'ignore' or language == 'python' %}\n      {#-- Check first, since otherwise we may not build a temp table --#}\n      {#-- Python always needs to create a temp table --#}\n      {%- call statement('create_tmp_relation', language=language) -%}\n        {{ bq_create_table_as(partition_by, True, tmp_relation, compiled_code, language) }}\n      {%- endcall -%}\n      {% set tmp_relation_exists = true %}\n      {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n      {% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}\n    {% endif %}\n\n    {% if not dest_columns %}\n      {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n    {% endif %}\n    {#--  Add time ingestion pseudo column to destination column as not part of the 'schema' but still need it for actual data insertion --#}\n    {% if partition_by.time_ingestion_partitioning %}\n      {% set dest_columns = adapter.add_time_ingestion_partition_column(partition_by, dest_columns) %}\n    {% endif %}\n\n    {% set build_sql = bq_generate_incremental_build_sql(\n        strategy, tmp_relation, target_relation, compiled_code, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists, partition_by.copy_partitions, incremental_predicates\n    ) %}\n\n    {%- call statement('main') -%}\n      {{ build_sql }}\n    {% endcall %}\n\n    {%- if language == 'python' and tmp_relation -%}\n      {{ adapter.drop_relation(tmp_relation) }}\n    {%- endif -%}\n\n  {% endif %}\n\n  {{ run_hooks(post_hooks) }}\n\n  {% set target_relation = this.incorporate(type='table') %}\n\n  {% set should_revoke = should_revoke(existing_relation, full_refresh_mode) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.load_relation", "macro.dbt.make_temp_relation", "macro.dbt_bigquery.dbt_bigquery_validate_get_incremental_strategy", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt_bigquery.bq_create_table_as", "macro.dbt.process_schema_changes", "macro.dbt_bigquery.bq_generate_incremental_build_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.602922, "supported_languages": ["sql", "python"]}, "macro.dbt_bigquery.bigquery__snapshot_hash_arguments": {"name": "bigquery__snapshot_hash_arguments", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "unique_id": "macro.dbt_bigquery.bigquery__snapshot_hash_arguments", "macro_sql": "{% macro bigquery__snapshot_hash_arguments(args) -%}\n  to_hex(md5(concat({%- for arg in args -%}\n    coalesce(cast({{ arg }} as string), ''){% if not loop.last %}, '|',{% endif -%}\n  {%- endfor -%}\n  )))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.603349, "supported_languages": null}, "macro.dbt_bigquery.bigquery__create_columns": {"name": "bigquery__create_columns", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "unique_id": "macro.dbt_bigquery.bigquery__create_columns", "macro_sql": "{% macro bigquery__create_columns(relation, columns) %}\n  {{ adapter.alter_table_add_columns(relation, columns) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.60351, "supported_languages": null}, "macro.dbt_bigquery.bigquery__post_snapshot": {"name": "bigquery__post_snapshot", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "unique_id": "macro.dbt_bigquery.bigquery__post_snapshot", "macro_sql": "{% macro bigquery__post_snapshot(staging_relation) %}\n  -- Clean up the snapshot temp table\n  {% do drop_relation(staging_relation) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.603651, "supported_languages": null}, "macro.dbt_bigquery.bigquery__can_clone_table": {"name": "bigquery__can_clone_table", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/clone.sql", "original_file_path": "macros/materializations/clone.sql", "unique_id": "macro.dbt_bigquery.bigquery__can_clone_table", "macro_sql": "{% macro bigquery__can_clone_table() %}\n    {{ return(True) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.603848, "supported_languages": null}, "macro.dbt_bigquery.bigquery__create_or_replace_clone": {"name": "bigquery__create_or_replace_clone", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/clone.sql", "original_file_path": "macros/materializations/clone.sql", "unique_id": "macro.dbt_bigquery.bigquery__create_or_replace_clone", "macro_sql": "{% macro bigquery__create_or_replace_clone(this_relation, defer_relation) %}\n    create or replace\n      table {{ this_relation }}\n      clone {{ defer_relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.603986, "supported_languages": null}, "macro.dbt_bigquery.bq_generate_incremental_merge_build_sql": {"name": "bq_generate_incremental_merge_build_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/merge.sql", "original_file_path": "macros/materializations/incremental_strategy/merge.sql", "unique_id": "macro.dbt_bigquery.bq_generate_incremental_merge_build_sql", "macro_sql": "{% macro bq_generate_incremental_merge_build_sql(\n    tmp_relation, target_relation, sql, unique_key, partition_by, dest_columns, tmp_relation_exists, incremental_predicates\n) %}\n    {%- set source_sql -%}\n        {%- if tmp_relation_exists -%}\n        (\n        select\n        {% if partition_by.time_ingestion_partitioning -%}\n        {{ partition_by.insertable_time_partitioning_field() }},\n        {%- endif -%}\n        * from {{ tmp_relation }}\n        )\n        {%- else -%} {#-- wrap sql in parens to make it a subquery --#}\n        (\n            {%- if partition_by.time_ingestion_partitioning -%}\n            {{ wrap_with_time_ingestion_partitioning_sql(partition_by, sql, True) }}\n            {%- else -%}\n            {{sql}}\n            {%- endif %}\n        )\n        {%- endif -%}\n    {%- endset -%}\n\n    {% set build_sql = get_merge_sql(target_relation, source_sql, unique_key, dest_columns, incremental_predicates) %}\n\n    {{ return(build_sql) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.wrap_with_time_ingestion_partitioning_sql", "macro.dbt.get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6049159, "supported_languages": null}, "macro.dbt_bigquery.declare_dbt_max_partition": {"name": "declare_dbt_max_partition", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/common.sql", "original_file_path": "macros/materializations/incremental_strategy/common.sql", "unique_id": "macro.dbt_bigquery.declare_dbt_max_partition", "macro_sql": "{% macro declare_dbt_max_partition(relation, partition_by, compiled_code, language='sql') %}\n\n  {#-- TODO: revisit partitioning with python models --#}\n  {%- if '_dbt_max_partition' in compiled_code and language == 'sql' -%}\n\n    declare _dbt_max_partition {{ partition_by.data_type_for_partition() }} default (\n      select max({{ partition_by.field }}) from {{ this }}\n      where {{ partition_by.field }} is not null\n    );\n\n  {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.605372, "supported_languages": null}, "macro.dbt_bigquery.bq_generate_incremental_insert_overwrite_build_sql": {"name": "bq_generate_incremental_insert_overwrite_build_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "original_file_path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "unique_id": "macro.dbt_bigquery.bq_generate_incremental_insert_overwrite_build_sql", "macro_sql": "{% macro bq_generate_incremental_insert_overwrite_build_sql(\n    tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists, copy_partitions\n) %}\n    {% if partition_by is none %}\n      {% set missing_partition_msg -%}\n      The 'insert_overwrite' strategy requires the `partition_by` config.\n      {%- endset %}\n      {% do exceptions.raise_compiler_error(missing_partition_msg) %}\n    {% endif %}\n\n    {% set build_sql = bq_insert_overwrite_sql(\n        tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists, copy_partitions\n    ) %}\n\n    {{ return(build_sql) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bq_insert_overwrite_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.608268, "supported_languages": null}, "macro.dbt_bigquery.bq_copy_partitions": {"name": "bq_copy_partitions", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "original_file_path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "unique_id": "macro.dbt_bigquery.bq_copy_partitions", "macro_sql": "{% macro bq_copy_partitions(tmp_relation, target_relation, partitions, partition_by) %}\n\n  {% for partition in partitions %}\n    {% if partition_by.data_type == 'int64' %}\n      {% set partition = partition | as_text %}\n    {% elif partition_by.granularity == 'hour' %}\n      {% set partition = partition.strftime(\"%Y%m%d%H\") %}\n    {% elif partition_by.granularity == 'day' %}\n      {% set partition = partition.strftime(\"%Y%m%d\") %}\n    {% elif partition_by.granularity == 'month' %}\n      {% set partition = partition.strftime(\"%Y%m\") %}\n    {% elif partition_by.granularity == 'year' %}\n      {% set partition = partition.strftime(\"%Y\") %}\n    {% endif %}\n    {% set tmp_relation_partitioned = api.Relation.create(database=tmp_relation.database, schema=tmp_relation.schema, identifier=tmp_relation.table ~ '$' ~ partition, type=tmp_relation.type) %}\n    {% set target_relation_partitioned = api.Relation.create(database=target_relation.database, schema=target_relation.schema, identifier=target_relation.table ~ '$' ~ partition, type=target_relation.type) %}\n    {% do adapter.copy_table(tmp_relation_partitioned, target_relation_partitioned, \"table\") %}\n  {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.609641, "supported_languages": null}, "macro.dbt_bigquery.bq_insert_overwrite_sql": {"name": "bq_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "original_file_path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "unique_id": "macro.dbt_bigquery.bq_insert_overwrite_sql", "macro_sql": "{% macro bq_insert_overwrite_sql(\n    tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists, copy_partitions\n) %}\n  {% if partitions is not none and partitions != [] %} {# static #}\n      {{ bq_static_insert_overwrite_sql(tmp_relation, target_relation, sql, partition_by, partitions, dest_columns, tmp_relation_exists, copy_partitions) }}\n  {% else %} {# dynamic #}\n      {{ bq_dynamic_insert_overwrite_sql(tmp_relation, target_relation, sql, unique_key, partition_by, dest_columns, tmp_relation_exists, copy_partitions) }}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bq_static_insert_overwrite_sql", "macro.dbt_bigquery.bq_dynamic_insert_overwrite_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.610234, "supported_languages": null}, "macro.dbt_bigquery.bq_static_insert_overwrite_sql": {"name": "bq_static_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "original_file_path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "unique_id": "macro.dbt_bigquery.bq_static_insert_overwrite_sql", "macro_sql": "{% macro bq_static_insert_overwrite_sql(\n    tmp_relation, target_relation, sql, partition_by, partitions, dest_columns, tmp_relation_exists, copy_partitions\n) %}\n\n      {% set predicate -%}\n          {{ partition_by.render_wrapped(alias='DBT_INTERNAL_DEST') }} in (\n              {{ partitions | join (', ') }}\n          )\n      {%- endset %}\n\n      {%- set source_sql -%}\n        (\n          {% if partition_by.time_ingestion_partitioning and tmp_relation_exists -%}\n          select\n            {{ partition_by.insertable_time_partitioning_field() }},\n            * from {{ tmp_relation }}\n          {% elif tmp_relation_exists -%}\n            select\n            * from {{ tmp_relation }}\n          {%- elif partition_by.time_ingestion_partitioning -%}\n            {{ wrap_with_time_ingestion_partitioning_sql(partition_by, sql, True) }}\n          {%- else -%}\n            {{sql}}\n          {%- endif -%}\n\n        )\n      {%- endset -%}\n\n      {% if copy_partitions %}\n          {% do bq_copy_partitions(tmp_relation, target_relation, partitions, partition_by) %}\n      {% else %}\n\n      {#-- In case we're putting the model SQL _directly_ into the MERGE statement,\n         we need to prepend the MERGE statement with the user-configured sql_header,\n         which may be needed to resolve that model SQL (e.g. referencing a variable or UDF in the header)\n         in the \"temporary table exists\" case, we save the model SQL result as a temp table first, wherein the\n         sql_header is included by the create_table_as macro.\n      #}\n      -- 1. run the merge statement\n      {{ get_insert_overwrite_merge_sql(target_relation, source_sql, dest_columns, [predicate], include_sql_header = not tmp_relation_exists) }};\n\n      {%- if tmp_relation_exists -%}\n      -- 2. clean up the temp table\n      drop table if exists {{ tmp_relation }};\n      {%- endif -%}\n\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.wrap_with_time_ingestion_partitioning_sql", "macro.dbt_bigquery.bq_copy_partitions", "macro.dbt.get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.611275, "supported_languages": null}, "macro.dbt_bigquery.bq_dynamic_copy_partitions_insert_overwrite_sql": {"name": "bq_dynamic_copy_partitions_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "original_file_path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "unique_id": "macro.dbt_bigquery.bq_dynamic_copy_partitions_insert_overwrite_sql", "macro_sql": "{% macro bq_dynamic_copy_partitions_insert_overwrite_sql(\n  tmp_relation, target_relation, sql, unique_key, partition_by, dest_columns, tmp_relation_exists, copy_partitions\n  ) %}\n  {%- if tmp_relation_exists is false -%}\n  {# We run temp table creation in a separated script to move to partitions copy if it doesn't already exist #}\n    {%- call statement('create_tmp_relation_for_copy', language='sql') -%}\n      {{ bq_create_table_as(partition_by, True, tmp_relation, sql, 'sql')\n    }}\n    {%- endcall %}\n  {%- endif -%}\n  {%- set partitions_sql -%}\n    select distinct {{ partition_by.render_wrapped() }}\n    from {{ tmp_relation }}\n  {%- endset -%}\n  {%- set partitions = run_query(partitions_sql).columns[0].values() -%}\n  {# We copy the partitions #}\n  {%- do bq_copy_partitions(tmp_relation, target_relation, partitions, partition_by) -%}\n  -- Clean up the temp table\n  drop table if exists {{ tmp_relation }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_bigquery.bq_create_table_as", "macro.dbt.run_query", "macro.dbt_bigquery.bq_copy_partitions"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.612, "supported_languages": null}, "macro.dbt_bigquery.bq_dynamic_insert_overwrite_sql": {"name": "bq_dynamic_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "original_file_path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "unique_id": "macro.dbt_bigquery.bq_dynamic_insert_overwrite_sql", "macro_sql": "{% macro bq_dynamic_insert_overwrite_sql(tmp_relation, target_relation, sql, unique_key, partition_by, dest_columns, tmp_relation_exists, copy_partitions) %}\n  {%- if copy_partitions is true %}\n     {{ bq_dynamic_copy_partitions_insert_overwrite_sql(tmp_relation, target_relation, sql, unique_key, partition_by, dest_columns, tmp_relation_exists, copy_partitions) }}\n  {% else -%}\n      {% set predicate -%}\n          {{ partition_by.render_wrapped(alias='DBT_INTERNAL_DEST') }} in unnest(dbt_partitions_for_replacement)\n      {%- endset %}\n\n      {%- set source_sql -%}\n      (\n        select\n        {% if partition_by.time_ingestion_partitioning -%}\n        {{ partition_by.insertable_time_partitioning_field() }},\n        {%- endif -%}\n        * from {{ tmp_relation }}\n      )\n      {%- endset -%}\n\n      -- generated script to merge partitions into {{ target_relation }}\n      declare dbt_partitions_for_replacement array<{{ partition_by.data_type_for_partition() }}>;\n\n      {# have we already created the temp table to check for schema changes? #}\n      {% if not tmp_relation_exists %}\n       -- 1. create a temp table with model data\n        {{ bq_create_table_as(partition_by, True, tmp_relation, sql, 'sql') }}\n      {% else %}\n        -- 1. temp table already exists, we used it to check for schema changes\n      {% endif %}\n      {%- set partition_field = partition_by.time_partitioning_field() if partition_by.time_ingestion_partitioning else partition_by.render_wrapped() -%}\n\n      -- 2. define partitions to update\n      set (dbt_partitions_for_replacement) = (\n          select as struct\n              -- IGNORE NULLS: this needs to be aligned to _dbt_max_partition, which ignores null\n              array_agg(distinct {{ partition_field }} IGNORE NULLS)\n          from {{ tmp_relation }}\n      );\n\n      -- 3. run the merge statement\n      {{ get_insert_overwrite_merge_sql(target_relation, source_sql, dest_columns, [predicate]) }};\n\n      -- 4. clean up the temp table\n      drop table if exists {{ tmp_relation }}\n\n  {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bq_dynamic_copy_partitions_insert_overwrite_sql", "macro.dbt_bigquery.bq_create_table_as", "macro.dbt.get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.613166, "supported_languages": null}, "macro.dbt_bigquery.wrap_with_time_ingestion_partitioning_sql": {"name": "wrap_with_time_ingestion_partitioning_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "original_file_path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "unique_id": "macro.dbt_bigquery.wrap_with_time_ingestion_partitioning_sql", "macro_sql": "{% macro wrap_with_time_ingestion_partitioning_sql(partition_by, sql, is_nested) %}\n\n  select TIMESTAMP({{ partition_by.field }}) as {{ partition_by.insertable_time_partitioning_field() }}, * EXCEPT({{ partition_by.field }}) from (\n    {{ sql }}\n  ){%- if not is_nested -%};{%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.614589, "supported_languages": null}, "macro.dbt_bigquery.get_quoted_with_types_csv": {"name": "get_quoted_with_types_csv", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "original_file_path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "unique_id": "macro.dbt_bigquery.get_quoted_with_types_csv", "macro_sql": "{% macro get_quoted_with_types_csv(columns) %}\n    {% set quoted = [] %}\n    {% for col in columns -%}\n        {%- do quoted.append(adapter.quote(col.name) ~ \" \" ~ col.data_type) -%}\n    {%- endfor %}\n    {%- set dest_cols_csv = quoted | join(', ') -%}\n    {{ return(dest_cols_csv) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.61502, "supported_languages": null}, "macro.dbt_bigquery.columns_without_partition_fields_csv": {"name": "columns_without_partition_fields_csv", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "original_file_path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "unique_id": "macro.dbt_bigquery.columns_without_partition_fields_csv", "macro_sql": "{% macro columns_without_partition_fields_csv(partition_config, columns) -%}\n  {%- set columns_no_partition = partition_config.reject_partition_field_column(columns) -%}\n  {% set columns_names = get_quoted_with_types_csv(columns_no_partition) %}\n  {{ return(columns_names) }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_bigquery.get_quoted_with_types_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.615285, "supported_languages": null}, "macro.dbt_bigquery.bq_insert_into_ingestion_time_partitioned_table_sql": {"name": "bq_insert_into_ingestion_time_partitioned_table_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "original_file_path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "unique_id": "macro.dbt_bigquery.bq_insert_into_ingestion_time_partitioned_table_sql", "macro_sql": "{% macro bq_insert_into_ingestion_time_partitioned_table_sql(target_relation, sql) -%}\n  {%- set sql_header = config.get('sql_header', none) -%}\n  {{ sql_header if sql_header is not none }}\n  {%- set raw_partition_by = config.get('partition_by', none) -%}\n  {%- set partition_by = adapter.parse_partition_by(raw_partition_by) -%}\n  {% set dest_columns = adapter.get_columns_in_relation(target_relation) %}\n  {%- set dest_columns_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n  insert into {{ target_relation }} ({{ partition_by.insertable_time_partitioning_field() }}, {{ dest_columns_csv }})\n    {{ wrap_with_time_ingestion_partitioning_sql(partition_by, sql, False) }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.get_quoted_csv", "macro.dbt_bigquery.wrap_with_time_ingestion_partitioning_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.615961, "supported_languages": null}, "macro.dbt_bigquery.get_columns_with_types_in_query_sql": {"name": "get_columns_with_types_in_query_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "original_file_path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "unique_id": "macro.dbt_bigquery.get_columns_with_types_in_query_sql", "macro_sql": "{% macro get_columns_with_types_in_query_sql(select_sql) %}\n  {% set sql %}\n    {%- set sql_header = config.get('sql_header', none) -%}\n    {{ sql_header if sql_header is not none }}\n    select * from (\n      {{ select_sql }}\n    ) as __dbt_sbq\n    where false\n    limit 0\n  {% endset %}\n  {{ return(adapter.get_columns_in_select_sql(sql)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6163268, "supported_languages": null}, "macro.dbt_bigquery.bigquery__drop_relation": {"name": "bigquery__drop_relation", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt_bigquery.bigquery__drop_relation", "macro_sql": "{% macro bigquery__drop_relation(relation) -%}\n    {% do adapter.drop_relation(relation) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6165051, "supported_languages": null}, "macro.dbt_bigquery.bigquery_options": {"name": "bigquery_options", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/options.sql", "original_file_path": "macros/relations/options.sql", "unique_id": "macro.dbt_bigquery.bigquery_options", "macro_sql": "{% macro bigquery_options(opts) %}\n  {% set options -%}\n    OPTIONS({% for opt_key, opt_val in opts.items() %}\n      {{ opt_key }}={{ opt_val }}{{ \",\" if not loop.last }}\n    {% endfor %})\n  {%- endset %}\n  {%- do return(options) -%}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6169631, "supported_languages": null}, "macro.dbt_bigquery.cluster_by": {"name": "cluster_by", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/cluster.sql", "original_file_path": "macros/relations/cluster.sql", "unique_id": "macro.dbt_bigquery.cluster_by", "macro_sql": "{% macro cluster_by(raw_cluster_by) %}\n  {%- if raw_cluster_by is not none -%}\n  cluster by {% if raw_cluster_by is string -%}\n    {% set raw_cluster_by = [raw_cluster_by] %}\n  {%- endif -%}\n  {%- for cluster in raw_cluster_by -%}\n    {{ cluster }}\n    {%- if not loop.last -%}, {% endif -%}\n  {%- endfor -%}\n\n  {% endif %}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.617461, "supported_languages": null}, "macro.dbt_bigquery.bigquery__rename_relation": {"name": "bigquery__rename_relation", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt_bigquery.bigquery__rename_relation", "macro_sql": "{% macro bigquery__rename_relation(from_relation, to_relation) -%}\n  {% do adapter.rename_relation(from_relation, to_relation) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.617661, "supported_languages": null}, "macro.dbt_bigquery.partition_by": {"name": "partition_by", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/partition.sql", "original_file_path": "macros/relations/partition.sql", "unique_id": "macro.dbt_bigquery.partition_by", "macro_sql": "{% macro partition_by(partition_config) -%}\n    {%- if partition_config is none -%}\n      {% do return('') %}\n    {%- elif partition_config.time_ingestion_partitioning -%}\n        partition by {{ partition_config.render_wrapped() }}\n    {%- elif partition_config.data_type | lower in ('date','timestamp','datetime') -%}\n        partition by {{ partition_config.render() }}\n    {%- elif partition_config.data_type | lower in ('int64') -%}\n        {%- set range = partition_config.range -%}\n        partition by range_bucket(\n            {{ partition_config.field }},\n            generate_array({{ range.start}}, {{ range.end }}, {{ range.interval }})\n        )\n    {%- endif -%}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.61853, "supported_languages": null}, "macro.dbt_bigquery.bigquery__drop_materialized_view": {"name": "bigquery__drop_materialized_view", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/materialized_view/drop.sql", "original_file_path": "macros/relations/materialized_view/drop.sql", "unique_id": "macro.dbt_bigquery.bigquery__drop_materialized_view", "macro_sql": "{% macro bigquery__drop_materialized_view(relation) %}\n    drop materialized view if exists {{ relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.618677, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_replace_materialized_view_as_sql": {"name": "bigquery__get_replace_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/materialized_view/replace.sql", "original_file_path": "macros/relations/materialized_view/replace.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_replace_materialized_view_as_sql", "macro_sql": "{% macro bigquery__get_replace_materialized_view_as_sql(relation, sql) %}\n\n    {%- set materialized_view = adapter.Relation.materialized_view_from_model_node(config.model) -%}\n\n    create or replace materialized view if not exists {{ relation }}\n    {% if materialized_view.partition %}{{ partition_by(materialized_view.partition) }}{% endif %}\n    {% if materialized_view.cluster %}{{ cluster_by(materialized_view.cluster.fields) }}{% endif %}\n    {{ bigquery_options(materialized_view.options.as_ddl_dict()) }}\n    as {{ sql }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.partition_by", "macro.dbt_bigquery.cluster_by", "macro.dbt_bigquery.bigquery_options"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6193202, "supported_languages": null}, "macro.dbt_bigquery.bigquery__refresh_materialized_view": {"name": "bigquery__refresh_materialized_view", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/materialized_view/refresh.sql", "original_file_path": "macros/relations/materialized_view/refresh.sql", "unique_id": "macro.dbt_bigquery.bigquery__refresh_materialized_view", "macro_sql": "{% macro bigquery__refresh_materialized_view(relation) %}\n    call bq.refresh_materialized_view('{{ relation.database }}.{{ relation.schema }}.{{ relation.identifier }}')\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.619543, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_alter_materialized_view_as_sql": {"name": "bigquery__get_alter_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_alter_materialized_view_as_sql", "macro_sql": "{% macro bigquery__get_alter_materialized_view_as_sql(\n    relation,\n    configuration_changes,\n    sql,\n    existing_relation,\n    backup_relation,\n    intermediate_relation\n) %}\n\n    {% if configuration_changes.requires_full_refresh %}\n        {{ get_replace_sql(existing_relation, relation, sql) }}\n    {% else %}\n\n        alter materialized view {{ relation }}\n            set {{ bigquery_options(configuration_changes.options.context.as_ddl_dict()) }}\n\n    {%- endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_replace_sql", "macro.dbt_bigquery.bigquery_options"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.620151, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_materialized_view_configuration_changes": {"name": "bigquery__get_materialized_view_configuration_changes", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_materialized_view_configuration_changes", "macro_sql": "{% macro bigquery__get_materialized_view_configuration_changes(existing_relation, new_config) %}\n    {% set _existing_materialized_view = adapter.describe_relation(existing_relation) %}\n    {% set _configuration_changes = existing_relation.materialized_view_config_changeset(_existing_materialized_view, new_config) %}\n    {% do return(_configuration_changes) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.620464, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_create_materialized_view_as_sql": {"name": "bigquery__get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/materialized_view/create.sql", "original_file_path": "macros/relations/materialized_view/create.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_create_materialized_view_as_sql", "macro_sql": "{% macro bigquery__get_create_materialized_view_as_sql(relation, sql) %}\n\n    {%- set materialized_view = adapter.Relation.materialized_view_from_model_node(config.model) -%}\n\n    create materialized view if not exists {{ relation }}\n    {% if materialized_view.partition %}{{ partition_by(materialized_view.partition) }}{% endif %}\n    {% if materialized_view.cluster %}{{ cluster_by(materialized_view.cluster.fields) }}{% endif %}\n    {{ bigquery_options(materialized_view.options.as_ddl_dict()) }}\n    as {{ sql }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.partition_by", "macro.dbt_bigquery.cluster_by", "macro.dbt_bigquery.bigquery_options"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.621106, "supported_languages": null}, "macro.dbt_bigquery.bigquery__drop_table": {"name": "bigquery__drop_table", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt_bigquery.bigquery__drop_table", "macro_sql": "{% macro bigquery__drop_table(relation) %}\n    drop table if exists {{ relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.621245, "supported_languages": null}, "macro.dbt_bigquery.bigquery_table_options": {"name": "bigquery_table_options", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/table/options.sql", "original_file_path": "macros/relations/table/options.sql", "unique_id": "macro.dbt_bigquery.bigquery_table_options", "macro_sql": "{% macro bigquery_table_options(config, node, temporary) %}\n  {% set opts = adapter.get_table_options(config, node, temporary) %}\n  {%- do return(bigquery_options(opts)) -%}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery_options"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6215491, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_rename_table_sql": {"name": "bigquery__get_rename_table_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_rename_table_sql", "macro_sql": "{%- macro bigquery__get_rename_table_sql(relation, new_name) -%}\n    alter table {{ relation }} rename to {{ new_name }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.621727, "supported_languages": null}, "macro.dbt_bigquery.bigquery__drop_view": {"name": "bigquery__drop_view", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt_bigquery.bigquery__drop_view", "macro_sql": "{% macro bigquery__drop_view(relation) %}\n    drop view if exists {{ relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.621866, "supported_languages": null}, "macro.dbt_bigquery.bigquery__create_or_replace_view": {"name": "bigquery__create_or_replace_view", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt_bigquery.bigquery__create_or_replace_view", "macro_sql": "{% macro bigquery__create_or_replace_view() %}\n  {%- set identifier = model['alias'] -%}\n\n  {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n  {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n  {%- set target_relation = api.Relation.create(\n      identifier=identifier, schema=schema, database=database,\n      type='view') -%}\n  {% set grant_config = config.get('grants') %}\n\n  {{ run_hooks(pre_hooks) }}\n\n  -- If there's a table with the same name and we weren't told to full refresh,\n  -- that's an error. If we were told to full refresh, drop it. This behavior differs\n  -- for Snowflake and BigQuery, so multiple dispatch is used.\n  {%- if old_relation is not none and not old_relation.is_view -%}\n    {{ handle_existing_table(should_full_refresh(), old_relation) }}\n  {%- endif -%}\n\n  -- build model\n  {% call statement('main') -%}\n    {{ get_create_view_as_sql(target_relation, sql) }}\n  {%- endcall %}\n\n  {% set should_revoke = should_revoke(exists_as_view, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {{ run_hooks(post_hooks) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt_bigquery.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.623716, "supported_languages": null}, "macro.dbt_bigquery.handle_existing_table": {"name": "handle_existing_table", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt_bigquery.handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n    {{ adapter.dispatch('handle_existing_table', 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__handle_existing_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6239219, "supported_languages": null}, "macro.dbt_bigquery.default__handle_existing_table": {"name": "default__handle_existing_table", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt_bigquery.default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n    {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n    {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6241531, "supported_languages": null}, "macro.dbt_bigquery.bigquery_view_options": {"name": "bigquery_view_options", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/view/options.sql", "original_file_path": "macros/relations/view/options.sql", "unique_id": "macro.dbt_bigquery.bigquery_view_options", "macro_sql": "{% macro bigquery_view_options(config, node) %}\n  {% set opts = adapter.get_view_options(config, node) %}\n  {%- do return(bigquery_options(opts)) -%}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery_options"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.624438, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_rename_view_sql": {"name": "bigquery__get_rename_view_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_rename_view_sql", "macro_sql": "{%- macro bigquery__get_rename_view_sql(relation, new_name) -%}\n    alter view {{ relation }} rename to {{ new_name }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.624613, "supported_languages": null}, "macro.dbt_bigquery.bigquery__except": {"name": "bigquery__except", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/except.sql", "original_file_path": "macros/utils/except.sql", "unique_id": "macro.dbt_bigquery.bigquery__except", "macro_sql": "{% macro bigquery__except() %}\n\n    except distinct\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.624717, "supported_languages": null}, "macro.dbt_bigquery.bigquery__dateadd": {"name": "bigquery__dateadd", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/dateadd.sql", "original_file_path": "macros/utils/dateadd.sql", "unique_id": "macro.dbt_bigquery.bigquery__dateadd", "macro_sql": "{% macro bigquery__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n        datetime_add(\n            cast( {{ from_date_or_timestamp }} as datetime),\n        interval {{ interval }} {{ datepart }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.624942, "supported_languages": null}, "macro.dbt_bigquery.bigquery__current_timestamp": {"name": "bigquery__current_timestamp", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_bigquery.bigquery__current_timestamp", "macro_sql": "{% macro bigquery__current_timestamp() -%}\n  current_timestamp()\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.625111, "supported_languages": null}, "macro.dbt_bigquery.bigquery__snapshot_string_as_time": {"name": "bigquery__snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_bigquery.bigquery__snapshot_string_as_time", "macro_sql": "{% macro bigquery__snapshot_string_as_time(timestamp) -%}\n    {%- set result = 'TIMESTAMP(\"' ~ timestamp ~ '\")' -%}\n    {{ return(result) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.625301, "supported_languages": null}, "macro.dbt_bigquery.bigquery__current_timestamp_backcompat": {"name": "bigquery__current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_bigquery.bigquery__current_timestamp_backcompat", "macro_sql": "{% macro bigquery__current_timestamp_backcompat() -%}\n  current_timestamp\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.625379, "supported_languages": null}, "macro.dbt_bigquery.bigquery__intersect": {"name": "bigquery__intersect", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/intersect.sql", "original_file_path": "macros/utils/intersect.sql", "unique_id": "macro.dbt_bigquery.bigquery__intersect", "macro_sql": "{% macro bigquery__intersect() %}\n\n    intersect distinct\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.625482, "supported_languages": null}, "macro.dbt_bigquery.bigquery__escape_single_quotes": {"name": "bigquery__escape_single_quotes", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt_bigquery.bigquery__escape_single_quotes", "macro_sql": "{% macro bigquery__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\", \"\\\\'\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.625671, "supported_languages": null}, "macro.dbt_bigquery.bigquery__format_column": {"name": "bigquery__format_column", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/get_columns_spec_ddl.sql", "original_file_path": "macros/utils/get_columns_spec_ddl.sql", "unique_id": "macro.dbt_bigquery.bigquery__format_column", "macro_sql": "{% macro bigquery__format_column(column) -%}\n  {% set data_type = column.data_type %}\n  {% set formatted = column.column.lower() ~ \" \" ~ data_type %}\n  {{ return({'name': column.name, 'data_type': data_type, 'formatted': formatted}) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.626538, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_empty_schema_sql": {"name": "bigquery__get_empty_schema_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/get_columns_spec_ddl.sql", "original_file_path": "macros/utils/get_columns_spec_ddl.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_empty_schema_sql", "macro_sql": "{% macro bigquery__get_empty_schema_sql(columns) %}\n    {%- set col_err = [] -%}\n    {% for col in columns.values() %}\n      {%- if col['data_type'] is not defined -%}\n        {{ col_err.append(col['name']) }}\n      {%- endif -%}\n    {%- endfor -%}\n    {%- if (col_err | length) > 0 -%}\n      {{ exceptions.column_type_missing(column_names=col_err) }}\n    {%- endif -%}\n\n    {%- set columns = adapter.nest_column_data_types(columns) -%}\n    {{ return(dbt.default__get_empty_schema_sql(columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_empty_schema_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6271622, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_select_subquery": {"name": "bigquery__get_select_subquery", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/get_columns_spec_ddl.sql", "original_file_path": "macros/utils/get_columns_spec_ddl.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_select_subquery", "macro_sql": "{% macro bigquery__get_select_subquery(sql) %}\n    select {{ adapter.dispatch('get_column_names')() }}\n    from (\n        {{ sql }}\n    ) as model_subq\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_column_names"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.627338, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_column_names": {"name": "bigquery__get_column_names", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/get_columns_spec_ddl.sql", "original_file_path": "macros/utils/get_columns_spec_ddl.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_column_names", "macro_sql": "{% macro bigquery__get_column_names() %}\n  {#- loop through nested user_provided_columns to get column names -#}\n    {%- set user_provided_columns = adapter.nest_column_data_types(model['columns']) -%}\n    {%- for i in user_provided_columns %}\n      {%- set col = user_provided_columns[i] -%}\n      {%- set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] -%}\n      {{ col_name }}{{ \", \" if not loop.last }}\n    {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.62784, "supported_languages": null}, "macro.dbt_bigquery.bigquery__right": {"name": "bigquery__right", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt_bigquery.bigquery__right", "macro_sql": "{% macro bigquery__right(string_text, length_expression) %}\n\n    case when {{ length_expression }} = 0\n        then ''\n    else\n        substr(\n            {{ string_text }},\n            -1 * ({{ length_expression }})\n        )\n    end\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.628086, "supported_languages": null}, "macro.dbt_bigquery.bigquery__listagg": {"name": "bigquery__listagg", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/listagg.sql", "original_file_path": "macros/utils/listagg.sql", "unique_id": "macro.dbt_bigquery.bigquery__listagg", "macro_sql": "{% macro bigquery__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n    string_agg(\n        {{ measure }},\n        {{ delimiter_text }}\n        {% if order_by_clause -%}\n        {{ order_by_clause }}\n        {%- endif %}\n        {% if limit_num -%}\n        limit {{ limit_num }}\n        {%- endif %}\n        )\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.628492, "supported_languages": null}, "macro.dbt_bigquery.bigquery__datediff": {"name": "bigquery__datediff", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/datediff.sql", "original_file_path": "macros/utils/datediff.sql", "unique_id": "macro.dbt_bigquery.bigquery__datediff", "macro_sql": "{% macro bigquery__datediff(first_date, second_date, datepart) -%}\n\n  {% if dbt_version[0] == 1 and dbt_version[2] >= 2 %}\n    {{ return(dbt.datediff(first_date, second_date, datepart)) }}\n  {% else %}\n\n    datetime_diff(\n        cast({{second_date}} as datetime),\n        cast({{first_date}} as datetime),\n        {{datepart}}\n    )\n\n  {% endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.629021, "supported_languages": null}, "macro.dbt_bigquery.bigquery__safe_cast": {"name": "bigquery__safe_cast", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt_bigquery.bigquery__safe_cast", "macro_sql": "{% macro bigquery__safe_cast(field, type) %}\n    safe_cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.629209, "supported_languages": null}, "macro.dbt_bigquery.bigquery__hash": {"name": "bigquery__hash", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/hash.sql", "original_file_path": "macros/utils/hash.sql", "unique_id": "macro.dbt_bigquery.bigquery__hash", "macro_sql": "{% macro bigquery__hash(field) -%}\n    to_hex({{dbt.default__hash(field)}})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.629375, "supported_languages": null}, "macro.dbt_bigquery.bigquery__position": {"name": "bigquery__position", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/position.sql", "original_file_path": "macros/utils/position.sql", "unique_id": "macro.dbt_bigquery.bigquery__position", "macro_sql": "{% macro bigquery__position(substring_text, string_text) %}\n\n    strpos(\n        {{ string_text }},\n        {{ substring_text }}\n\n    )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.629621, "supported_languages": null}, "macro.dbt_bigquery.bigquery__array_concat": {"name": "bigquery__array_concat", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/array_concat.sql", "original_file_path": "macros/utils/array_concat.sql", "unique_id": "macro.dbt_bigquery.bigquery__array_concat", "macro_sql": "{% macro bigquery__array_concat(array_1, array_2) -%}\n    array_concat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.629792, "supported_languages": null}, "macro.dbt_bigquery.bigquery__bool_or": {"name": "bigquery__bool_or", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt_bigquery.bigquery__bool_or", "macro_sql": "{% macro bigquery__bool_or(expression) -%}\n\n    logical_or({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.629927, "supported_languages": null}, "macro.dbt_bigquery.bigquery__split_part": {"name": "bigquery__split_part", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt_bigquery.bigquery__split_part", "macro_sql": "{% macro bigquery__split_part(string_text, delimiter_text, part_number) %}\n\n  {% if part_number >= 0 %}\n    split(\n        {{ string_text }},\n        {{ delimiter_text }}\n        )[safe_offset({{ part_number - 1 }})]\n  {% else %}\n    split(\n        {{ string_text }},\n        {{ delimiter_text }}\n        )[safe_offset(\n          length({{ string_text }})\n          - length(\n              replace({{ string_text }},  {{ delimiter_text }}, '')\n          ) + 1 + {{ part_number }}\n        )]\n  {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6305459, "supported_languages": null}, "macro.dbt_bigquery.bigquery__date_trunc": {"name": "bigquery__date_trunc", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/date_trunc.sql", "original_file_path": "macros/utils/date_trunc.sql", "unique_id": "macro.dbt_bigquery.bigquery__date_trunc", "macro_sql": "{% macro bigquery__date_trunc(datepart, date) -%}\n    timestamp_trunc(\n        cast({{date}} as timestamp),\n        {{datepart}}\n    )\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.630728, "supported_languages": null}, "macro.dbt_bigquery.bigquery__array_construct": {"name": "bigquery__array_construct", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt_bigquery.bigquery__array_construct", "macro_sql": "{% macro bigquery__array_construct(inputs, data_type) -%}\n    {% if inputs|length > 0 %}\n    [ {{ inputs|join(' , ') }} ]\n    {% else %}\n    ARRAY<{{data_type}}>[]\n    {% endif %}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.631041, "supported_languages": null}, "macro.dbt_bigquery.bigquery__array_append": {"name": "bigquery__array_append", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/array_append.sql", "original_file_path": "macros/utils/array_append.sql", "unique_id": "macro.dbt_bigquery.bigquery__array_append", "macro_sql": "{% macro bigquery__array_append(array, new_element) -%}\n    {{ array_concat(array, array_construct([new_element])) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.array_concat", "macro.dbt.array_construct"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.631257, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_show_grant_sql": {"name": "bigquery__get_show_grant_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_show_grant_sql", "macro_sql": "{% macro bigquery__get_show_grant_sql(relation) %}\n    {% set location = adapter.get_dataset_location(relation) %}\n    {% set relation = relation.incorporate(location=location) %}\n\n    select privilege_type, grantee\n    from {{ relation.information_schema(\"OBJECT_PRIVILEGES\") }}\n    where object_schema = \"{{ relation.dataset }}\"\n      and object_name = \"{{ relation.identifier }}\"\n      -- filter out current user\n      and split(grantee, ':')[offset(1)] != session_user()\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.631913, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_grant_sql": {"name": "bigquery__get_grant_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_grant_sql", "macro_sql": "\n\n\n{%- macro bigquery__get_grant_sql(relation, privilege, grantee) -%}\n    grant `{{ privilege }}` on {{ relation.type }} {{ relation }} to {{ '\\\"' + grantee|join('\\\", \\\"') + '\\\"' }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.632164, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_revoke_sql": {"name": "bigquery__get_revoke_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_revoke_sql", "macro_sql": "{%- macro bigquery__get_revoke_sql(relation, privilege, grantee) -%}\n    revoke `{{ privilege }}` on {{ relation.type }} {{ relation }} from {{ '\\\"' + grantee|join('\\\", \\\"') + '\\\"' }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6324139, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_empty_subquery_sql": {"name": "bigquery__get_empty_subquery_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_empty_subquery_sql", "macro_sql": "{% macro bigquery__get_empty_subquery_sql(select_sql, select_sql_header=none) %}\n    {%- if select_sql_header is not none -%}\n    {{ select_sql_header }}\n    {%- endif -%}\n    select * from (\n        {{ select_sql }}\n    ) as __dbt_sbq\n    where false and current_timestamp() = current_timestamp()\n    limit 0\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.632712, "supported_languages": null}, "macro.dbt_bigquery.bigquery__resolve_model_name": {"name": "bigquery__resolve_model_name", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt_bigquery.bigquery__resolve_model_name", "macro_sql": "{% macro bigquery__resolve_model_name(input_model_name) -%}\n    {{ input_model_name | string | replace('`', '') | replace('\"', '\\\"') }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.632958, "supported_languages": null}, "macro.dbt.run_hooks": {"name": "run_hooks", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.run_hooks", "macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n  {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction)  %}\n    {% if not inside_transaction and loop.first %}\n      {% call statement(auto_begin=inside_transaction) %}\n        commit;\n      {% endcall %}\n    {% endif %}\n    {% set rendered = render(hook.get('sql')) | trim %}\n    {% if (rendered | length) > 0 %}\n      {% call statement(auto_begin=inside_transaction) %}\n        {{ rendered }}\n      {% endcall %}\n    {% endif %}\n  {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.634079, "supported_languages": null}, "macro.dbt.make_hook_config": {"name": "make_hook_config", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.make_hook_config", "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n    {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.634283, "supported_languages": null}, "macro.dbt.before_begin": {"name": "before_begin", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.before_begin", "macro_sql": "{% macro before_begin(sql) %}\n    {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.63443, "supported_languages": null}, "macro.dbt.in_transaction": {"name": "in_transaction", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.in_transaction", "macro_sql": "{% macro in_transaction(sql) %}\n    {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.634582, "supported_languages": null}, "macro.dbt.after_commit": {"name": "after_commit", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.after_commit", "macro_sql": "{% macro after_commit(sql) %}\n    {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.634728, "supported_languages": null}, "macro.dbt.set_sql_header": {"name": "set_sql_header", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.set_sql_header", "macro_sql": "{% macro set_sql_header(config) -%}\n  {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6351092, "supported_languages": null}, "macro.dbt.should_full_refresh": {"name": "should_full_refresh", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.should_full_refresh", "macro_sql": "{% macro should_full_refresh() %}\n  {% set config_full_refresh = config.get('full_refresh') %}\n  {% if config_full_refresh is none %}\n    {% set config_full_refresh = flags.FULL_REFRESH %}\n  {% endif %}\n  {% do return(config_full_refresh) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.635423, "supported_languages": null}, "macro.dbt.should_store_failures": {"name": "should_store_failures", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.should_store_failures", "macro_sql": "{% macro should_store_failures() %}\n  {% set config_store_failures = config.get('store_failures') %}\n  {% if config_store_failures is none %}\n    {% set config_store_failures = flags.STORE_FAILURES %}\n  {% endif %}\n  {% do return(config_store_failures) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.635799, "supported_languages": null}, "macro.dbt.snapshot_merge_sql": {"name": "snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "unique_id": "macro.dbt.snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n  {{ adapter.dispatch('snapshot_merge_sql', 'dbt')(target, source, insert_cols) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__snapshot_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.636235, "supported_languages": null}, "macro.dbt.default__snapshot_merge_sql": {"name": "default__snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "unique_id": "macro.dbt.default__snapshot_merge_sql", "macro_sql": "{% macro default__snapshot_merge_sql(target, source, insert_cols) -%}\n    {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n    merge into {{ target }} as DBT_INTERNAL_DEST\n    using {{ source }} as DBT_INTERNAL_SOURCE\n    on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id\n\n    when matched\n     and DBT_INTERNAL_DEST.dbt_valid_to is null\n     and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n        then update\n        set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n\n    when not matched\n     and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'\n        then insert ({{ insert_cols_csv }})\n        values ({{ insert_cols_csv }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.636519, "supported_languages": null}, "macro.dbt.strategy_dispatch": {"name": "strategy_dispatch", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.strategy_dispatch", "macro_sql": "{% macro strategy_dispatch(name) -%}\n{% set original_name = name %}\n  {% if '.' in name %}\n    {% set package_name, name = name.split(\".\", 1) %}\n  {% else %}\n    {% set package_name = none %}\n  {% endif %}\n\n  {% if package_name is none %}\n    {% set package_context = context %}\n  {% elif package_name in context %}\n    {% set package_context = context[package_name] %}\n  {% else %}\n    {% set error_msg %}\n        Could not find package '{{package_name}}', called with '{{original_name}}'\n    {% endset %}\n    {{ exceptions.raise_compiler_error(error_msg | trim) }}\n  {% endif %}\n\n  {%- set search_name = 'snapshot_' ~ name ~ '_strategy' -%}\n\n  {% if search_name not in package_context %}\n    {% set error_msg %}\n        The specified strategy macro '{{name}}' was not found in package '{{ package_name }}'\n    {% endset %}\n    {{ exceptions.raise_compiler_error(error_msg | trim) }}\n  {% endif %}\n  {{ return(package_context[search_name]) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.640107, "supported_languages": null}, "macro.dbt.snapshot_hash_arguments": {"name": "snapshot_hash_arguments", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n  {{ adapter.dispatch('snapshot_hash_arguments', 'dbt')(args) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.640286, "supported_languages": null}, "macro.dbt.default__snapshot_hash_arguments": {"name": "default__snapshot_hash_arguments", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.default__snapshot_hash_arguments", "macro_sql": "{% macro default__snapshot_hash_arguments(args) -%}\n    md5({%- for arg in args -%}\n        coalesce(cast({{ arg }} as varchar ), '')\n        {% if not loop.last %} || '|' || {% endif %}\n    {%- endfor -%})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6405172, "supported_languages": null}, "macro.dbt.snapshot_timestamp_strategy": {"name": "snapshot_timestamp_strategy", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_timestamp_strategy", "macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n    {% set primary_key = config['unique_key'] %}\n    {% set updated_at = config['updated_at'] %}\n    {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n\n    {#/*\n        The snapshot relation might not have an {{ updated_at }} value if the\n        snapshot strategy is changed from `check` to `timestamp`. We\n        should use a dbt-created column for the comparison in the snapshot\n        table instead of assuming that the user-supplied {{ updated_at }}\n        will be present in the historical data.\n\n        See https://github.com/dbt-labs/dbt-core/issues/2350\n    */ #}\n    {% set row_changed_expr -%}\n        ({{ snapshotted_rel }}.dbt_valid_from < {{ current_rel }}.{{ updated_at }})\n    {%- endset %}\n\n    {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n    {% do return({\n        \"unique_key\": primary_key,\n        \"updated_at\": updated_at,\n        \"row_changed\": row_changed_expr,\n        \"scd_id\": scd_id_expr,\n        \"invalidate_hard_deletes\": invalidate_hard_deletes\n    }) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.641262, "supported_languages": null}, "macro.dbt.snapshot_string_as_time": {"name": "snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n    {{ adapter.dispatch('snapshot_string_as_time', 'dbt')(timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__snapshot_string_as_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6414342, "supported_languages": null}, "macro.dbt.default__snapshot_string_as_time": {"name": "default__snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.default__snapshot_string_as_time", "macro_sql": "{% macro default__snapshot_string_as_time(timestamp) %}\n    {% do exceptions.raise_not_implemented(\n        'snapshot_string_as_time macro not implemented for adapter '+adapter.type()\n    ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.641612, "supported_languages": null}, "macro.dbt.snapshot_check_all_get_existing_columns": {"name": "snapshot_check_all_get_existing_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists, check_cols_config) -%}\n    {%- if not target_exists -%}\n        {#-- no table yet -> return whatever the query does --#}\n        {{ return((false, query_columns)) }}\n    {%- endif -%}\n\n    {#-- handle any schema changes --#}\n    {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=node.alias) -%}\n\n    {% if check_cols_config == 'all' %}\n        {%- set query_columns = get_columns_in_query(node['compiled_code']) -%}\n\n    {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n        {#-- query for proper casing/quoting, to support comparison below --#}\n        {%- set select_check_cols_from_target -%}\n            {#-- N.B. The whitespace below is necessary to avoid edge case issue with comments --#}\n            {#-- See: https://github.com/dbt-labs/dbt-core/issues/6781 --#}\n            select {{ check_cols_config | join(', ') }} from (\n                {{ node['compiled_code'] }}\n            ) subq\n        {%- endset -%}\n        {% set query_columns = get_columns_in_query(select_check_cols_from_target) %}\n\n    {% else %}\n        {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n    {% endif %}\n\n    {%- set existing_cols = adapter.get_columns_in_relation(target_relation) | map(attribute = 'name') | list -%}\n    {%- set ns = namespace() -%} {#-- handle for-loop scoping with a namespace --#}\n    {%- set ns.column_added = false -%}\n\n    {%- set intersection = [] -%}\n    {%- for col in query_columns -%}\n        {%- if col in existing_cols -%}\n            {%- do intersection.append(adapter.quote(col)) -%}\n        {%- else -%}\n            {% set ns.column_added = true %}\n        {%- endif -%}\n    {%- endfor -%}\n    {{ return((ns.column_added, intersection)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.64308, "supported_languages": null}, "macro.dbt.snapshot_check_strategy": {"name": "snapshot_check_strategy", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_check_strategy", "macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n    {% set check_cols_config = config['check_cols'] %}\n    {% set primary_key = config['unique_key'] %}\n    {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n    {% set updated_at = config.get('updated_at', snapshot_get_time()) %}\n\n    {% set column_added = false %}\n\n    {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists, check_cols_config) %}\n\n    {%- set row_changed_expr -%}\n    (\n    {%- if column_added -%}\n        {{ get_true_sql() }}\n    {%- else -%}\n    {%- for col in check_cols -%}\n        {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }}\n        or\n        (\n            (({{ snapshotted_rel }}.{{ col }} is null) and not ({{ current_rel }}.{{ col }} is null))\n            or\n            ((not {{ snapshotted_rel }}.{{ col }} is null) and ({{ current_rel }}.{{ col }} is null))\n        )\n        {%- if not loop.last %} or {% endif -%}\n    {%- endfor -%}\n    {%- endif -%}\n    )\n    {%- endset %}\n\n    {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n    {% do return({\n        \"unique_key\": primary_key,\n        \"updated_at\": updated_at,\n        \"row_changed\": row_changed_expr,\n        \"scd_id\": scd_id_expr,\n        \"invalidate_hard_deletes\": invalidate_hard_deletes\n    }) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.snapshot_get_time", "macro.dbt.snapshot_check_all_get_existing_columns", "macro.dbt.get_true_sql", "macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.644494, "supported_languages": null}, "macro.dbt.create_columns": {"name": "create_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n  {{ adapter.dispatch('create_columns', 'dbt')(relation, columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6486259, "supported_languages": null}, "macro.dbt.default__create_columns": {"name": "default__create_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__create_columns", "macro_sql": "{% macro default__create_columns(relation, columns) %}\n  {% for column in columns %}\n    {% call statement() %}\n      alter table {{ relation }} add column \"{{ column.name }}\" {{ column.data_type }};\n    {% endcall %}\n  {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.648917, "supported_languages": null}, "macro.dbt.post_snapshot": {"name": "post_snapshot", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n  {{ adapter.dispatch('post_snapshot', 'dbt')(staging_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.64909, "supported_languages": null}, "macro.dbt.default__post_snapshot": {"name": "default__post_snapshot", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__post_snapshot", "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n    {# no-op #}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.649181, "supported_languages": null}, "macro.dbt.get_true_sql": {"name": "get_true_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.get_true_sql", "macro_sql": "{% macro get_true_sql() %}\n  {{ adapter.dispatch('get_true_sql', 'dbt')() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_true_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6493309, "supported_languages": null}, "macro.dbt.default__get_true_sql": {"name": "default__get_true_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__get_true_sql", "macro_sql": "{% macro default__get_true_sql() %}\n    {{ return('TRUE') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.649451, "supported_languages": null}, "macro.dbt.snapshot_staging_table": {"name": "snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.snapshot_staging_table", "macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n  {{ adapter.dispatch('snapshot_staging_table', 'dbt')(strategy, source_sql, target_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__snapshot_staging_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.649664, "supported_languages": null}, "macro.dbt.default__snapshot_staging_table": {"name": "default__snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__snapshot_staging_table", "macro_sql": "{% macro default__snapshot_staging_table(strategy, source_sql, target_relation) -%}\n\n    with snapshot_query as (\n\n        {{ source_sql }}\n\n    ),\n\n    snapshotted_data as (\n\n        select *,\n            {{ strategy.unique_key }} as dbt_unique_key\n\n        from {{ target_relation }}\n        where dbt_valid_to is null\n\n    ),\n\n    insertions_source_data as (\n\n        select\n            *,\n            {{ strategy.unique_key }} as dbt_unique_key,\n            {{ strategy.updated_at }} as dbt_updated_at,\n            {{ strategy.updated_at }} as dbt_valid_from,\n            nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,\n            {{ strategy.scd_id }} as dbt_scd_id\n\n        from snapshot_query\n    ),\n\n    updates_source_data as (\n\n        select\n            *,\n            {{ strategy.unique_key }} as dbt_unique_key,\n            {{ strategy.updated_at }} as dbt_updated_at,\n            {{ strategy.updated_at }} as dbt_valid_from,\n            {{ strategy.updated_at }} as dbt_valid_to\n\n        from snapshot_query\n    ),\n\n    {%- if strategy.invalidate_hard_deletes %}\n\n    deletes_source_data as (\n\n        select\n            *,\n            {{ strategy.unique_key }} as dbt_unique_key\n        from snapshot_query\n    ),\n    {% endif %}\n\n    insertions as (\n\n        select\n            'insert' as dbt_change_type,\n            source_data.*\n\n        from insertions_source_data as source_data\n        left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n        where snapshotted_data.dbt_unique_key is null\n           or (\n                snapshotted_data.dbt_unique_key is not null\n            and (\n                {{ strategy.row_changed }}\n            )\n        )\n\n    ),\n\n    updates as (\n\n        select\n            'update' as dbt_change_type,\n            source_data.*,\n            snapshotted_data.dbt_scd_id\n\n        from updates_source_data as source_data\n        join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n        where (\n            {{ strategy.row_changed }}\n        )\n    )\n\n    {%- if strategy.invalidate_hard_deletes -%}\n    ,\n\n    deletes as (\n\n        select\n            'delete' as dbt_change_type,\n            source_data.*,\n            {{ snapshot_get_time() }} as dbt_valid_from,\n            {{ snapshot_get_time() }} as dbt_updated_at,\n            {{ snapshot_get_time() }} as dbt_valid_to,\n            snapshotted_data.dbt_scd_id\n\n        from snapshotted_data\n        left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n        where source_data.dbt_unique_key is null\n    )\n    {%- endif %}\n\n    select * from insertions\n    union all\n    select * from updates\n    {%- if strategy.invalidate_hard_deletes %}\n    union all\n    select * from deletes\n    {%- endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6505978, "supported_languages": null}, "macro.dbt.build_snapshot_table": {"name": "build_snapshot_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.build_snapshot_table", "macro_sql": "{% macro build_snapshot_table(strategy, sql) -%}\n  {{ adapter.dispatch('build_snapshot_table', 'dbt')(strategy, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__build_snapshot_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.650795, "supported_languages": null}, "macro.dbt.default__build_snapshot_table": {"name": "default__build_snapshot_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__build_snapshot_table", "macro_sql": "{% macro default__build_snapshot_table(strategy, sql) %}\n\n    select *,\n        {{ strategy.scd_id }} as dbt_scd_id,\n        {{ strategy.updated_at }} as dbt_updated_at,\n        {{ strategy.updated_at }} as dbt_valid_from,\n        nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to\n    from (\n        {{ sql }}\n    ) sbq\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6510541, "supported_languages": null}, "macro.dbt.build_snapshot_staging_table": {"name": "build_snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n    {% set temp_relation = make_temp_relation(target_relation) %}\n\n    {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n    {% call statement('build_snapshot_staging_relation') %}\n        {{ create_table_as(True, temp_relation, select) }}\n    {% endcall %}\n\n    {% do return(temp_relation) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_temp_relation", "macro.dbt.snapshot_staging_table", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.651501, "supported_languages": null}, "macro.dbt.materialization_snapshot_default": {"name": "materialization_snapshot_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot.sql", "original_file_path": "macros/materializations/snapshots/snapshot.sql", "unique_id": "macro.dbt.materialization_snapshot_default", "macro_sql": "{% materialization snapshot, default %}\n  {%- set config = model['config'] -%}\n\n  {%- set target_table = model.get('alias', model.get('name')) -%}\n\n  {%- set strategy_name = config.get('strategy') -%}\n  {%- set unique_key = config.get('unique_key') %}\n  -- grab current tables grants config for comparision later on\n  {%- set grant_config = config.get('grants') -%}\n\n  {% set target_relation_exists, target_relation = get_or_create_relation(\n          database=model.database,\n          schema=model.schema,\n          identifier=target_table,\n          type='table') -%}\n\n  {%- if not target_relation.is_table -%}\n    {% do exceptions.relation_wrong_type(target_relation, 'table') %}\n  {%- endif -%}\n\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  {% set strategy_macro = strategy_dispatch(strategy_name) %}\n  {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", config, target_relation_exists) %}\n\n  {% if not target_relation_exists %}\n\n      {% set build_sql = build_snapshot_table(strategy, model['compiled_code']) %}\n      {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n  {% else %}\n\n      {{ adapter.valid_snapshot_target(target_relation) }}\n\n      {% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}\n\n      -- this may no-op if the database does not require column expansion\n      {% do adapter.expand_target_column_types(from_relation=staging_table,\n                                               to_relation=target_relation) %}\n\n      {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n                                   | rejectattr('name', 'equalto', 'dbt_change_type')\n                                   | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n                                   | rejectattr('name', 'equalto', 'dbt_unique_key')\n                                   | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n                                   | list %}\n\n      {% do create_columns(target_relation, missing_columns) %}\n\n      {% set source_columns = adapter.get_columns_in_relation(staging_table)\n                                   | rejectattr('name', 'equalto', 'dbt_change_type')\n                                   | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n                                   | rejectattr('name', 'equalto', 'dbt_unique_key')\n                                   | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n                                   | list %}\n\n      {% set quoted_source_columns = [] %}\n      {% for column in source_columns %}\n        {% do quoted_source_columns.append(adapter.quote(column.name)) %}\n      {% endfor %}\n\n      {% set final_sql = snapshot_merge_sql(\n            target = target_relation,\n            source = staging_table,\n            insert_cols = quoted_source_columns\n         )\n      %}\n\n  {% endif %}\n\n  {% call statement('main') %}\n      {{ final_sql }}\n  {% endcall %}\n\n  {% set should_revoke = should_revoke(target_relation_exists, full_refresh_mode=False) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {% if not target_relation_exists %}\n    {% do create_indexes(target_relation) %}\n  {% endif %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  {{ adapter.commit() }}\n\n  {% if staging_table is defined %}\n      {% do post_snapshot(staging_table) %}\n  {% endif %}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.get_or_create_relation", "macro.dbt.run_hooks", "macro.dbt.strategy_dispatch", "macro.dbt.build_snapshot_table", "macro.dbt.create_table_as", "macro.dbt.build_snapshot_staging_table", "macro.dbt.create_columns", "macro.dbt.snapshot_merge_sql", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes", "macro.dbt.post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.657747, "supported_languages": ["sql"]}, "macro.dbt.materialization_test_default": {"name": "materialization_test_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/test.sql", "original_file_path": "macros/materializations/tests/test.sql", "unique_id": "macro.dbt.materialization_test_default", "macro_sql": "{%- materialization test, default -%}\n\n  {% set relations = [] %}\n\n  {% if should_store_failures() %}\n\n    {% set identifier = model['alias'] %}\n    {% set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n    {% set store_failures_as = config.get('store_failures_as') %}\n    -- if `--store-failures` is invoked via command line and `store_failures_as` is not set,\n    -- config.get('store_failures_as', 'table') returns None, not 'table'\n    {% if store_failures_as == none %}{% set store_failures_as = 'table' %}{% endif %}\n    {% if store_failures_as not in ['table', 'view'] %}\n        {{ exceptions.raise_compiler_error(\n            \"'\" ~ store_failures_as ~ \"' is not a valid value for `store_failures_as`. \"\n            \"Accepted values are: ['ephemeral', 'table', 'view']\"\n        ) }}\n    {% endif %}\n\n    {% set target_relation = api.Relation.create(\n        identifier=identifier, schema=schema, database=database, type=store_failures_as) -%} %}\n\n    {% if old_relation %}\n        {% do adapter.drop_relation(old_relation) %}\n    {% endif %}\n\n    {% call statement(auto_begin=True) %}\n        {{ get_create_sql(target_relation, sql) }}\n    {% endcall %}\n\n    {% do relations.append(target_relation) %}\n\n    {% set main_sql %}\n        select *\n        from {{ target_relation }}\n    {% endset %}\n\n    {{ adapter.commit() }}\n\n  {% else %}\n\n      {% set main_sql = sql %}\n\n  {% endif %}\n\n  {% set limit = config.get('limit') %}\n  {% set fail_calc = config.get('fail_calc') %}\n  {% set warn_if = config.get('warn_if') %}\n  {% set error_if = config.get('error_if') %}\n\n  {% call statement('main', fetch_result=True) -%}\n\n    {{ get_test_sql(main_sql, fail_calc, warn_if, error_if, limit)}}\n\n  {%- endcall %}\n\n  {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.should_store_failures", "macro.dbt.statement", "macro.dbt.get_create_sql", "macro.dbt.get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.660685, "supported_languages": ["sql"]}, "macro.dbt.get_test_sql": {"name": "get_test_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "unique_id": "macro.dbt.get_test_sql", "macro_sql": "{% macro get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n  {{ adapter.dispatch('get_test_sql', 'dbt')(main_sql, fail_calc, warn_if, error_if, limit) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.661178, "supported_languages": null}, "macro.dbt.default__get_test_sql": {"name": "default__get_test_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "unique_id": "macro.dbt.default__get_test_sql", "macro_sql": "{% macro default__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n    select\n      {{ fail_calc }} as failures,\n      {{ fail_calc }} {{ warn_if }} as should_warn,\n      {{ fail_calc }} {{ error_if }} as should_error\n    from (\n      {{ main_sql }}\n      {{ \"limit \" ~ limit if limit != none }}\n    ) dbt_internal_test\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.661505, "supported_languages": null}, "macro.dbt.get_where_subquery": {"name": "get_where_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "unique_id": "macro.dbt.get_where_subquery", "macro_sql": "{% macro get_where_subquery(relation) -%}\n    {% do return(adapter.dispatch('get_where_subquery', 'dbt')(relation)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_where_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.661898, "supported_languages": null}, "macro.dbt.default__get_where_subquery": {"name": "default__get_where_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "unique_id": "macro.dbt.default__get_where_subquery", "macro_sql": "{% macro default__get_where_subquery(relation) -%}\n    {% set where = config.get('where', '') %}\n    {% if where %}\n        {%- set filtered -%}\n            (select * from {{ relation }} where {{ where }}) dbt_subquery\n        {%- endset -%}\n        {% do return(filtered) %}\n    {%- else -%}\n        {% do return(relation) %}\n    {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.662296, "supported_languages": null}, "macro.dbt.materialization_materialized_view_default": {"name": "materialization_materialized_view_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialization_materialized_view_default", "macro_sql": "{% materialization materialized_view, default %}\n    {% set existing_relation = load_cached_relation(this) %}\n    {% set target_relation = this.incorporate(type=this.MaterializedView) %}\n    {% set intermediate_relation = make_intermediate_relation(target_relation) %}\n    {% set backup_relation_type = target_relation.MaterializedView if existing_relation is none else existing_relation.type %}\n    {% set backup_relation = make_backup_relation(target_relation, backup_relation_type) %}\n\n    {{ materialized_view_setup(backup_relation, intermediate_relation, pre_hooks) }}\n\n        {% set build_sql = materialized_view_get_build_sql(existing_relation, target_relation, backup_relation, intermediate_relation) %}\n\n        {% if build_sql == '' %}\n            {{ materialized_view_execute_no_op(target_relation) }}\n        {% else %}\n            {{ materialized_view_execute_build_sql(build_sql, existing_relation, target_relation, post_hooks) }}\n        {% endif %}\n\n    {{ materialized_view_teardown(backup_relation, intermediate_relation, post_hooks) }}\n\n    {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.materialized_view_setup", "macro.dbt.materialized_view_get_build_sql", "macro.dbt.materialized_view_execute_no_op", "macro.dbt.materialized_view_execute_build_sql", "macro.dbt.materialized_view_teardown"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6673331, "supported_languages": ["sql"]}, "macro.dbt.materialized_view_setup": {"name": "materialized_view_setup", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_setup", "macro_sql": "{% macro materialized_view_setup(backup_relation, intermediate_relation, pre_hooks) %}\n\n    -- backup_relation and intermediate_relation should not already exist in the database\n    -- it's possible these exist because of a previous run that exited unexpectedly\n    {% set preexisting_backup_relation = load_cached_relation(backup_relation) %}\n    {% set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) %}\n\n    -- drop the temp relations if they exist already in the database\n    {{ drop_relation_if_exists(preexisting_backup_relation) }}\n    {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n\n    {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.667739, "supported_languages": null}, "macro.dbt.materialized_view_teardown": {"name": "materialized_view_teardown", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_teardown", "macro_sql": "{% macro materialized_view_teardown(backup_relation, intermediate_relation, post_hooks) %}\n\n    -- drop the temp relations if they exist to leave the database clean for the next run\n    {{ drop_relation_if_exists(backup_relation) }}\n    {{ drop_relation_if_exists(intermediate_relation) }}\n\n    {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6680079, "supported_languages": null}, "macro.dbt.materialized_view_get_build_sql": {"name": "materialized_view_get_build_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_get_build_sql", "macro_sql": "{% macro materialized_view_get_build_sql(existing_relation, target_relation, backup_relation, intermediate_relation) %}\n\n    {% set full_refresh_mode = should_full_refresh() %}\n\n    -- determine the scenario we're in: create, full_refresh, alter, refresh data\n    {% if existing_relation is none %}\n        {% set build_sql = get_create_materialized_view_as_sql(target_relation, sql) %}\n    {% elif full_refresh_mode or not existing_relation.is_materialized_view %}\n        {% set build_sql = get_replace_sql(existing_relation, target_relation, sql) %}\n    {% else %}\n\n        -- get config options\n        {% set on_configuration_change = config.get('on_configuration_change') %}\n        {% set configuration_changes = get_materialized_view_configuration_changes(existing_relation, config) %}\n\n        {% if configuration_changes is none %}\n            {% set build_sql = refresh_materialized_view(target_relation) %}\n\n        {% elif on_configuration_change == 'apply' %}\n            {% set build_sql = get_alter_materialized_view_as_sql(target_relation, configuration_changes, sql, existing_relation, backup_relation, intermediate_relation) %}\n        {% elif on_configuration_change == 'continue' %}\n            {% set build_sql = '' %}\n            {{ exceptions.warn(\"Configuration changes were identified and `on_configuration_change` was set to `continue` for `\" ~ target_relation ~ \"`\") }}\n        {% elif on_configuration_change == 'fail' %}\n            {{ exceptions.raise_fail_fast_error(\"Configuration changes were identified and `on_configuration_change` was set to `fail` for `\" ~ target_relation ~ \"`\") }}\n\n        {% else %}\n            -- this only happens if the user provides a value other than `apply`, 'skip', 'fail'\n            {{ exceptions.raise_compiler_error(\"Unexpected configuration scenario\") }}\n\n        {% endif %}\n\n    {% endif %}\n\n    {% do return(build_sql) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.get_create_materialized_view_as_sql", "macro.dbt.get_replace_sql", "macro.dbt.get_materialized_view_configuration_changes", "macro.dbt.refresh_materialized_view", "macro.dbt.get_alter_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.669355, "supported_languages": null}, "macro.dbt.materialized_view_execute_no_op": {"name": "materialized_view_execute_no_op", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_execute_no_op", "macro_sql": "{% macro materialized_view_execute_no_op(target_relation) %}\n    {% do store_raw_result(\n        name=\"main\",\n        message=\"skip \" ~ target_relation,\n        code=\"skip\",\n        rows_affected=\"-1\"\n    ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.669597, "supported_languages": null}, "macro.dbt.materialized_view_execute_build_sql": {"name": "materialized_view_execute_build_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_execute_build_sql", "macro_sql": "{% macro materialized_view_execute_build_sql(build_sql, existing_relation, target_relation, post_hooks) %}\n\n    -- `BEGIN` happens here:\n    {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n    {% set grant_config = config.get('grants') %}\n\n    {% call statement(name=\"main\") %}\n        {{ build_sql }}\n    {% endcall %}\n\n    {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n    {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n    {% do persist_docs(target_relation, model) %}\n\n    {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n    {{ adapter.commit() }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6702878, "supported_languages": null}, "macro.dbt.materialization_view_default": {"name": "materialization_view_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/view.sql", "original_file_path": "macros/materializations/models/view.sql", "unique_id": "macro.dbt.materialization_view_default", "macro_sql": "{%- materialization view, default -%}\n\n  {%- set existing_relation = load_cached_relation(this) -%}\n  {%- set target_relation = this.incorporate(type='view') -%}\n  {%- set intermediate_relation =  make_intermediate_relation(target_relation) -%}\n\n  -- the intermediate_relation should not already exist in the database; get_relation\n  -- will return None in that case. Otherwise, we get a relation that we can drop\n  -- later, before we try to use this name for the current operation\n  {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n  /*\n     This relation (probably) doesn't exist yet. If it does exist, it's a leftover from\n     a previous run, and we're going to try to drop it immediately. At the end of this\n     materialization, we're going to rename the \"existing_relation\" to this identifier,\n     and then we're going to drop it. In order to make sure we run the correct one of:\n       - drop view ...\n       - drop table ...\n\n     We need to set the type of this relation to be the type of the existing_relation, if it exists,\n     or else \"view\" as a sane default if it does not. Note that if the existing_relation does not\n     exist, then there is nothing to move out of the way and subsequentally drop. In that case,\n     this relation will be effectively unused.\n  */\n  {%- set backup_relation_type = 'view' if existing_relation is none else existing_relation.type -%}\n  {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n  -- as above, the backup_relation should not already exist\n  {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n  -- grab current tables grants config for comparision later on\n  {% set grant_config = config.get('grants') %}\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  -- drop the temp relations if they exist already in the database\n  {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n  {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n  -- `BEGIN` happens here:\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  -- build model\n  {% call statement('main') -%}\n    {{ get_create_view_as_sql(intermediate_relation, sql) }}\n  {%- endcall %}\n\n  -- cleanup\n  -- move the existing view out of the way\n  {% if existing_relation is not none %}\n     /* Do the equivalent of rename_if_exists. 'existing_relation' could have been dropped\n        since the variable was first set. */\n    {% set existing_relation = load_cached_relation(existing_relation) %}\n    {% if existing_relation is not none %}\n        {{ adapter.rename_relation(existing_relation, backup_relation) }}\n    {% endif %}\n  {% endif %}\n  {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n  {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  {{ adapter.commit() }}\n\n  {{ drop_relation_if_exists(backup_relation) }}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.673407, "supported_languages": ["sql"]}, "macro.dbt.materialization_table_default": {"name": "materialization_table_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/table.sql", "original_file_path": "macros/materializations/models/table.sql", "unique_id": "macro.dbt.materialization_table_default", "macro_sql": "{% materialization table, default %}\n\n  {%- set existing_relation = load_cached_relation(this) -%}\n  {%- set target_relation = this.incorporate(type='table') %}\n  {%- set intermediate_relation =  make_intermediate_relation(target_relation) -%}\n  -- the intermediate_relation should not already exist in the database; get_relation\n  -- will return None in that case. Otherwise, we get a relation that we can drop\n  -- later, before we try to use this name for the current operation\n  {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n  /*\n      See ../view/view.sql for more information about this relation.\n  */\n  {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n  {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n  -- as above, the backup_relation should not already exist\n  {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n  -- grab current tables grants config for comparision later on\n  {% set grant_config = config.get('grants') %}\n\n  -- drop the temp relations if they exist already in the database\n  {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n  {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  -- `BEGIN` happens here:\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  -- build model\n  {% call statement('main') -%}\n    {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n  {%- endcall %}\n\n  -- cleanup\n  {% if existing_relation is not none %}\n     /* Do the equivalent of rename_if_exists. 'existing_relation' could have been dropped\n        since the variable was first set. */\n    {% set existing_relation = load_cached_relation(existing_relation) %}\n    {% if existing_relation is not none %}\n        {{ adapter.rename_relation(existing_relation, backup_relation) }}\n    {% endif %}\n  {% endif %}\n\n  {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n  {% do create_indexes(target_relation) %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  -- `COMMIT` happens here\n  {{ adapter.commit() }}\n\n  -- finally, drop the existing/backup relation after the commit\n  {{ drop_relation_if_exists(backup_relation) }}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt.create_indexes", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.676416, "supported_languages": ["sql"]}, "macro.dbt.get_quoted_csv": {"name": "get_quoted_csv", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.get_quoted_csv", "macro_sql": "{% macro get_quoted_csv(column_names) %}\n\n    {% set quoted = [] %}\n    {% for col in column_names -%}\n        {%- do quoted.append(adapter.quote(col)) -%}\n    {%- endfor %}\n\n    {%- set dest_cols_csv = quoted | join(', ') -%}\n    {{ return(dest_cols_csv) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.678078, "supported_languages": null}, "macro.dbt.diff_columns": {"name": "diff_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.diff_columns", "macro_sql": "{% macro diff_columns(source_columns, target_columns) %}\n\n  {% set result = [] %}\n  {% set source_names = source_columns | map(attribute = 'column') | list %}\n  {% set target_names = target_columns | map(attribute = 'column') | list %}\n\n   {# --check whether the name attribute exists in the target - this does not perform a data type check #}\n   {% for sc in source_columns %}\n     {% if sc.name not in target_names %}\n        {{ result.append(sc) }}\n     {% endif %}\n   {% endfor %}\n\n  {{ return(result) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.678653, "supported_languages": null}, "macro.dbt.diff_column_data_types": {"name": "diff_column_data_types", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.diff_column_data_types", "macro_sql": "{% macro diff_column_data_types(source_columns, target_columns) %}\n\n  {% set result = [] %}\n  {% for sc in source_columns %}\n    {% set tc = target_columns | selectattr(\"name\", \"equalto\", sc.name) | list | first %}\n    {% if tc %}\n      {% if sc.data_type != tc.data_type and not sc.can_expand_to(other_column=tc) %}\n        {{ result.append( { 'column_name': tc.name, 'new_type': sc.data_type } ) }}\n      {% endif %}\n    {% endif %}\n  {% endfor %}\n\n  {{ return(result) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.679353, "supported_languages": null}, "macro.dbt.get_merge_update_columns": {"name": "get_merge_update_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.get_merge_update_columns", "macro_sql": "{% macro get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) %}\n  {{ return(adapter.dispatch('get_merge_update_columns', 'dbt')(merge_update_columns, merge_exclude_columns, dest_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_merge_update_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.679599, "supported_languages": null}, "macro.dbt.default__get_merge_update_columns": {"name": "default__get_merge_update_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.default__get_merge_update_columns", "macro_sql": "{% macro default__get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) %}\n  {%- set default_cols = dest_columns | map(attribute=\"quoted\") | list -%}\n\n  {%- if merge_update_columns and merge_exclude_columns -%}\n    {{ exceptions.raise_compiler_error(\n        'Model cannot specify merge_update_columns and merge_exclude_columns. Please update model to use only one config'\n    )}}\n  {%- elif merge_update_columns -%}\n    {%- set update_columns = merge_update_columns -%}\n  {%- elif merge_exclude_columns -%}\n    {%- set update_columns = [] -%}\n    {%- for column in dest_columns -%}\n      {% if column.column | lower not in merge_exclude_columns | map(\"lower\") | list %}\n        {%- do update_columns.append(column.quoted) -%}\n      {% endif %}\n    {%- endfor -%}\n  {%- else -%}\n    {%- set update_columns = default_cols -%}\n  {%- endif -%}\n\n  {{ return(update_columns) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.680356, "supported_languages": null}, "macro.dbt.get_merge_sql": {"name": "get_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_merge_sql", "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, incremental_predicates=none) -%}\n   -- back compat for old kwarg name\n  {% set incremental_predicates = kwargs.get('predicates', incremental_predicates) %}\n  {{ adapter.dispatch('get_merge_sql', 'dbt')(target, source, unique_key, dest_columns, incremental_predicates) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6868658, "supported_languages": null}, "macro.dbt.default__get_merge_sql": {"name": "default__get_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_merge_sql", "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, incremental_predicates=none) -%}\n    {%- set predicates = [] if incremental_predicates is none else [] + incremental_predicates -%}\n    {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n    {%- set merge_update_columns = config.get('merge_update_columns') -%}\n    {%- set merge_exclude_columns = config.get('merge_exclude_columns') -%}\n    {%- set update_columns = get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) -%}\n    {%- set sql_header = config.get('sql_header', none) -%}\n\n    {% if unique_key %}\n        {% if unique_key is sequence and unique_key is not mapping and unique_key is not string %}\n            {% for key in unique_key %}\n                {% set this_key_match %}\n                    DBT_INTERNAL_SOURCE.{{ key }} = DBT_INTERNAL_DEST.{{ key }}\n                {% endset %}\n                {% do predicates.append(this_key_match) %}\n            {% endfor %}\n        {% else %}\n            {% set unique_key_match %}\n                DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }}\n            {% endset %}\n            {% do predicates.append(unique_key_match) %}\n        {% endif %}\n    {% else %}\n        {% do predicates.append('FALSE') %}\n    {% endif %}\n\n    {{ sql_header if sql_header is not none }}\n\n    merge into {{ target }} as DBT_INTERNAL_DEST\n        using {{ source }} as DBT_INTERNAL_SOURCE\n        on {{\"(\" ~ predicates | join(\") and (\") ~ \")\"}}\n\n    {% if unique_key %}\n    when matched then update set\n        {% for column_name in update_columns -%}\n            {{ column_name }} = DBT_INTERNAL_SOURCE.{{ column_name }}\n            {%- if not loop.last %}, {%- endif %}\n        {%- endfor %}\n    {% endif %}\n\n    when not matched then insert\n        ({{ dest_cols_csv }})\n    values\n        ({{ dest_cols_csv }})\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv", "macro.dbt.get_merge_update_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.688545, "supported_languages": null}, "macro.dbt.get_delete_insert_merge_sql": {"name": "get_delete_insert_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_delete_insert_merge_sql", "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) -%}\n  {{ adapter.dispatch('get_delete_insert_merge_sql', 'dbt')(target, source, unique_key, dest_columns, incremental_predicates) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.688819, "supported_languages": null}, "macro.dbt.default__get_delete_insert_merge_sql": {"name": "default__get_delete_insert_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_delete_insert_merge_sql", "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) -%}\n\n    {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n    {% if unique_key %}\n        {% if unique_key is sequence and unique_key is not string %}\n            delete from {{target }}\n            using {{ source }}\n            where (\n                {% for key in unique_key %}\n                    {{ source }}.{{ key }} = {{ target }}.{{ key }}\n                    {{ \"and \" if not loop.last}}\n                {% endfor %}\n                {% if incremental_predicates %}\n                    {% for predicate in incremental_predicates %}\n                        and {{ predicate }}\n                    {% endfor %}\n                {% endif %}\n            );\n        {% else %}\n            delete from {{ target }}\n            where (\n                {{ unique_key }}) in (\n                select ({{ unique_key }})\n                from {{ source }}\n            )\n            {%- if incremental_predicates %}\n                {% for predicate in incremental_predicates %}\n                    and {{ predicate }}\n                {% endfor %}\n            {%- endif -%};\n\n        {% endif %}\n    {% endif %}\n\n    insert into {{ target }} ({{ dest_cols_csv }})\n    (\n        select {{ dest_cols_csv }}\n        from {{ source }}\n    )\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.689877, "supported_languages": null}, "macro.dbt.get_insert_overwrite_merge_sql": {"name": "get_insert_overwrite_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_insert_overwrite_merge_sql", "macro_sql": "{% macro get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header=false) -%}\n  {{ adapter.dispatch('get_insert_overwrite_merge_sql', 'dbt')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.690163, "supported_languages": null}, "macro.dbt.default__get_insert_overwrite_merge_sql": {"name": "default__get_insert_overwrite_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n    {#-- The only time include_sql_header is True: --#}\n    {#-- BigQuery + insert_overwrite strategy + \"static\" partitions config --#}\n    {#-- We should consider including the sql header at the materialization level instead --#}\n\n    {%- set predicates = [] if predicates is none else [] + predicates -%}\n    {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n    {%- set sql_header = config.get('sql_header', none) -%}\n\n    {{ sql_header if sql_header is not none and include_sql_header }}\n\n    merge into {{ target }} as DBT_INTERNAL_DEST\n        using {{ source }} as DBT_INTERNAL_SOURCE\n        on FALSE\n\n    when not matched by source\n        {% if predicates %} and {{ predicates | join(' and ') }} {% endif %}\n        then delete\n\n    when not matched then insert\n        ({{ dest_cols_csv }})\n    values\n        ({{ dest_cols_csv }})\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.690848, "supported_languages": null}, "macro.dbt.is_incremental": {"name": "is_incremental", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/is_incremental.sql", "original_file_path": "macros/materializations/models/incremental/is_incremental.sql", "unique_id": "macro.dbt.is_incremental", "macro_sql": "{% macro is_incremental() %}\n    {#-- do not run introspective queries in parsing #}\n    {% if not execute %}\n        {{ return(False) }}\n    {% else %}\n        {% set relation = adapter.get_relation(this.database, this.schema, this.table) %}\n        {{ return(relation is not none\n                  and relation.type == 'table'\n                  and model.config.materialized == 'incremental'\n                  and not should_full_refresh()) }}\n    {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.691502, "supported_languages": null}, "macro.dbt.get_incremental_append_sql": {"name": "get_incremental_append_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_append_sql", "macro_sql": "{% macro get_incremental_append_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_append_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_append_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.692418, "supported_languages": null}, "macro.dbt.default__get_incremental_append_sql": {"name": "default__get_incremental_append_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_append_sql", "macro_sql": "{% macro default__get_incremental_append_sql(arg_dict) %}\n\n  {% do return(get_insert_into_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"dest_columns\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_insert_into_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.692668, "supported_languages": null}, "macro.dbt.get_incremental_delete_insert_sql": {"name": "get_incremental_delete_insert_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_delete_insert_sql", "macro_sql": "{% macro get_incremental_delete_insert_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_delete_insert_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_delete_insert_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.692873, "supported_languages": null}, "macro.dbt.default__get_incremental_delete_insert_sql": {"name": "default__get_incremental_delete_insert_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_delete_insert_sql", "macro_sql": "{% macro default__get_incremental_delete_insert_sql(arg_dict) %}\n\n  {% do return(get_delete_insert_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"unique_key\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.693186, "supported_languages": null}, "macro.dbt.get_incremental_merge_sql": {"name": "get_incremental_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_merge_sql", "macro_sql": "{% macro get_incremental_merge_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_merge_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6934478, "supported_languages": null}, "macro.dbt.default__get_incremental_merge_sql": {"name": "default__get_incremental_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_merge_sql", "macro_sql": "{% macro default__get_incremental_merge_sql(arg_dict) %}\n\n  {% do return(get_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"unique_key\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.6937659, "supported_languages": null}, "macro.dbt.get_incremental_insert_overwrite_sql": {"name": "get_incremental_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_insert_overwrite_sql", "macro_sql": "{% macro get_incremental_insert_overwrite_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_insert_overwrite_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_insert_overwrite_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.693961, "supported_languages": null}, "macro.dbt.default__get_incremental_insert_overwrite_sql": {"name": "default__get_incremental_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_insert_overwrite_sql", "macro_sql": "{% macro default__get_incremental_insert_overwrite_sql(arg_dict) %}\n\n  {% do return(get_insert_overwrite_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.694239, "supported_languages": null}, "macro.dbt.get_incremental_default_sql": {"name": "get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_default_sql", "macro_sql": "{% macro get_incremental_default_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_default_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_default_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.694433, "supported_languages": null}, "macro.dbt.default__get_incremental_default_sql": {"name": "default__get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_default_sql", "macro_sql": "{% macro default__get_incremental_default_sql(arg_dict) %}\n\n  {% do return(get_incremental_append_sql(arg_dict)) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_incremental_append_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.694592, "supported_languages": null}, "macro.dbt.get_insert_into_sql": {"name": "get_insert_into_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_insert_into_sql", "macro_sql": "{% macro get_insert_into_sql(target_relation, temp_relation, dest_columns) %}\n\n    {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n    insert into {{ target_relation }} ({{ dest_cols_csv }})\n    (\n        select {{ dest_cols_csv }}\n        from {{ temp_relation }}\n    )\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.694876, "supported_languages": null}, "macro.dbt.materialization_incremental_default": {"name": "materialization_incremental_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/incremental.sql", "original_file_path": "macros/materializations/models/incremental/incremental.sql", "unique_id": "macro.dbt.materialization_incremental_default", "macro_sql": "{% materialization incremental, default -%}\n\n  -- relations\n  {%- set existing_relation = load_cached_relation(this) -%}\n  {%- set target_relation = this.incorporate(type='table') -%}\n  {%- set temp_relation = make_temp_relation(target_relation)-%}\n  {%- set intermediate_relation = make_intermediate_relation(target_relation)-%}\n  {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n  {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n\n  -- configs\n  {%- set unique_key = config.get('unique_key') -%}\n  {%- set full_refresh_mode = (should_full_refresh()  or existing_relation.is_view) -%}\n  {%- set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') -%}\n\n  -- the temp_ and backup_ relations should not already exist in the database; get_relation\n  -- will return None in that case. Otherwise, we get a relation that we can drop\n  -- later, before we try to use this name for the current operation. This has to happen before\n  -- BEGIN, in a separate transaction\n  {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation)-%}\n  {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n   -- grab current tables grants config for comparision later on\n  {% set grant_config = config.get('grants') %}\n  {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n  {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  -- `BEGIN` happens here:\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  {% set to_drop = [] %}\n\n  {% if existing_relation is none %}\n      {% set build_sql = get_create_table_as_sql(False, target_relation, sql) %}\n  {% elif full_refresh_mode %}\n      {% set build_sql = get_create_table_as_sql(False, intermediate_relation, sql) %}\n      {% set need_swap = true %}\n  {% else %}\n    {% do run_query(get_create_table_as_sql(True, temp_relation, sql)) %}\n    {% do adapter.expand_target_column_types(\n             from_relation=temp_relation,\n             to_relation=target_relation) %}\n    {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n    {% set dest_columns = process_schema_changes(on_schema_change, temp_relation, existing_relation) %}\n    {% if not dest_columns %}\n      {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n    {% endif %}\n\n    {#-- Get the incremental_strategy, the macro to use for the strategy, and build the sql --#}\n    {% set incremental_strategy = config.get('incremental_strategy') or 'default' %}\n    {% set incremental_predicates = config.get('predicates', none) or config.get('incremental_predicates', none) %}\n    {% set strategy_sql_macro_func = adapter.get_incremental_strategy_macro(context, incremental_strategy) %}\n    {% set strategy_arg_dict = ({'target_relation': target_relation, 'temp_relation': temp_relation, 'unique_key': unique_key, 'dest_columns': dest_columns, 'incremental_predicates': incremental_predicates }) %}\n    {% set build_sql = strategy_sql_macro_func(strategy_arg_dict) %}\n\n  {% endif %}\n\n  {% call statement(\"main\") %}\n      {{ build_sql }}\n  {% endcall %}\n\n  {% if need_swap %}\n      {% do adapter.rename_relation(target_relation, backup_relation) %}\n      {% do adapter.rename_relation(intermediate_relation, target_relation) %}\n      {% do to_drop.append(backup_relation) %}\n  {% endif %}\n\n  {% set should_revoke = should_revoke(existing_relation, full_refresh_mode) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {% if existing_relation is none or existing_relation.is_view or should_full_refresh() %}\n    {% do create_indexes(target_relation) %}\n  {% endif %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  -- `COMMIT` happens here\n  {% do adapter.commit() %}\n\n  {% for rel in to_drop %}\n      {% do adapter.drop_relation(rel) %}\n  {% endfor %}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_temp_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.should_full_refresh", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.get_create_table_as_sql", "macro.dbt.run_query", "macro.dbt.process_schema_changes", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.700059, "supported_languages": ["sql"]}, "macro.dbt.incremental_validate_on_schema_change": {"name": "incremental_validate_on_schema_change", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.incremental_validate_on_schema_change", "macro_sql": "{% macro incremental_validate_on_schema_change(on_schema_change, default='ignore') %}\n\n   {% if on_schema_change not in ['sync_all_columns', 'append_new_columns', 'fail', 'ignore'] %}\n\n     {% set log_message = 'Invalid value for on_schema_change (%s) specified. Setting default value of %s.' % (on_schema_change, default) %}\n     {% do log(log_message) %}\n\n     {{ return(default) }}\n\n   {% else %}\n\n     {{ return(on_schema_change) }}\n\n   {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7057128, "supported_languages": null}, "macro.dbt.check_for_schema_changes": {"name": "check_for_schema_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.check_for_schema_changes", "macro_sql": "{% macro check_for_schema_changes(source_relation, target_relation) %}\n\n  {% set schema_changed = False %}\n\n  {%- set source_columns = adapter.get_columns_in_relation(source_relation) -%}\n  {%- set target_columns = adapter.get_columns_in_relation(target_relation) -%}\n  {%- set source_not_in_target = diff_columns(source_columns, target_columns) -%}\n  {%- set target_not_in_source = diff_columns(target_columns, source_columns) -%}\n\n  {% set new_target_types = diff_column_data_types(source_columns, target_columns) %}\n\n  {% if source_not_in_target != [] %}\n    {% set schema_changed = True %}\n  {% elif target_not_in_source != [] or new_target_types != [] %}\n    {% set schema_changed = True %}\n  {% elif new_target_types != [] %}\n    {% set schema_changed = True %}\n  {% endif %}\n\n  {% set changes_dict = {\n    'schema_changed': schema_changed,\n    'source_not_in_target': source_not_in_target,\n    'target_not_in_source': target_not_in_source,\n    'source_columns': source_columns,\n    'target_columns': target_columns,\n    'new_target_types': new_target_types\n  } %}\n\n  {% set msg %}\n    In {{ target_relation }}:\n        Schema changed: {{ schema_changed }}\n        Source columns not in target: {{ source_not_in_target }}\n        Target columns not in source: {{ target_not_in_source }}\n        New column types: {{ new_target_types }}\n  {% endset %}\n\n  {% do log(msg) %}\n\n  {{ return(changes_dict) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.diff_columns", "macro.dbt.diff_column_data_types"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7069938, "supported_languages": null}, "macro.dbt.sync_column_schemas": {"name": "sync_column_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.sync_column_schemas", "macro_sql": "{% macro sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n\n  {%- set add_to_target_arr = schema_changes_dict['source_not_in_target'] -%}\n\n  {%- if on_schema_change == 'append_new_columns'-%}\n     {%- if add_to_target_arr | length > 0 -%}\n       {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, none) -%}\n     {%- endif -%}\n\n  {% elif on_schema_change == 'sync_all_columns' %}\n     {%- set remove_from_target_arr = schema_changes_dict['target_not_in_source'] -%}\n     {%- set new_target_types = schema_changes_dict['new_target_types'] -%}\n\n     {% if add_to_target_arr | length > 0 or remove_from_target_arr | length > 0 %}\n       {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, remove_from_target_arr) -%}\n     {% endif %}\n\n     {% if new_target_types != [] %}\n       {% for ntt in new_target_types %}\n         {% set column_name = ntt['column_name'] %}\n         {% set new_type = ntt['new_type'] %}\n         {% do alter_column_type(target_relation, column_name, new_type) %}\n       {% endfor %}\n     {% endif %}\n\n  {% endif %}\n\n  {% set schema_change_message %}\n    In {{ target_relation }}:\n        Schema change approach: {{ on_schema_change }}\n        Columns added: {{ add_to_target_arr }}\n        Columns removed: {{ remove_from_target_arr }}\n        Data types changed: {{ new_target_types }}\n  {% endset %}\n\n  {% do log(schema_change_message) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.alter_relation_add_remove_columns", "macro.dbt.alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.708253, "supported_languages": null}, "macro.dbt.process_schema_changes": {"name": "process_schema_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.process_schema_changes", "macro_sql": "{% macro process_schema_changes(on_schema_change, source_relation, target_relation) %}\n\n    {% if on_schema_change == 'ignore' %}\n\n     {{ return({}) }}\n\n    {% else %}\n\n      {% set schema_changes_dict = check_for_schema_changes(source_relation, target_relation) %}\n\n      {% if schema_changes_dict['schema_changed'] %}\n\n        {% if on_schema_change == 'fail' %}\n\n          {% set fail_msg %}\n              The source and target schemas on this incremental model are out of sync!\n              They can be reconciled in several ways:\n                - set the `on_schema_change` config to either append_new_columns or sync_all_columns, depending on your situation.\n                - Re-run the incremental model with `full_refresh: True` to update the target schema.\n                - update the schema manually and re-run the process.\n\n              Additional troubleshooting context:\n                 Source columns not in target: {{ schema_changes_dict['source_not_in_target'] }}\n                 Target columns not in source: {{ schema_changes_dict['target_not_in_source'] }}\n                 New column types: {{ schema_changes_dict['new_target_types'] }}\n          {% endset %}\n\n          {% do exceptions.raise_compiler_error(fail_msg) %}\n\n        {# -- unless we ignore, run the sync operation per the config #}\n        {% else %}\n\n          {% do sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n\n        {% endif %}\n\n      {% endif %}\n\n      {{ return(schema_changes_dict['source_columns']) }}\n\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.check_for_schema_changes", "macro.dbt.sync_column_schemas"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7091498, "supported_languages": null}, "macro.dbt.can_clone_table": {"name": "can_clone_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/can_clone_table.sql", "original_file_path": "macros/materializations/models/clone/can_clone_table.sql", "unique_id": "macro.dbt.can_clone_table", "macro_sql": "{% macro can_clone_table() %}\n    {{ return(adapter.dispatch('can_clone_table', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__can_clone_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7094011, "supported_languages": null}, "macro.dbt.default__can_clone_table": {"name": "default__can_clone_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/can_clone_table.sql", "original_file_path": "macros/materializations/models/clone/can_clone_table.sql", "unique_id": "macro.dbt.default__can_clone_table", "macro_sql": "{% macro default__can_clone_table() %}\n    {{ return(False) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.709526, "supported_languages": null}, "macro.dbt.create_or_replace_clone": {"name": "create_or_replace_clone", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/create_or_replace_clone.sql", "original_file_path": "macros/materializations/models/clone/create_or_replace_clone.sql", "unique_id": "macro.dbt.create_or_replace_clone", "macro_sql": "{% macro create_or_replace_clone(this_relation, defer_relation) %}\n    {{ return(adapter.dispatch('create_or_replace_clone', 'dbt')(this_relation, defer_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_or_replace_clone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7098281, "supported_languages": null}, "macro.dbt.default__create_or_replace_clone": {"name": "default__create_or_replace_clone", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/create_or_replace_clone.sql", "original_file_path": "macros/materializations/models/clone/create_or_replace_clone.sql", "unique_id": "macro.dbt.default__create_or_replace_clone", "macro_sql": "{% macro default__create_or_replace_clone(this_relation, defer_relation) %}\n    create or replace table {{ this_relation }} clone {{ defer_relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.709984, "supported_languages": null}, "macro.dbt.materialization_clone_default": {"name": "materialization_clone_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/clone.sql", "original_file_path": "macros/materializations/models/clone/clone.sql", "unique_id": "macro.dbt.materialization_clone_default", "macro_sql": "{%- materialization clone, default -%}\n\n  {%- set relations = {'relations': []} -%}\n\n  {%- if not defer_relation -%}\n      -- nothing to do\n      {{ log(\"No relation found in state manifest for \" ~ model.unique_id, info=True) }}\n      {{ return(relations) }}\n  {%- endif -%}\n\n  {%- set existing_relation = load_cached_relation(this) -%}\n\n  {%- if existing_relation and not flags.FULL_REFRESH -%}\n      -- noop!\n      {{ log(\"Relation \" ~ existing_relation ~ \" already exists\", info=True) }}\n      {{ return(relations) }}\n  {%- endif -%}\n\n  {%- set other_existing_relation = load_cached_relation(defer_relation) -%}\n\n  -- If this is a database that can do zero-copy cloning of tables, and the other relation is a table, then this will be a table\n  -- Otherwise, this will be a view\n\n  {% set can_clone_table = can_clone_table() %}\n\n  {%- if other_existing_relation and other_existing_relation.type == 'table' and can_clone_table -%}\n\n      {%- set target_relation = this.incorporate(type='table') -%}\n      {% if existing_relation is not none and not existing_relation.is_table %}\n        {{ log(\"Dropping relation \" ~ existing_relation ~ \" because it is of type \" ~ existing_relation.type) }}\n        {{ drop_relation_if_exists(existing_relation) }}\n      {% endif %}\n\n      -- as a general rule, data platforms that can clone tables can also do atomic 'create or replace'\n      {% call statement('main') %}\n          {% if target_relation and defer_relation and target_relation == defer_relation %}\n              {{ log(\"Target relation and defer relation are the same, skipping clone for relation: \" ~ target_relation) }}\n          {% else %}\n              {{ create_or_replace_clone(target_relation, defer_relation) }}\n          {% endif %}\n\n      {% endcall %}\n\n      {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n      {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n      {% do persist_docs(target_relation, model) %}\n\n      {{ return({'relations': [target_relation]}) }}\n\n  {%- else -%}\n\n      {%- set target_relation = this.incorporate(type='view') -%}\n\n      -- reuse the view materialization\n      -- TODO: support actual dispatch for materialization macros\n      -- Tracking ticket: https://github.com/dbt-labs/dbt-core/issues/7799\n      {% set search_name = \"materialization_view_\" ~ adapter.type() %}\n      {% if not search_name in context %}\n          {% set search_name = \"materialization_view_default\" %}\n      {% endif %}\n      {% set materialization_macro = context[search_name] %}\n      {% set relations = materialization_macro() %}\n      {{ return(relations) }}\n\n  {%- endif -%}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.can_clone_table", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_or_replace_clone", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.713762, "supported_languages": ["sql"]}, "macro.dbt.materialization_seed_default": {"name": "materialization_seed_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/seed.sql", "original_file_path": "macros/materializations/seeds/seed.sql", "unique_id": "macro.dbt.materialization_seed_default", "macro_sql": "{% materialization seed, default %}\n\n  {%- set identifier = model['alias'] -%}\n  {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n  {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n  {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n  {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n  {%- set grant_config = config.get('grants') -%}\n  {%- set agate_table = load_agate_table() -%}\n  -- grab current tables grants config for comparison later on\n\n  {%- do store_result('agate_table', response='OK', agate_table=agate_table) -%}\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  -- `BEGIN` happens here:\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  -- build model\n  {% set create_table_sql = \"\" %}\n  {% if exists_as_view %}\n    {{ exceptions.raise_compiler_error(\"Cannot seed to '{}', it is a view\".format(old_relation)) }}\n  {% elif exists_as_table %}\n    {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %}\n  {% else %}\n    {% set create_table_sql = create_csv_table(model, agate_table) %}\n  {% endif %}\n\n  {% set code = 'CREATE' if full_refresh_mode else 'INSERT' %}\n  {% set rows_affected = (agate_table.rows | length) %}\n  {% set sql = load_csv_rows(model, agate_table) %}\n\n  {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %}\n    {{ get_csv_sql(create_table_sql, sql) }};\n  {% endcall %}\n\n  {% set target_relation = this.incorporate(type='table') %}\n\n  {% set should_revoke = should_revoke(old_relation, full_refresh_mode) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {% if full_refresh_mode or not exists_as_table %}\n    {% do create_indexes(target_relation) %}\n  {% endif %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  -- `COMMIT` happens here\n  {{ adapter.commit() }}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.run_hooks", "macro.dbt.reset_csv_table", "macro.dbt.create_csv_table", "macro.dbt.load_csv_rows", "macro.dbt.noop_statement", "macro.dbt.get_csv_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7171142, "supported_languages": ["sql"]}, "macro.dbt.create_csv_table": {"name": "create_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n  {{ adapter.dispatch('create_csv_table', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.722346, "supported_languages": null}, "macro.dbt.default__create_csv_table": {"name": "default__create_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__create_csv_table", "macro_sql": "{% macro default__create_csv_table(model, agate_table) %}\n  {%- set column_override = model['config'].get('column_types', {}) -%}\n  {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n\n  {% set sql %}\n    create table {{ this.render() }} (\n        {%- for col_name in agate_table.column_names -%}\n            {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}\n            {%- set type = column_override.get(col_name, inferred_type) -%}\n            {%- set column_name = (col_name | string) -%}\n            {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%}\n        {%- endfor -%}\n    )\n  {% endset %}\n\n  {% call statement('_') -%}\n    {{ sql }}\n  {%- endcall %}\n\n  {{ return(sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.723286, "supported_languages": null}, "macro.dbt.reset_csv_table": {"name": "reset_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n  {{ adapter.dispatch('reset_csv_table', 'dbt')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__reset_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7235332, "supported_languages": null}, "macro.dbt.default__reset_csv_table": {"name": "default__reset_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__reset_csv_table", "macro_sql": "{% macro default__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n    {% set sql = \"\" %}\n    {% if full_refresh %}\n        {{ adapter.drop_relation(old_relation) }}\n        {% set sql = create_csv_table(model, agate_table) %}\n    {% else %}\n        {{ adapter.truncate_relation(old_relation) }}\n        {% set sql = \"truncate table \" ~ old_relation %}\n    {% endif %}\n\n    {{ return(sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.72403, "supported_languages": null}, "macro.dbt.get_csv_sql": {"name": "get_csv_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_csv_sql", "macro_sql": "{% macro get_csv_sql(create_or_truncate_sql, insert_sql) %}\n    {{ adapter.dispatch('get_csv_sql', 'dbt')(create_or_truncate_sql, insert_sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_csv_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7242281, "supported_languages": null}, "macro.dbt.default__get_csv_sql": {"name": "default__get_csv_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_csv_sql", "macro_sql": "{% macro default__get_csv_sql(create_or_truncate_sql, insert_sql) %}\n    {{ create_or_truncate_sql }};\n    -- dbt seed --\n    {{ insert_sql }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7243679, "supported_languages": null}, "macro.dbt.get_binding_char": {"name": "get_binding_char", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_binding_char", "macro_sql": "{% macro get_binding_char() -%}\n  {{ adapter.dispatch('get_binding_char', 'dbt')() }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.724512, "supported_languages": null}, "macro.dbt.default__get_binding_char": {"name": "default__get_binding_char", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_binding_char", "macro_sql": "{% macro default__get_binding_char() %}\n  {{ return('%s') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.724631, "supported_languages": null}, "macro.dbt.get_batch_size": {"name": "get_batch_size", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_batch_size", "macro_sql": "{% macro get_batch_size() -%}\n  {{ return(adapter.dispatch('get_batch_size', 'dbt')()) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_batch_size"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.724801, "supported_languages": null}, "macro.dbt.default__get_batch_size": {"name": "default__get_batch_size", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_batch_size", "macro_sql": "{% macro default__get_batch_size() %}\n  {{ return(10000) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.72492, "supported_languages": null}, "macro.dbt.get_seed_column_quoted_csv": {"name": "get_seed_column_quoted_csv", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_seed_column_quoted_csv", "macro_sql": "{% macro get_seed_column_quoted_csv(model, column_names) %}\n  {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n    {% set quoted = [] %}\n    {% for col in column_names -%}\n        {%- do quoted.append(adapter.quote_seed_column(col, quote_seed_column)) -%}\n    {%- endfor %}\n\n    {%- set dest_cols_csv = quoted | join(', ') -%}\n    {{ return(dest_cols_csv) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.725416, "supported_languages": null}, "macro.dbt.load_csv_rows": {"name": "load_csv_rows", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n  {{ adapter.dispatch('load_csv_rows', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7256079, "supported_languages": null}, "macro.dbt.default__load_csv_rows": {"name": "default__load_csv_rows", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__load_csv_rows", "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n\n  {% set batch_size = get_batch_size() %}\n\n  {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n  {% set bindings = [] %}\n\n  {% set statements = [] %}\n\n  {% for chunk in agate_table.rows | batch(batch_size) %}\n      {% set bindings = [] %}\n\n      {% for row in chunk %}\n          {% do bindings.extend(row) %}\n      {% endfor %}\n\n      {% set sql %}\n          insert into {{ this.render() }} ({{ cols_sql }}) values\n          {% for row in chunk -%}\n              ({%- for column in agate_table.column_names -%}\n                  {{ get_binding_char() }}\n                  {%- if not loop.last%},{%- endif %}\n              {%- endfor -%})\n              {%- if not loop.last%},{%- endif %}\n          {%- endfor %}\n      {% endset %}\n\n      {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n\n      {% if loop.index0 == 0 %}\n          {% do statements.append(sql) %}\n      {% endif %}\n  {% endfor %}\n\n  {# Return SQL so we can render it out into the compiled files #}\n  {{ return(statements[0]) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv", "macro.dbt.get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.726944, "supported_languages": null}, "macro.dbt.generate_alias_name": {"name": "generate_alias_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "unique_id": "macro.dbt.generate_alias_name", "macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n    {% do return(adapter.dispatch('generate_alias_name', 'dbt')(custom_alias_name, node)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_alias_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.727385, "supported_languages": null}, "macro.dbt.default__generate_alias_name": {"name": "default__generate_alias_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "unique_id": "macro.dbt.default__generate_alias_name", "macro_sql": "{% macro default__generate_alias_name(custom_alias_name=none, node=none) -%}\n\n    {%- if custom_alias_name -%}\n\n        {{ custom_alias_name | trim }}\n\n    {%- elif node.version -%}\n\n        {{ return(node.name ~ \"_v\" ~ (node.version | replace(\".\", \"_\"))) }}\n\n    {%- else -%}\n\n        {{ node.name }}\n\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7277792, "supported_languages": null}, "macro.dbt.generate_schema_name": {"name": "generate_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name=none, node=none) -%}\n    {{ return(adapter.dispatch('generate_schema_name', 'dbt')(custom_schema_name, node)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.72831, "supported_languages": null}, "macro.dbt.default__generate_schema_name": {"name": "default__generate_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.default__generate_schema_name", "macro_sql": "{% macro default__generate_schema_name(custom_schema_name, node) -%}\n\n    {%- set default_schema = target.schema -%}\n    {%- if custom_schema_name is none -%}\n\n        {{ default_schema }}\n\n    {%- else -%}\n\n        {{ default_schema }}_{{ custom_schema_name | trim }}\n\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.728582, "supported_languages": null}, "macro.dbt.generate_schema_name_for_env": {"name": "generate_schema_name_for_env", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.generate_schema_name_for_env", "macro_sql": "{% macro generate_schema_name_for_env(custom_schema_name, node) -%}\n\n    {%- set default_schema = target.schema -%}\n    {%- if target.name == 'prod' and custom_schema_name is not none -%}\n\n        {{ custom_schema_name | trim }}\n\n    {%- else -%}\n\n        {{ default_schema }}\n\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7288792, "supported_languages": null}, "macro.dbt.generate_database_name": {"name": "generate_database_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "unique_id": "macro.dbt.generate_database_name", "macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n    {% do return(adapter.dispatch('generate_database_name', 'dbt')(custom_database_name, node)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.729283, "supported_languages": null}, "macro.dbt.default__generate_database_name": {"name": "default__generate_database_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "unique_id": "macro.dbt.default__generate_database_name", "macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n    {%- set default_database = target.database -%}\n    {%- if custom_database_name is none -%}\n\n        {{ default_database }}\n\n    {%- else -%}\n\n        {{ custom_database_name }}\n\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.729547, "supported_languages": null}, "macro.dbt.get_drop_sql": {"name": "get_drop_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.get_drop_sql", "macro_sql": "{%- macro get_drop_sql(relation) -%}\n    {{- log('Applying DROP to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_drop_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.73029, "supported_languages": null}, "macro.dbt.default__get_drop_sql": {"name": "default__get_drop_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.default__get_drop_sql", "macro_sql": "{%- macro default__get_drop_sql(relation) -%}\n\n    {%- if relation.is_view -%}\n        {{ drop_view(relation) }}\n\n    {%- elif relation.is_table -%}\n        {{ drop_table(relation) }}\n\n    {%- elif relation.is_materialized_view -%}\n        {{ drop_materialized_view(relation) }}\n\n    {%- else -%}\n        drop {{ relation.type }} if exists {{ relation }} cascade\n\n    {%- endif -%}\n\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.drop_view", "macro.dbt.drop_table", "macro.dbt.drop_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.730675, "supported_languages": null}, "macro.dbt.drop_relation": {"name": "drop_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n    {{ return(adapter.dispatch('drop_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.730865, "supported_languages": null}, "macro.dbt.default__drop_relation": {"name": "default__drop_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.default__drop_relation", "macro_sql": "{% macro default__drop_relation(relation) -%}\n    {% call statement('drop_relation', auto_begin=False) -%}\n        {{ get_drop_sql(relation) }}\n    {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.731072, "supported_languages": null}, "macro.dbt.drop_relation_if_exists": {"name": "drop_relation_if_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.drop_relation_if_exists", "macro_sql": "{% macro drop_relation_if_exists(relation) %}\n  {% if relation is not none %}\n    {{ adapter.drop_relation(relation) }}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7312791, "supported_languages": null}, "macro.dbt.get_replace_sql": {"name": "get_replace_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/replace.sql", "original_file_path": "macros/relations/replace.sql", "unique_id": "macro.dbt.get_replace_sql", "macro_sql": "{% macro get_replace_sql(existing_relation, target_relation, sql) %}\n    {{- log('Applying REPLACE to: ' ~ existing_relation) -}}\n    {{- adapter.dispatch('get_replace_sql', 'dbt')(existing_relation, target_relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_replace_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.732065, "supported_languages": null}, "macro.dbt.default__get_replace_sql": {"name": "default__get_replace_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/replace.sql", "original_file_path": "macros/relations/replace.sql", "unique_id": "macro.dbt.default__get_replace_sql", "macro_sql": "{% macro default__get_replace_sql(existing_relation, target_relation, sql) %}\n\n    {# /* use a create or replace statement if possible */ #}\n\n    {% set is_replaceable = existing_relation.type == target_relation_type and existing_relation.can_be_replaced %}\n\n    {% if is_replaceable and existing_relation.is_view %}\n        {{ get_replace_view_sql(target_relation, sql) }}\n\n    {% elif is_replaceable and existing_relation.is_table %}\n        {{ get_replace_table_sql(target_relation, sql) }}\n\n    {% elif is_replaceable and existing_relation.is_materialized_view %}\n        {{ get_replace_materialized_view_sql(target_relation, sql) }}\n\n    {# /* a create or replace statement is not possible, so try to stage and/or backup to be safe */ #}\n\n    {# /* create target_relation as an intermediate relation, then swap it out with the existing one using a backup */ #}\n    {%- elif target_relation.can_be_renamed and existing_relation.can_be_renamed -%}\n        {{ get_create_intermediate_sql(target_relation, sql) }};\n        {{ get_create_backup_sql(existing_relation) }};\n        {{ get_rename_intermediate_sql(target_relation) }};\n        {{ get_drop_backup_sql(existing_relation) }}\n\n    {# /* create target_relation as an intermediate relation, then swap it out with the existing one without using a backup */ #}\n    {%- elif target_relation.can_be_renamed -%}\n        {{ get_create_intermediate_sql(target_relation, sql) }};\n        {{ get_drop_sql(existing_relation) }};\n        {{ get_rename_intermediate_sql(target_relation) }}\n\n    {# /* create target_relation in place by first backing up the existing relation */ #}\n    {%- elif existing_relation.can_be_renamed -%}\n        {{ get_create_backup_sql(existing_relation) }};\n        {{ get_create_sql(target_relation, sql) }};\n        {{ get_drop_backup_sql(existing_relation) }}\n\n    {# /* no renaming is allowed, so just drop and create */ #}\n    {%- else -%}\n        {{ get_drop_sql(existing_relation) }};\n        {{ get_create_sql(target_relation, sql) }}\n\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_replace_view_sql", "macro.dbt.get_replace_table_sql", "macro.dbt.get_replace_materialized_view_sql", "macro.dbt.get_create_intermediate_sql", "macro.dbt.get_create_backup_sql", "macro.dbt.get_rename_intermediate_sql", "macro.dbt.get_drop_backup_sql", "macro.dbt.get_drop_sql", "macro.dbt.get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.733402, "supported_languages": null}, "macro.dbt.get_create_intermediate_sql": {"name": "get_create_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_intermediate.sql", "original_file_path": "macros/relations/create_intermediate.sql", "unique_id": "macro.dbt.get_create_intermediate_sql", "macro_sql": "{%- macro get_create_intermediate_sql(relation, sql) -%}\n    {{- log('Applying CREATE INTERMEDIATE to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_create_intermediate_sql', 'dbt')(relation, sql) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_create_intermediate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.733788, "supported_languages": null}, "macro.dbt.default__get_create_intermediate_sql": {"name": "default__get_create_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_intermediate.sql", "original_file_path": "macros/relations/create_intermediate.sql", "unique_id": "macro.dbt.default__get_create_intermediate_sql", "macro_sql": "{%- macro default__get_create_intermediate_sql(relation, sql) -%}\n\n    -- get the standard intermediate name\n    {% set intermediate_relation = make_intermediate_relation(relation) %}\n\n    -- drop any pre-existing intermediate\n    {{ get_drop_sql(intermediate_relation) }};\n\n    {{ get_create_sql(intermediate_relation, sql) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_intermediate_relation", "macro.dbt.get_drop_sql", "macro.dbt.get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.734047, "supported_languages": null}, "macro.dbt.get_drop_backup_sql": {"name": "get_drop_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop_backup.sql", "original_file_path": "macros/relations/drop_backup.sql", "unique_id": "macro.dbt.get_drop_backup_sql", "macro_sql": "{%- macro get_drop_backup_sql(relation) -%}\n    {{- log('Applying DROP BACKUP to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_drop_backup_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_drop_backup_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7343721, "supported_languages": null}, "macro.dbt.default__get_drop_backup_sql": {"name": "default__get_drop_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop_backup.sql", "original_file_path": "macros/relations/drop_backup.sql", "unique_id": "macro.dbt.default__get_drop_backup_sql", "macro_sql": "{%- macro default__get_drop_backup_sql(relation) -%}\n\n    -- get the standard backup name\n    {% set backup_relation = make_backup_relation(relation, relation.type) %}\n\n    {{ get_drop_sql(backup_relation) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_backup_relation", "macro.dbt.get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7345889, "supported_languages": null}, "macro.dbt.get_rename_sql": {"name": "get_rename_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.get_rename_sql", "macro_sql": "{%- macro get_rename_sql(relation, new_name) -%}\n    {{- log('Applying RENAME to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_rename_sql', 'dbt')(relation, new_name) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.735313, "supported_languages": null}, "macro.dbt.default__get_rename_sql": {"name": "default__get_rename_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.default__get_rename_sql", "macro_sql": "{%- macro default__get_rename_sql(relation, new_name) -%}\n\n    {%- if relation.is_view -%}\n        {{ get_rename_view_sql(relation, new_name) }}\n\n    {%- elif relation.is_table -%}\n        {{ get_rename_table_sql(relation, new_name) }}\n\n    {%- elif relation.is_materialized_view -%}\n        {{ get_rename_materialized_view_sql(relation, new_name) }}\n\n    {%- else -%}\n        {{- exceptions.raise_compiler_error(\"`get_rename_sql` has not been implemented for: \" ~ relation.type ) -}}\n\n    {%- endif -%}\n\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.get_rename_view_sql", "macro.dbt.get_rename_table_sql", "macro.dbt.get_rename_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.735768, "supported_languages": null}, "macro.dbt.rename_relation": {"name": "rename_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n  {{ return(adapter.dispatch('rename_relation', 'dbt')(from_relation, to_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__rename_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.735984, "supported_languages": null}, "macro.dbt.default__rename_relation": {"name": "default__rename_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.default__rename_relation", "macro_sql": "{% macro default__rename_relation(from_relation, to_relation) -%}\n  {% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}\n  {% call statement('rename_relation') -%}\n    alter table {{ from_relation }} rename to {{ target_name }}\n  {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.736277, "supported_languages": null}, "macro.dbt.get_create_backup_sql": {"name": "get_create_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_backup.sql", "original_file_path": "macros/relations/create_backup.sql", "unique_id": "macro.dbt.get_create_backup_sql", "macro_sql": "{%- macro get_create_backup_sql(relation) -%}\n    {{- log('Applying CREATE BACKUP to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_create_backup_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_create_backup_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.736629, "supported_languages": null}, "macro.dbt.default__get_create_backup_sql": {"name": "default__get_create_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_backup.sql", "original_file_path": "macros/relations/create_backup.sql", "unique_id": "macro.dbt.default__get_create_backup_sql", "macro_sql": "{%- macro default__get_create_backup_sql(relation) -%}\n\n    -- get the standard backup name\n    {% set backup_relation = make_backup_relation(relation, relation.type) %}\n\n    -- drop any pre-existing backup\n    {{ get_drop_sql(backup_relation) }};\n\n    {{ get_rename_sql(relation, backup_relation.identifier) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_backup_relation", "macro.dbt.get_drop_sql", "macro.dbt.get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.736911, "supported_languages": null}, "macro.dbt.get_create_sql": {"name": "get_create_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create.sql", "original_file_path": "macros/relations/create.sql", "unique_id": "macro.dbt.get_create_sql", "macro_sql": "{%- macro get_create_sql(relation, sql) -%}\n    {{- log('Applying CREATE to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_create_sql', 'dbt')(relation, sql) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.737396, "supported_languages": null}, "macro.dbt.default__get_create_sql": {"name": "default__get_create_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create.sql", "original_file_path": "macros/relations/create.sql", "unique_id": "macro.dbt.default__get_create_sql", "macro_sql": "{%- macro default__get_create_sql(relation, sql) -%}\n\n    {%- if relation.is_view -%}\n        {{ get_create_view_as_sql(relation, sql) }}\n\n    {%- elif relation.is_table -%}\n        {{ get_create_table_as_sql(False, relation, sql) }}\n\n    {%- elif relation.is_materialized_view -%}\n        {{ get_create_materialized_view_as_sql(relation, sql) }}\n\n    {%- else -%}\n        {{- exceptions.raise_compiler_error(\"`get_create_sql` has not been implemented for: \" ~ relation.type ) -}}\n\n    {%- endif -%}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.get_create_view_as_sql", "macro.dbt.get_create_table_as_sql", "macro.dbt.get_create_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7378602, "supported_languages": null}, "macro.dbt.get_rename_intermediate_sql": {"name": "get_rename_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename_intermediate.sql", "original_file_path": "macros/relations/rename_intermediate.sql", "unique_id": "macro.dbt.get_rename_intermediate_sql", "macro_sql": "{%- macro get_rename_intermediate_sql(relation) -%}\n    {{- log('Applying RENAME INTERMEDIATE to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_rename_intermediate_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_rename_intermediate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.738197, "supported_languages": null}, "macro.dbt.default__get_rename_intermediate_sql": {"name": "default__get_rename_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename_intermediate.sql", "original_file_path": "macros/relations/rename_intermediate.sql", "unique_id": "macro.dbt.default__get_rename_intermediate_sql", "macro_sql": "{%- macro default__get_rename_intermediate_sql(relation) -%}\n\n    -- get the standard intermediate name\n    {% set intermediate_relation = make_intermediate_relation(relation) %}\n\n    {{ get_rename_sql(intermediate_relation, relation.identifier) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_intermediate_relation", "macro.dbt.get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.738411, "supported_languages": null}, "macro.dbt.drop_materialized_view": {"name": "drop_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/drop.sql", "original_file_path": "macros/relations/materialized_view/drop.sql", "unique_id": "macro.dbt.drop_materialized_view", "macro_sql": "{% macro drop_materialized_view(relation) -%}\n    {{ return(adapter.dispatch('drop_materialized_view', 'dbt')(relation)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__drop_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.738679, "supported_languages": null}, "macro.dbt.default__drop_materialized_view": {"name": "default__drop_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/drop.sql", "original_file_path": "macros/relations/materialized_view/drop.sql", "unique_id": "macro.dbt.default__drop_materialized_view", "macro_sql": "{% macro default__drop_materialized_view(relation) -%}\n    drop materialized view if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7387881, "supported_languages": null}, "macro.dbt.get_replace_materialized_view_sql": {"name": "get_replace_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/replace.sql", "original_file_path": "macros/relations/materialized_view/replace.sql", "unique_id": "macro.dbt.get_replace_materialized_view_sql", "macro_sql": "{% macro get_replace_materialized_view_sql(relation, sql) %}\n    {{- adapter.dispatch('get_replace_materialized_view_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_replace_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.73907, "supported_languages": null}, "macro.dbt.default__get_replace_materialized_view_sql": {"name": "default__get_replace_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/replace.sql", "original_file_path": "macros/relations/materialized_view/replace.sql", "unique_id": "macro.dbt.default__get_replace_materialized_view_sql", "macro_sql": "{% macro default__get_replace_materialized_view_sql(relation, sql) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_replace_materialized_view_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.739224, "supported_languages": null}, "macro.dbt.refresh_materialized_view": {"name": "refresh_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/refresh.sql", "original_file_path": "macros/relations/materialized_view/refresh.sql", "unique_id": "macro.dbt.refresh_materialized_view", "macro_sql": "{% macro refresh_materialized_view(relation) %}\n    {{- log('Applying REFRESH to: ' ~ relation) -}}\n    {{- adapter.dispatch('refresh_materialized_view', 'dbt')(relation) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__refresh_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.739541, "supported_languages": null}, "macro.dbt.default__refresh_materialized_view": {"name": "default__refresh_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/refresh.sql", "original_file_path": "macros/relations/materialized_view/refresh.sql", "unique_id": "macro.dbt.default__refresh_materialized_view", "macro_sql": "{% macro default__refresh_materialized_view(relation) %}\n    {{ exceptions.raise_compiler_error(\"`refresh_materialized_view` has not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.739742, "supported_languages": null}, "macro.dbt.get_rename_materialized_view_sql": {"name": "get_rename_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/rename.sql", "original_file_path": "macros/relations/materialized_view/rename.sql", "unique_id": "macro.dbt.get_rename_materialized_view_sql", "macro_sql": "{% macro get_rename_materialized_view_sql(relation, new_name) %}\n    {{- adapter.dispatch('get_rename_materialized_view_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_rename_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7400231, "supported_languages": null}, "macro.dbt.default__get_rename_materialized_view_sql": {"name": "default__get_rename_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/rename.sql", "original_file_path": "macros/relations/materialized_view/rename.sql", "unique_id": "macro.dbt.default__get_rename_materialized_view_sql", "macro_sql": "{% macro default__get_rename_materialized_view_sql(relation, new_name) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_rename_materialized_view_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7401721, "supported_languages": null}, "macro.dbt.get_alter_materialized_view_as_sql": {"name": "get_alter_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.get_alter_materialized_view_as_sql", "macro_sql": "{% macro get_alter_materialized_view_as_sql(\n    relation,\n    configuration_changes,\n    sql,\n    existing_relation,\n    backup_relation,\n    intermediate_relation\n) %}\n    {{- log('Applying ALTER to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_alter_materialized_view_as_sql', 'dbt')(\n        relation,\n        configuration_changes,\n        sql,\n        existing_relation,\n        backup_relation,\n        intermediate_relation\n    ) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_alter_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.740788, "supported_languages": null}, "macro.dbt.default__get_alter_materialized_view_as_sql": {"name": "default__get_alter_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.default__get_alter_materialized_view_as_sql", "macro_sql": "{% macro default__get_alter_materialized_view_as_sql(\n    relation,\n    configuration_changes,\n    sql,\n    existing_relation,\n    backup_relation,\n    intermediate_relation\n) %}\n    {{ exceptions.raise_compiler_error(\"Materialized views have not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.740983, "supported_languages": null}, "macro.dbt.get_materialized_view_configuration_changes": {"name": "get_materialized_view_configuration_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.get_materialized_view_configuration_changes", "macro_sql": "{% macro get_materialized_view_configuration_changes(existing_relation, new_config) %}\n    /* {#\n    It's recommended that configuration changes be formatted as follows:\n    {\"<change_category>\": [{\"action\": \"<name>\", \"context\": ...}]}\n\n    For example:\n    {\n        \"indexes\": [\n            {\"action\": \"drop\", \"context\": \"index_abc\"},\n            {\"action\": \"create\", \"context\": {\"columns\": [\"column_1\", \"column_2\"], \"type\": \"hash\", \"unique\": True}},\n        ],\n    }\n\n    Either way, `get_materialized_view_configuration_changes` needs to align with `get_alter_materialized_view_as_sql`.\n    #} */\n    {{- log('Determining configuration changes on: ' ~ existing_relation) -}}\n    {%- do return(adapter.dispatch('get_materialized_view_configuration_changes', 'dbt')(existing_relation, new_config)) -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_materialized_view_configuration_changes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.741278, "supported_languages": null}, "macro.dbt.default__get_materialized_view_configuration_changes": {"name": "default__get_materialized_view_configuration_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.default__get_materialized_view_configuration_changes", "macro_sql": "{% macro default__get_materialized_view_configuration_changes(existing_relation, new_config) %}\n    {{ exceptions.raise_compiler_error(\"Materialized views have not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.741428, "supported_languages": null}, "macro.dbt.get_create_materialized_view_as_sql": {"name": "get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/create.sql", "original_file_path": "macros/relations/materialized_view/create.sql", "unique_id": "macro.dbt.get_create_materialized_view_as_sql", "macro_sql": "{% macro get_create_materialized_view_as_sql(relation, sql) -%}\n    {{- adapter.dispatch('get_create_materialized_view_as_sql', 'dbt')(relation, sql) -}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_create_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.741705, "supported_languages": null}, "macro.dbt.default__get_create_materialized_view_as_sql": {"name": "default__get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/create.sql", "original_file_path": "macros/relations/materialized_view/create.sql", "unique_id": "macro.dbt.default__get_create_materialized_view_as_sql", "macro_sql": "{% macro default__get_create_materialized_view_as_sql(relation, sql) -%}\n    {{ exceptions.raise_compiler_error(\n        \"`get_create_materialized_view_as_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.741855, "supported_languages": null}, "macro.dbt.get_table_columns_and_constraints": {"name": "get_table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.get_table_columns_and_constraints", "macro_sql": "{%- macro get_table_columns_and_constraints() -%}\n  {{ adapter.dispatch('get_table_columns_and_constraints', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__get_table_columns_and_constraints"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.742883, "supported_languages": null}, "macro.dbt.default__get_table_columns_and_constraints": {"name": "default__get_table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__get_table_columns_and_constraints", "macro_sql": "{% macro default__get_table_columns_and_constraints() -%}\n  {{ return(table_columns_and_constraints()) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.table_columns_and_constraints"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.743011, "supported_languages": null}, "macro.dbt.table_columns_and_constraints": {"name": "table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.table_columns_and_constraints", "macro_sql": "{% macro table_columns_and_constraints() %}\n  {# loop through user_provided_columns to create DDL with data types and constraints #}\n    {%- set raw_column_constraints = adapter.render_raw_columns_constraints(raw_columns=model['columns']) -%}\n    {%- set raw_model_constraints = adapter.render_raw_model_constraints(raw_constraints=model['constraints']) -%}\n    (\n    {% for c in raw_column_constraints -%}\n      {{ c }}{{ \",\" if not loop.last or raw_model_constraints }}\n    {% endfor %}\n    {% for c in raw_model_constraints -%}\n        {{ c }}{{ \",\" if not loop.last }}\n    {% endfor -%}\n    )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.743574, "supported_languages": null}, "macro.dbt.get_assert_columns_equivalent": {"name": "get_assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.get_assert_columns_equivalent", "macro_sql": "\n\n{%- macro get_assert_columns_equivalent(sql) -%}\n  {{ adapter.dispatch('get_assert_columns_equivalent', 'dbt')(sql) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.743744, "supported_languages": null}, "macro.dbt.default__get_assert_columns_equivalent": {"name": "default__get_assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__get_assert_columns_equivalent", "macro_sql": "{% macro default__get_assert_columns_equivalent(sql) -%}\n  {{ return(assert_columns_equivalent(sql)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.743883, "supported_languages": null}, "macro.dbt.assert_columns_equivalent": {"name": "assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.assert_columns_equivalent", "macro_sql": "{% macro assert_columns_equivalent(sql) %}\n\n  {#-- First ensure the user has defined 'columns' in yaml specification --#}\n  {%- set user_defined_columns = model['columns'] -%}\n  {%- if not user_defined_columns -%}\n      {{ exceptions.raise_contract_error([], []) }}\n  {%- endif -%}\n\n  {#-- Obtain the column schema provided by sql file. #}\n  {%- set sql_file_provided_columns = get_column_schema_from_query(sql, config.get('sql_header', none)) -%}\n  {#--Obtain the column schema provided by the schema file by generating an 'empty schema' query from the model's columns. #}\n  {%- set schema_file_provided_columns = get_column_schema_from_query(get_empty_schema_sql(user_defined_columns)) -%}\n\n  {#-- create dictionaries with name and formatted data type and strings for exception #}\n  {%- set sql_columns = format_columns(sql_file_provided_columns) -%}\n  {%- set yaml_columns = format_columns(schema_file_provided_columns)  -%}\n\n  {%- if sql_columns|length != yaml_columns|length -%}\n    {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n  {%- endif -%}\n\n  {%- for sql_col in sql_columns -%}\n    {%- set yaml_col = [] -%}\n    {%- for this_col in yaml_columns -%}\n      {%- if this_col['name'] == sql_col['name'] -%}\n        {%- do yaml_col.append(this_col) -%}\n        {%- break -%}\n      {%- endif -%}\n    {%- endfor -%}\n    {%- if not yaml_col -%}\n      {#-- Column with name not found in yaml #}\n      {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n    {%- endif -%}\n    {%- if sql_col['formatted'] != yaml_col[0]['formatted'] -%}\n      {#-- Column data types don't match #}\n      {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n    {%- endif -%}\n  {%- endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_column_schema_from_query", "macro.dbt.get_empty_schema_sql", "macro.dbt.format_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7452931, "supported_languages": null}, "macro.dbt.format_columns": {"name": "format_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.format_columns", "macro_sql": "{% macro format_columns(columns) %}\n  {% set formatted_columns = [] %}\n  {% for column in columns %}\n    {%- set formatted_column = adapter.dispatch('format_column', 'dbt')(column) -%}\n    {%- do formatted_columns.append(formatted_column) -%}\n  {% endfor %}\n  {{ return(formatted_columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__format_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.745694, "supported_languages": null}, "macro.dbt.default__format_column": {"name": "default__format_column", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__format_column", "macro_sql": "{% macro default__format_column(column) -%}\n  {% set data_type = column.dtype %}\n  {% set formatted = column.column.lower() ~ \" \" ~ data_type %}\n  {{ return({'name': column.name, 'data_type': data_type, 'formatted': formatted}) }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7460501, "supported_languages": null}, "macro.dbt.drop_table": {"name": "drop_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt.drop_table", "macro_sql": "{% macro drop_table(relation) -%}\n    {{ return(adapter.dispatch('drop_table', 'dbt')(relation)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__drop_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7463229, "supported_languages": null}, "macro.dbt.default__drop_table": {"name": "default__drop_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt.default__drop_table", "macro_sql": "{% macro default__drop_table(relation) -%}\n    drop table if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7464309, "supported_languages": null}, "macro.dbt.get_replace_table_sql": {"name": "get_replace_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt.get_replace_table_sql", "macro_sql": "{% macro get_replace_table_sql(relation, sql) %}\n    {{- adapter.dispatch('get_replace_table_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_replace_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.746707, "supported_languages": null}, "macro.dbt.default__get_replace_table_sql": {"name": "default__get_replace_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt.default__get_replace_table_sql", "macro_sql": "{% macro default__get_replace_table_sql(relation, sql) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_replace_table_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.746859, "supported_languages": null}, "macro.dbt.get_rename_table_sql": {"name": "get_rename_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt.get_rename_table_sql", "macro_sql": "{% macro get_rename_table_sql(relation, new_name) %}\n    {{- adapter.dispatch('get_rename_table_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_rename_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.747137, "supported_languages": null}, "macro.dbt.default__get_rename_table_sql": {"name": "default__get_rename_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt.default__get_rename_table_sql", "macro_sql": "{% macro default__get_rename_table_sql(relation, new_name) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_rename_table_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7472892, "supported_languages": null}, "macro.dbt.get_create_table_as_sql": {"name": "get_create_table_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.get_create_table_as_sql", "macro_sql": "{% macro get_create_table_as_sql(temporary, relation, sql) -%}\n  {{ adapter.dispatch('get_create_table_as_sql', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_table_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7481642, "supported_languages": null}, "macro.dbt.default__get_create_table_as_sql": {"name": "default__get_create_table_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_create_table_as_sql", "macro_sql": "{% macro default__get_create_table_as_sql(temporary, relation, sql) -%}\n  {{ return(create_table_as(temporary, relation, sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.748356, "supported_languages": null}, "macro.dbt.create_table_as": {"name": "create_table_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, compiled_code, language='sql') -%}\n  {# backward compatibility for create_table_as that does not support language #}\n  {% if language == \"sql\" %}\n    {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, compiled_code)}}\n  {% else %}\n    {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, compiled_code, language) }}\n  {% endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.748815, "supported_languages": null}, "macro.dbt.default__create_table_as": {"name": "default__create_table_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__create_table_as", "macro_sql": "{% macro default__create_table_as(temporary, relation, sql) -%}\n  {%- set sql_header = config.get('sql_header', none) -%}\n\n  {{ sql_header if sql_header is not none }}\n\n  create {% if temporary: -%}temporary{%- endif %} table\n    {{ relation.include(database=(not temporary), schema=(not temporary)) }}\n  {% set contract_config = config.get('contract') %}\n  {% if contract_config.enforced and (not temporary) %}\n    {{ get_assert_columns_equivalent(sql) }}\n    {{ get_table_columns_and_constraints() }}\n    {%- set sql = get_select_subquery(sql) %}\n  {% endif %}\n  as (\n    {{ sql }}\n  );\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent", "macro.dbt.get_table_columns_and_constraints", "macro.dbt.get_select_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.749535, "supported_languages": null}, "macro.dbt.default__get_column_names": {"name": "default__get_column_names", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_column_names", "macro_sql": "{% macro default__get_column_names() %}\n  {#- loop through user_provided_columns to get column names -#}\n    {%- set user_provided_columns = model['columns'] -%}\n    {%- for i in user_provided_columns %}\n      {%- set col = user_provided_columns[i] -%}\n      {%- set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] -%}\n      {{ col_name }}{{ \", \" if not loop.last }}\n    {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.750022, "supported_languages": null}, "macro.dbt.get_select_subquery": {"name": "get_select_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.get_select_subquery", "macro_sql": "{% macro get_select_subquery(sql) %}\n  {{ return(adapter.dispatch('get_select_subquery', 'dbt')(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_select_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7502122, "supported_languages": null}, "macro.dbt.default__get_select_subquery": {"name": "default__get_select_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_select_subquery", "macro_sql": "{% macro default__get_select_subquery(sql) %}\n    select {{ adapter.dispatch('get_column_names', 'dbt')() }}\n    from (\n        {{ sql }}\n    ) as model_subq\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_column_names"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.750398, "supported_languages": null}, "macro.dbt.drop_view": {"name": "drop_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt.drop_view", "macro_sql": "{% macro drop_view(relation) -%}\n    {{ return(adapter.dispatch('drop_view', 'dbt')(relation)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__drop_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.750666, "supported_languages": null}, "macro.dbt.default__drop_view": {"name": "default__drop_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt.default__drop_view", "macro_sql": "{% macro default__drop_view(relation) -%}\n    drop view if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.750777, "supported_languages": null}, "macro.dbt.get_replace_view_sql": {"name": "get_replace_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.get_replace_view_sql", "macro_sql": "{% macro get_replace_view_sql(relation, sql) %}\n    {{- adapter.dispatch('get_replace_view_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_replace_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.751647, "supported_languages": null}, "macro.dbt.default__get_replace_view_sql": {"name": "default__get_replace_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.default__get_replace_view_sql", "macro_sql": "{% macro default__get_replace_view_sql(relation, sql) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_replace_view_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.751799, "supported_languages": null}, "macro.dbt.create_or_replace_view": {"name": "create_or_replace_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.create_or_replace_view", "macro_sql": "{% macro create_or_replace_view() %}\n  {%- set identifier = model['alias'] -%}\n\n  {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n  {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n  {%- set target_relation = api.Relation.create(\n      identifier=identifier, schema=schema, database=database,\n      type='view') -%}\n  {% set grant_config = config.get('grants') %}\n\n  {{ run_hooks(pre_hooks) }}\n\n  -- If there's a table with the same name and we weren't told to full refresh,\n  -- that's an error. If we were told to full refresh, drop it. This behavior differs\n  -- for Snowflake and BigQuery, so multiple dispatch is used.\n  {%- if old_relation is not none and old_relation.is_table -%}\n    {{ handle_existing_table(should_full_refresh(), old_relation) }}\n  {%- endif -%}\n\n  -- build model\n  {% call statement('main') -%}\n    {{ get_create_view_as_sql(target_relation, sql) }}\n  {%- endcall %}\n\n  {% set should_revoke = should_revoke(exists_as_view, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {{ run_hooks(post_hooks) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7530398, "supported_languages": null}, "macro.dbt.handle_existing_table": {"name": "handle_existing_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n    {{ adapter.dispatch('handle_existing_table', 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__handle_existing_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7532449, "supported_languages": null}, "macro.dbt.default__handle_existing_table": {"name": "default__handle_existing_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n    {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n    {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7534761, "supported_languages": null}, "macro.dbt.get_rename_view_sql": {"name": "get_rename_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt.get_rename_view_sql", "macro_sql": "{% macro get_rename_view_sql(relation, new_name) %}\n    {{- adapter.dispatch('get_rename_view_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_rename_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7537549, "supported_languages": null}, "macro.dbt.default__get_rename_view_sql": {"name": "default__get_rename_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt.default__get_rename_view_sql", "macro_sql": "{% macro default__get_rename_view_sql(relation, new_name) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_rename_view_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.753907, "supported_languages": null}, "macro.dbt.get_create_view_as_sql": {"name": "get_create_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.get_create_view_as_sql", "macro_sql": "{% macro get_create_view_as_sql(relation, sql) -%}\n  {{ adapter.dispatch('get_create_view_as_sql', 'dbt')(relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.754328, "supported_languages": null}, "macro.dbt.default__get_create_view_as_sql": {"name": "default__get_create_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.default__get_create_view_as_sql", "macro_sql": "{% macro default__get_create_view_as_sql(relation, sql) -%}\n  {{ return(create_view_as(relation, sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.754495, "supported_languages": null}, "macro.dbt.create_view_as": {"name": "create_view_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n  {{ adapter.dispatch('create_view_as', 'dbt')(relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.754684, "supported_languages": null}, "macro.dbt.default__create_view_as": {"name": "default__create_view_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.default__create_view_as", "macro_sql": "{% macro default__create_view_as(relation, sql) -%}\n  {%- set sql_header = config.get('sql_header', none) -%}\n\n  {{ sql_header if sql_header is not none }}\n  create view {{ relation }}\n    {% set contract_config = config.get('contract') %}\n    {% if contract_config.enforced %}\n      {{ get_assert_columns_equivalent(sql) }}\n    {%- endif %}\n  as (\n    {{ sql }}\n  );\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.755136, "supported_languages": null}, "macro.dbt.default__test_relationships": {"name": "default__test_relationships", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/relationships.sql", "original_file_path": "macros/generic_test_sql/relationships.sql", "unique_id": "macro.dbt.default__test_relationships", "macro_sql": "{% macro default__test_relationships(model, column_name, to, field) %}\n\nwith child as (\n    select {{ column_name }} as from_field\n    from {{ model }}\n    where {{ column_name }} is not null\n),\n\nparent as (\n    select {{ field }} as to_field\n    from {{ to }}\n)\n\nselect\n    from_field\n\nfrom child\nleft join parent\n    on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7554922, "supported_languages": null}, "macro.dbt.default__test_not_null": {"name": "default__test_not_null", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/not_null.sql", "original_file_path": "macros/generic_test_sql/not_null.sql", "unique_id": "macro.dbt.default__test_not_null", "macro_sql": "{% macro default__test_not_null(model, column_name) %}\n\n{% set column_list = '*' if should_store_failures() else column_name %}\n\nselect {{ column_list }}\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_store_failures"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.755796, "supported_languages": null}, "macro.dbt.default__test_unique": {"name": "default__test_unique", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/unique.sql", "original_file_path": "macros/generic_test_sql/unique.sql", "unique_id": "macro.dbt.default__test_unique", "macro_sql": "{% macro default__test_unique(model, column_name) %}\n\nselect\n    {{ column_name }} as unique_field,\n    count(*) as n_records\n\nfrom {{ model }}\nwhere {{ column_name }} is not null\ngroup by {{ column_name }}\nhaving count(*) > 1\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.756047, "supported_languages": null}, "macro.dbt.default__test_accepted_values": {"name": "default__test_accepted_values", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/accepted_values.sql", "original_file_path": "macros/generic_test_sql/accepted_values.sql", "unique_id": "macro.dbt.default__test_accepted_values", "macro_sql": "{% macro default__test_accepted_values(model, column_name, values, quote=True) %}\n\nwith all_values as (\n\n    select\n        {{ column_name }} as value_field,\n        count(*) as n_records\n\n    from {{ model }}\n    group by {{ column_name }}\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n    {% for value in values -%}\n        {% if quote -%}\n        '{{ value }}'\n        {%- else -%}\n        {{ value }}\n        {%- endif -%}\n        {%- if not loop.last -%},{%- endif %}\n    {%- endfor %}\n)\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.756632, "supported_languages": null}, "macro.dbt.statement": {"name": "statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.statement", "macro_sql": "\n{%- macro statement(name=None, fetch_result=False, auto_begin=True, language='sql') -%}\n  {%- if execute: -%}\n    {%- set compiled_code = caller() -%}\n\n    {%- if name == 'main' -%}\n      {{ log('Writing runtime {} for node \"{}\"'.format(language, model['unique_id'])) }}\n      {{ write(compiled_code) }}\n    {%- endif -%}\n    {%- if language == 'sql'-%}\n      {%- set res, table = adapter.execute(compiled_code, auto_begin=auto_begin, fetch=fetch_result) -%}\n    {%- elif language == 'python' -%}\n      {%- set res = submit_python_job(model, compiled_code) -%}\n      {#-- TODO: What should table be for python models? --#}\n      {%- set table = None -%}\n    {%- else -%}\n      {% do exceptions.raise_compiler_error(\"statement macro didn't get supported language\") %}\n    {%- endif -%}\n\n    {%- if name is not none -%}\n      {{ store_result(name, response=res, agate_table=table) }}\n    {%- endif -%}\n\n  {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.758143, "supported_languages": null}, "macro.dbt.noop_statement": {"name": "noop_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.noop_statement", "macro_sql": "{% macro noop_statement(name=None, message=None, code=None, rows_affected=None, res=None) -%}\n  {%- set sql = caller() -%}\n\n  {%- if name == 'main' -%}\n    {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n    {{ write(sql) }}\n  {%- endif -%}\n\n  {%- if name is not none -%}\n    {{ store_raw_result(name, message=message, code=code, rows_affected=rows_affected, agate_table=res) }}\n  {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7587562, "supported_languages": null}, "macro.dbt.run_query": {"name": "run_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.run_query", "macro_sql": "{% macro run_query(sql) %}\n  {% call statement(\"run_query_statement\", fetch_result=true, auto_begin=false) %}\n    {{ sql }}\n  {% endcall %}\n\n  {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.75906, "supported_languages": null}, "macro.dbt.convert_datetime": {"name": "convert_datetime", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.convert_datetime", "macro_sql": "{% macro convert_datetime(date_str, date_fmt) %}\n\n  {% set error_msg -%}\n      The provided partition date '{{ date_str }}' does not match the expected format '{{ date_fmt }}'\n  {%- endset %}\n\n  {% set res = try_or_compiler_error(error_msg, modules.datetime.datetime.strptime, date_str.strip(), date_fmt) %}\n  {{ return(res) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.760959, "supported_languages": null}, "macro.dbt.dates_in_range": {"name": "dates_in_range", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.dates_in_range", "macro_sql": "{% macro dates_in_range(start_date_str, end_date_str=none, in_fmt=\"%Y%m%d\", out_fmt=\"%Y%m%d\") %}\n    {% set end_date_str = start_date_str if end_date_str is none else end_date_str %}\n\n    {% set start_date = convert_datetime(start_date_str, in_fmt) %}\n    {% set end_date = convert_datetime(end_date_str, in_fmt) %}\n\n    {% set day_count = (end_date - start_date).days %}\n    {% if day_count < 0 %}\n        {% set msg -%}\n            Partition start date is after the end date ({{ start_date }}, {{ end_date }})\n        {%- endset %}\n\n        {{ exceptions.raise_compiler_error(msg, model) }}\n    {% endif %}\n\n    {% set date_list = [] %}\n    {% for i in range(0, day_count + 1) %}\n        {% set the_date = (modules.datetime.timedelta(days=i) + start_date) %}\n        {% if not out_fmt %}\n            {% set _ = date_list.append(the_date) %}\n        {% else %}\n            {% set _ = date_list.append(the_date.strftime(out_fmt)) %}\n        {% endif %}\n    {% endfor %}\n\n    {{ return(date_list) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.convert_datetime"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.76227, "supported_languages": null}, "macro.dbt.partition_range": {"name": "partition_range", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.partition_range", "macro_sql": "{% macro partition_range(raw_partition_date, date_fmt='%Y%m%d') %}\n    {% set partition_range = (raw_partition_date | string).split(\",\") %}\n\n    {% if (partition_range | length) == 1 %}\n      {% set start_date = partition_range[0] %}\n      {% set end_date = none %}\n    {% elif (partition_range | length) == 2 %}\n      {% set start_date = partition_range[0] %}\n      {% set end_date = partition_range[1] %}\n    {% else %}\n      {{ exceptions.raise_compiler_error(\"Invalid partition time. Expected format: {Start Date}[,{End Date}]. Got: \" ~ raw_partition_date) }}\n    {% endif %}\n\n    {{ return(dates_in_range(start_date, end_date, in_fmt=date_fmt)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dates_in_range"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.763057, "supported_languages": null}, "macro.dbt.py_current_timestring": {"name": "py_current_timestring", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.py_current_timestring", "macro_sql": "{% macro py_current_timestring() %}\n    {% set dt = modules.datetime.datetime.now() %}\n    {% do return(dt.strftime(\"%Y%m%d%H%M%S%f\")) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7633011, "supported_languages": null}, "macro.dbt.except": {"name": "except", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/except.sql", "original_file_path": "macros/utils/except.sql", "unique_id": "macro.dbt.except", "macro_sql": "{% macro except() %}\n  {{ return(adapter.dispatch('except', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.763536, "supported_languages": null}, "macro.dbt.default__except": {"name": "default__except", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/except.sql", "original_file_path": "macros/utils/except.sql", "unique_id": "macro.dbt.default__except", "macro_sql": "{% macro default__except() %}\n\n    except\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.763616, "supported_languages": null}, "macro.dbt.get_intervals_between": {"name": "get_intervals_between", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n    {{ return(adapter.dispatch('get_intervals_between', 'dbt')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.764365, "supported_languages": null}, "macro.dbt.default__get_intervals_between": {"name": "default__get_intervals_between", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n    {%- call statement('get_intervals_between', fetch_result=True) %}\n\n        select {{ dbt.datediff(start_date, end_date, datepart) }}\n\n    {%- endcall -%}\n\n    {%- set value_list = load_result('get_intervals_between') -%}\n\n    {%- if value_list and value_list['data'] -%}\n        {%- set values = value_list['data'] | map(attribute=0) | list %}\n        {{ return(values[0]) }}\n    {%- else -%}\n        {{ return(1) }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.76498, "supported_languages": null}, "macro.dbt.date_spine": {"name": "date_spine", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n    {{ return(adapter.dispatch('date_spine', 'dbt')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7652202, "supported_languages": null}, "macro.dbt.default__date_spine": {"name": "default__date_spine", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n    {# call as follows:\n\n    date_spine(\n        \"day\",\n        \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n        \"dbt.dateadd(week, 1, current_date)\"\n    ) #}\n\n\n    with rawdata as (\n\n        {{dbt.generate_series(\n            dbt.get_intervals_between(start_date, end_date, datepart)\n        )}}\n\n    ),\n\n    all_periods as (\n\n        select (\n            {{\n                dbt.dateadd(\n                    datepart,\n                    \"row_number() over (order by 1) - 1\",\n                    start_date\n                )\n            }}\n        ) as date_{{datepart}}\n        from rawdata\n\n    ),\n\n    filtered as (\n\n        select *\n        from all_periods\n        where date_{{datepart}} <= {{ end_date }}\n\n    )\n\n    select * from filtered\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.generate_series", "macro.dbt.get_intervals_between", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.765604, "supported_languages": null}, "macro.dbt.replace": {"name": "replace", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/replace.sql", "original_file_path": "macros/utils/replace.sql", "unique_id": "macro.dbt.replace", "macro_sql": "{% macro replace(field, old_chars, new_chars) -%}\n    {{ return(adapter.dispatch('replace', 'dbt') (field, old_chars, new_chars)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__replace"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.765944, "supported_languages": null}, "macro.dbt.default__replace": {"name": "default__replace", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/replace.sql", "original_file_path": "macros/utils/replace.sql", "unique_id": "macro.dbt.default__replace", "macro_sql": "{% macro default__replace(field, old_chars, new_chars) %}\n\n    replace(\n        {{ field }},\n        {{ old_chars }},\n        {{ new_chars }}\n    )\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.766112, "supported_languages": null}, "macro.dbt.concat": {"name": "concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/concat.sql", "original_file_path": "macros/utils/concat.sql", "unique_id": "macro.dbt.concat", "macro_sql": "{% macro concat(fields) -%}\n  {{ return(adapter.dispatch('concat', 'dbt')(fields)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7663622, "supported_languages": null}, "macro.dbt.default__concat": {"name": "default__concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/concat.sql", "original_file_path": "macros/utils/concat.sql", "unique_id": "macro.dbt.default__concat", "macro_sql": "{% macro default__concat(fields) -%}\n    {{ fields|join(' || ') }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.766488, "supported_languages": null}, "macro.dbt.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n    {{ return(adapter.dispatch('get_powers_of_two', 'dbt')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.767338, "supported_languages": null}, "macro.dbt.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n    {% if upper_bound <= 0 %}\n    {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n    {% endif %}\n\n    {% for _ in range(1, 100) %}\n       {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n    {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.767779, "supported_languages": null}, "macro.dbt.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n    {{ return(adapter.dispatch('generate_series', 'dbt')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7679749, "supported_languages": null}, "macro.dbt.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n    {% set n = dbt.get_powers_of_two(upper_bound) %}\n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    {% for i in range(n) %}\n    p{{i}}.generated_number * power(2, {{i}})\n    {% if not loop.last %} + {% endif %}\n    {% endfor %}\n    + 1\n    as generated_number\n\n    from\n\n    {% for i in range(n) %}\n    p as p{{i}}\n    {% if not loop.last %} cross join {% endif %}\n    {% endfor %}\n\n    )\n\n    select *\n    from unioned\n    where generated_number <= {{upper_bound}}\n    order by generated_number\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.768517, "supported_languages": null}, "macro.dbt.length": {"name": "length", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/length.sql", "original_file_path": "macros/utils/length.sql", "unique_id": "macro.dbt.length", "macro_sql": "{% macro length(expression) -%}\n    {{ return(adapter.dispatch('length', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__length"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7687821, "supported_languages": null}, "macro.dbt.default__length": {"name": "default__length", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/length.sql", "original_file_path": "macros/utils/length.sql", "unique_id": "macro.dbt.default__length", "macro_sql": "{% macro default__length(expression) %}\n\n    length(\n        {{ expression }}\n    )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7688892, "supported_languages": null}, "macro.dbt.dateadd": {"name": "dateadd", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/dateadd.sql", "original_file_path": "macros/utils/dateadd.sql", "unique_id": "macro.dbt.dateadd", "macro_sql": "{% macro dateadd(datepart, interval, from_date_or_timestamp) %}\n  {{ return(adapter.dispatch('dateadd', 'dbt')(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.769238, "supported_languages": null}, "macro.dbt.default__dateadd": {"name": "default__dateadd", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/dateadd.sql", "original_file_path": "macros/utils/dateadd.sql", "unique_id": "macro.dbt.default__dateadd", "macro_sql": "{% macro default__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n    dateadd(\n        {{ datepart }},\n        {{ interval }},\n        {{ from_date_or_timestamp }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7694058, "supported_languages": null}, "macro.dbt.intersect": {"name": "intersect", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/intersect.sql", "original_file_path": "macros/utils/intersect.sql", "unique_id": "macro.dbt.intersect", "macro_sql": "{% macro intersect() %}\n  {{ return(adapter.dispatch('intersect', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__intersect"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.769634, "supported_languages": null}, "macro.dbt.default__intersect": {"name": "default__intersect", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/intersect.sql", "original_file_path": "macros/utils/intersect.sql", "unique_id": "macro.dbt.default__intersect", "macro_sql": "{% macro default__intersect() %}\n\n    intersect\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7697809, "supported_languages": null}, "macro.dbt.escape_single_quotes": {"name": "escape_single_quotes", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt.escape_single_quotes", "macro_sql": "{% macro escape_single_quotes(expression) %}\n      {{ return(adapter.dispatch('escape_single_quotes', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__escape_single_quotes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.770048, "supported_languages": null}, "macro.dbt.default__escape_single_quotes": {"name": "default__escape_single_quotes", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt.default__escape_single_quotes", "macro_sql": "{% macro default__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\",\"''\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.770195, "supported_languages": null}, "macro.dbt.right": {"name": "right", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt.right", "macro_sql": "{% macro right(string_text, length_expression) -%}\n    {{ return(adapter.dispatch('right', 'dbt') (string_text, length_expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__right"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.770493, "supported_languages": null}, "macro.dbt.default__right": {"name": "default__right", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt.default__right", "macro_sql": "{% macro default__right(string_text, length_expression) %}\n\n    right(\n        {{ string_text }},\n        {{ length_expression }}\n    )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.770636, "supported_languages": null}, "macro.dbt.listagg": {"name": "listagg", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/listagg.sql", "original_file_path": "macros/utils/listagg.sql", "unique_id": "macro.dbt.listagg", "macro_sql": "{% macro listagg(measure, delimiter_text=\"','\", order_by_clause=none, limit_num=none) -%}\n    {{ return(adapter.dispatch('listagg', 'dbt') (measure, delimiter_text, order_by_clause, limit_num)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__listagg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7712839, "supported_languages": null}, "macro.dbt.default__listagg": {"name": "default__listagg", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/listagg.sql", "original_file_path": "macros/utils/listagg.sql", "unique_id": "macro.dbt.default__listagg", "macro_sql": "{% macro default__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n    {% if limit_num -%}\n    array_to_string(\n        array_slice(\n            array_agg(\n                {{ measure }}\n            ){% if order_by_clause -%}\n            within group ({{ order_by_clause }})\n            {%- endif %}\n            ,0\n            ,{{ limit_num }}\n        ),\n        {{ delimiter_text }}\n        )\n    {%- else %}\n    listagg(\n        {{ measure }},\n        {{ delimiter_text }}\n        )\n        {% if order_by_clause -%}\n        within group ({{ order_by_clause }})\n        {%- endif %}\n    {%- endif %}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.771706, "supported_languages": null}, "macro.dbt.datediff": {"name": "datediff", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/datediff.sql", "original_file_path": "macros/utils/datediff.sql", "unique_id": "macro.dbt.datediff", "macro_sql": "{% macro datediff(first_date, second_date, datepart) %}\n  {{ return(adapter.dispatch('datediff', 'dbt')(first_date, second_date, datepart)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.772053, "supported_languages": null}, "macro.dbt.default__datediff": {"name": "default__datediff", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/datediff.sql", "original_file_path": "macros/utils/datediff.sql", "unique_id": "macro.dbt.default__datediff", "macro_sql": "{% macro default__datediff(first_date, second_date, datepart) -%}\n\n    datediff(\n        {{ datepart }},\n        {{ first_date }},\n        {{ second_date }}\n        )\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7722251, "supported_languages": null}, "macro.dbt.safe_cast": {"name": "safe_cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt.safe_cast", "macro_sql": "{% macro safe_cast(field, type) %}\n  {{ return(adapter.dispatch('safe_cast', 'dbt') (field, type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7725189, "supported_languages": null}, "macro.dbt.default__safe_cast": {"name": "default__safe_cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt.default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n    {# most databases don't support this function yet\n    so we just need to use cast #}\n    cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.772661, "supported_languages": null}, "macro.dbt.hash": {"name": "hash", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/hash.sql", "original_file_path": "macros/utils/hash.sql", "unique_id": "macro.dbt.hash", "macro_sql": "{% macro hash(field) -%}\n  {{ return(adapter.dispatch('hash', 'dbt') (field)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__hash"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.772923, "supported_languages": null}, "macro.dbt.default__hash": {"name": "default__hash", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/hash.sql", "original_file_path": "macros/utils/hash.sql", "unique_id": "macro.dbt.default__hash", "macro_sql": "{% macro default__hash(field) -%}\n    md5(cast({{ field }} as {{ api.Column.translate_type('string') }}))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.773092, "supported_languages": null}, "macro.dbt.cast_bool_to_text": {"name": "cast_bool_to_text", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast_bool_to_text.sql", "original_file_path": "macros/utils/cast_bool_to_text.sql", "unique_id": "macro.dbt.cast_bool_to_text", "macro_sql": "{% macro cast_bool_to_text(field) %}\n  {{ adapter.dispatch('cast_bool_to_text', 'dbt') (field) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.773341, "supported_languages": null}, "macro.dbt.default__cast_bool_to_text": {"name": "default__cast_bool_to_text", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast_bool_to_text.sql", "original_file_path": "macros/utils/cast_bool_to_text.sql", "unique_id": "macro.dbt.default__cast_bool_to_text", "macro_sql": "{% macro default__cast_bool_to_text(field) %}\n    cast({{ field }} as {{ api.Column.translate_type('string') }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.773503, "supported_languages": null}, "macro.dbt.any_value": {"name": "any_value", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/any_value.sql", "original_file_path": "macros/utils/any_value.sql", "unique_id": "macro.dbt.any_value", "macro_sql": "{% macro any_value(expression) -%}\n    {{ return(adapter.dispatch('any_value', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__any_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.77376, "supported_languages": null}, "macro.dbt.default__any_value": {"name": "default__any_value", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/any_value.sql", "original_file_path": "macros/utils/any_value.sql", "unique_id": "macro.dbt.default__any_value", "macro_sql": "{% macro default__any_value(expression) -%}\n\n    any_value({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.77387, "supported_languages": null}, "macro.dbt.position": {"name": "position", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/position.sql", "original_file_path": "macros/utils/position.sql", "unique_id": "macro.dbt.position", "macro_sql": "{% macro position(substring_text, string_text) -%}\n    {{ return(adapter.dispatch('position', 'dbt') (substring_text, string_text)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__position"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7741692, "supported_languages": null}, "macro.dbt.default__position": {"name": "default__position", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/position.sql", "original_file_path": "macros/utils/position.sql", "unique_id": "macro.dbt.default__position", "macro_sql": "{% macro default__position(substring_text, string_text) %}\n\n    position(\n        {{ substring_text }} in {{ string_text }}\n    )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7743108, "supported_languages": null}, "macro.dbt.string_literal": {"name": "string_literal", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/literal.sql", "original_file_path": "macros/utils/literal.sql", "unique_id": "macro.dbt.string_literal", "macro_sql": "{%- macro string_literal(value) -%}\n  {{ return(adapter.dispatch('string_literal', 'dbt') (value)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__string_literal"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.774561, "supported_languages": null}, "macro.dbt.default__string_literal": {"name": "default__string_literal", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/literal.sql", "original_file_path": "macros/utils/literal.sql", "unique_id": "macro.dbt.default__string_literal", "macro_sql": "{% macro default__string_literal(value) -%}\n    '{{ value }}'\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7747269, "supported_languages": null}, "macro.dbt.type_string": {"name": "type_string", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_string", "macro_sql": "\n\n{%- macro type_string() -%}\n  {{ return(adapter.dispatch('type_string', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7756531, "supported_languages": null}, "macro.dbt.default__type_string": {"name": "default__type_string", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_string", "macro_sql": "{% macro default__type_string() %}\n    {{ return(api.Column.translate_type(\"string\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.775815, "supported_languages": null}, "macro.dbt.type_timestamp": {"name": "type_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_timestamp", "macro_sql": "\n\n{%- macro type_timestamp() -%}\n  {{ return(adapter.dispatch('type_timestamp', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.775985, "supported_languages": null}, "macro.dbt.default__type_timestamp": {"name": "default__type_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_timestamp", "macro_sql": "{% macro default__type_timestamp() %}\n    {{ return(api.Column.translate_type(\"timestamp\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7761421, "supported_languages": null}, "macro.dbt.type_float": {"name": "type_float", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_float", "macro_sql": "\n\n{%- macro type_float() -%}\n  {{ return(adapter.dispatch('type_float', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_float"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.776312, "supported_languages": null}, "macro.dbt.default__type_float": {"name": "default__type_float", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_float", "macro_sql": "{% macro default__type_float() %}\n    {{ return(api.Column.translate_type(\"float\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.77647, "supported_languages": null}, "macro.dbt.type_numeric": {"name": "type_numeric", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_numeric", "macro_sql": "\n\n{%- macro type_numeric() -%}\n  {{ return(adapter.dispatch('type_numeric', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.776635, "supported_languages": null}, "macro.dbt.default__type_numeric": {"name": "default__type_numeric", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_numeric", "macro_sql": "{% macro default__type_numeric() %}\n    {{ return(api.Column.numeric_type(\"numeric\", 28, 6)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.776819, "supported_languages": null}, "macro.dbt.type_bigint": {"name": "type_bigint", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_bigint", "macro_sql": "\n\n{%- macro type_bigint() -%}\n  {{ return(adapter.dispatch('type_bigint', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.776983, "supported_languages": null}, "macro.dbt.default__type_bigint": {"name": "default__type_bigint", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_bigint", "macro_sql": "{% macro default__type_bigint() %}\n    {{ return(api.Column.translate_type(\"bigint\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.777143, "supported_languages": null}, "macro.dbt.type_int": {"name": "type_int", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_int", "macro_sql": "\n\n{%- macro type_int() -%}\n  {{ return(adapter.dispatch('type_int', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7773068, "supported_languages": null}, "macro.dbt.default__type_int": {"name": "default__type_int", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_int", "macro_sql": "{%- macro default__type_int() -%}\n  {{ return(api.Column.translate_type(\"integer\")) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.777457, "supported_languages": null}, "macro.dbt.type_boolean": {"name": "type_boolean", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_boolean", "macro_sql": "\n\n{%- macro type_boolean() -%}\n  {{ return(adapter.dispatch('type_boolean', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_boolean"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.777625, "supported_languages": null}, "macro.dbt.default__type_boolean": {"name": "default__type_boolean", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_boolean", "macro_sql": "{%- macro default__type_boolean() -%}\n  {{ return(api.Column.translate_type(\"boolean\")) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7777731, "supported_languages": null}, "macro.dbt.array_concat": {"name": "array_concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_concat.sql", "original_file_path": "macros/utils/array_concat.sql", "unique_id": "macro.dbt.array_concat", "macro_sql": "{% macro array_concat(array_1, array_2) -%}\n  {{ return(adapter.dispatch('array_concat', 'dbt')(array_1, array_2)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__array_concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7780569, "supported_languages": null}, "macro.dbt.default__array_concat": {"name": "default__array_concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_concat.sql", "original_file_path": "macros/utils/array_concat.sql", "unique_id": "macro.dbt.default__array_concat", "macro_sql": "{% macro default__array_concat(array_1, array_2) -%}\n    array_cat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.778193, "supported_languages": null}, "macro.dbt.bool_or": {"name": "bool_or", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt.bool_or", "macro_sql": "{% macro bool_or(expression) -%}\n    {{ return(adapter.dispatch('bool_or', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__bool_or"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.778474, "supported_languages": null}, "macro.dbt.default__bool_or": {"name": "default__bool_or", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt.default__bool_or", "macro_sql": "{% macro default__bool_or(expression) -%}\n\n    bool_or({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.778636, "supported_languages": null}, "macro.dbt.last_day": {"name": "last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.last_day", "macro_sql": "{% macro last_day(date, datepart) %}\n  {{ return(adapter.dispatch('last_day', 'dbt') (date, datepart)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.779051, "supported_languages": null}, "macro.dbt.default_last_day": {"name": "default_last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.default_last_day", "macro_sql": "\n\n{%- macro default_last_day(date, datepart) -%}\n    cast(\n        {{dbt.dateadd('day', '-1',\n        dbt.dateadd(datepart, '1', dbt.date_trunc(datepart, date))\n        )}}\n        as date)\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.779538, "supported_languages": null}, "macro.dbt.default__last_day": {"name": "default__last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.default__last_day", "macro_sql": "{% macro default__last_day(date, datepart) -%}\n    {{dbt.default_last_day(date, datepart)}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.779704, "supported_languages": null}, "macro.dbt.split_part": {"name": "split_part", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt.split_part", "macro_sql": "{% macro split_part(string_text, delimiter_text, part_number) %}\n  {{ return(adapter.dispatch('split_part', 'dbt') (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__split_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.780276, "supported_languages": null}, "macro.dbt.default__split_part": {"name": "default__split_part", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt.default__split_part", "macro_sql": "{% macro default__split_part(string_text, delimiter_text, part_number) %}\n\n    split_part(\n        {{ string_text }},\n        {{ delimiter_text }},\n        {{ part_number }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7804701, "supported_languages": null}, "macro.dbt._split_part_negative": {"name": "_split_part_negative", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt._split_part_negative", "macro_sql": "{% macro _split_part_negative(string_text, delimiter_text, part_number) %}\n\n    split_part(\n        {{ string_text }},\n        {{ delimiter_text }},\n          length({{ string_text }})\n          - length(\n              replace({{ string_text }},  {{ delimiter_text }}, '')\n          ) + 2 + {{ part_number }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.780714, "supported_languages": null}, "macro.dbt.date_trunc": {"name": "date_trunc", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_trunc.sql", "original_file_path": "macros/utils/date_trunc.sql", "unique_id": "macro.dbt.date_trunc", "macro_sql": "{% macro date_trunc(datepart, date) -%}\n  {{ return(adapter.dispatch('date_trunc', 'dbt') (datepart, date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.781007, "supported_languages": null}, "macro.dbt.default__date_trunc": {"name": "default__date_trunc", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_trunc.sql", "original_file_path": "macros/utils/date_trunc.sql", "unique_id": "macro.dbt.default__date_trunc", "macro_sql": "{% macro default__date_trunc(datepart, date) -%}\n    date_trunc('{{datepart}}', {{date}})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7811468, "supported_languages": null}, "macro.dbt.array_construct": {"name": "array_construct", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt.array_construct", "macro_sql": "{% macro array_construct(inputs=[], data_type=api.Column.translate_type('integer')) -%}\n  {{ return(adapter.dispatch('array_construct', 'dbt')(inputs, data_type)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__array_construct"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.781539, "supported_languages": null}, "macro.dbt.default__array_construct": {"name": "default__array_construct", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt.default__array_construct", "macro_sql": "{% macro default__array_construct(inputs, data_type) -%}\n    {% if inputs|length > 0 %}\n    array[ {{ inputs|join(' , ') }} ]\n    {% else %}\n    array[]::{{data_type}}[]\n    {% endif %}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7817972, "supported_languages": null}, "macro.dbt.array_append": {"name": "array_append", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_append.sql", "original_file_path": "macros/utils/array_append.sql", "unique_id": "macro.dbt.array_append", "macro_sql": "{% macro array_append(array, new_element) -%}\n  {{ return(adapter.dispatch('array_append', 'dbt')(array, new_element)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__array_append"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.782094, "supported_languages": null}, "macro.dbt.default__array_append": {"name": "default__array_append", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_append.sql", "original_file_path": "macros/utils/array_append.sql", "unique_id": "macro.dbt.default__array_append", "macro_sql": "{% macro default__array_append(array, new_element) -%}\n    array_append({{ array }}, {{ new_element }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.782233, "supported_languages": null}, "macro.dbt.create_schema": {"name": "create_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n  {{ adapter.dispatch('create_schema', 'dbt')(relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.782629, "supported_languages": null}, "macro.dbt.default__create_schema": {"name": "default__create_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.default__create_schema", "macro_sql": "{% macro default__create_schema(relation) -%}\n  {%- call statement('create_schema') -%}\n    create schema if not exists {{ relation.without_identifier() }}\n  {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.782824, "supported_languages": null}, "macro.dbt.drop_schema": {"name": "drop_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n  {{ adapter.dispatch('drop_schema', 'dbt')(relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__drop_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.78299, "supported_languages": null}, "macro.dbt.default__drop_schema": {"name": "default__drop_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.default__drop_schema", "macro_sql": "{% macro default__drop_schema(relation) -%}\n  {%- call statement('drop_schema') -%}\n    drop schema if exists {{ relation.without_identifier() }} cascade\n  {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.783185, "supported_languages": null}, "macro.dbt.current_timestamp": {"name": "current_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp", "macro_sql": "{%- macro current_timestamp() -%}\n    {{ adapter.dispatch('current_timestamp', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.783689, "supported_languages": null}, "macro.dbt.default__current_timestamp": {"name": "default__current_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() -%}\n  {{ exceptions.raise_not_implemented(\n    'current_timestamp macro not implemented for adapter ' + adapter.type()) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.783849, "supported_languages": null}, "macro.dbt.snapshot_get_time": {"name": "snapshot_get_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.snapshot_get_time", "macro_sql": "\n\n{%- macro snapshot_get_time() -%}\n    {{ adapter.dispatch('snapshot_get_time', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.784001, "supported_languages": null}, "macro.dbt.default__snapshot_get_time": {"name": "default__snapshot_get_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__snapshot_get_time", "macro_sql": "{% macro default__snapshot_get_time() %}\n    {{ current_timestamp() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.784114, "supported_languages": null}, "macro.dbt.current_timestamp_backcompat": {"name": "current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp_backcompat", "macro_sql": "{% macro current_timestamp_backcompat() %}\n    {{ return(adapter.dispatch('current_timestamp_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__current_timestamp_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.784294, "supported_languages": null}, "macro.dbt.default__current_timestamp_backcompat": {"name": "default__current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp_backcompat", "macro_sql": "{% macro default__current_timestamp_backcompat() %}\n    current_timestamp::timestamp\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.784377, "supported_languages": null}, "macro.dbt.current_timestamp_in_utc_backcompat": {"name": "current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp_in_utc_backcompat", "macro_sql": "{% macro current_timestamp_in_utc_backcompat() %}\n    {{ return(adapter.dispatch('current_timestamp_in_utc_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__current_timestamp_in_utc_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.784621, "supported_languages": null}, "macro.dbt.default__current_timestamp_in_utc_backcompat": {"name": "default__current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp_in_utc_backcompat", "macro_sql": "{% macro default__current_timestamp_in_utc_backcompat() %}\n    {{ return(adapter.dispatch('current_timestamp_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp_backcompat", "macro.dbt_bigquery.bigquery__current_timestamp_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7847931, "supported_languages": null}, "macro.dbt.get_create_index_sql": {"name": "get_create_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_create_index_sql", "macro_sql": "{% macro get_create_index_sql(relation, index_dict) -%}\n  {{ return(adapter.dispatch('get_create_index_sql', 'dbt')(relation, index_dict)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.785656, "supported_languages": null}, "macro.dbt.default__get_create_index_sql": {"name": "default__get_create_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_create_index_sql", "macro_sql": "{% macro default__get_create_index_sql(relation, index_dict) -%}\n  {% do return(None) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.785797, "supported_languages": null}, "macro.dbt.create_indexes": {"name": "create_indexes", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.create_indexes", "macro_sql": "{% macro create_indexes(relation) -%}\n  {{ adapter.dispatch('create_indexes', 'dbt')(relation) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7859578, "supported_languages": null}, "macro.dbt.default__create_indexes": {"name": "default__create_indexes", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__create_indexes", "macro_sql": "{% macro default__create_indexes(relation) -%}\n  {%- set _indexes = config.get('indexes', default=[]) -%}\n\n  {% for _index_dict in _indexes %}\n    {% set create_index_sql = get_create_index_sql(relation, _index_dict) %}\n    {% if create_index_sql %}\n      {% do run_query(create_index_sql) %}\n    {% endif %}\n  {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_create_index_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.786381, "supported_languages": null}, "macro.dbt.get_drop_index_sql": {"name": "get_drop_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_drop_index_sql", "macro_sql": "{% macro get_drop_index_sql(relation, index_name) -%}\n    {{ adapter.dispatch('get_drop_index_sql', 'dbt')(relation, index_name) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_drop_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.786572, "supported_languages": null}, "macro.dbt.default__get_drop_index_sql": {"name": "default__get_drop_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_drop_index_sql", "macro_sql": "{% macro default__get_drop_index_sql(relation, index_name) -%}\n    {{ exceptions.raise_compiler_error(\"`get_drop_index_sql has not been implemented for this adapter.\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7867131, "supported_languages": null}, "macro.dbt.get_show_indexes_sql": {"name": "get_show_indexes_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_show_indexes_sql", "macro_sql": "{% macro get_show_indexes_sql(relation) -%}\n    {{ adapter.dispatch('get_show_indexes_sql', 'dbt')(relation) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_show_indexes_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7868779, "supported_languages": null}, "macro.dbt.default__get_show_indexes_sql": {"name": "default__get_show_indexes_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_show_indexes_sql", "macro_sql": "{% macro default__get_show_indexes_sql(relation) -%}\n    {{ exceptions.raise_compiler_error(\"`get_show_indexes_sql has not been implemented for this adapter.\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.787005, "supported_languages": null}, "macro.dbt.make_intermediate_relation": {"name": "make_intermediate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_intermediate_relation", "macro_sql": "{% macro make_intermediate_relation(base_relation, suffix='__dbt_tmp') %}\n  {{ return(adapter.dispatch('make_intermediate_relation', 'dbt')(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_intermediate_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.789033, "supported_languages": null}, "macro.dbt.default__make_intermediate_relation": {"name": "default__make_intermediate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_intermediate_relation", "macro_sql": "{% macro default__make_intermediate_relation(base_relation, suffix) %}\n    {{ return(default__make_temp_relation(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7892091, "supported_languages": null}, "macro.dbt.make_temp_relation": {"name": "make_temp_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n  {{ return(adapter.dispatch('make_temp_relation', 'dbt')(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7894342, "supported_languages": null}, "macro.dbt.default__make_temp_relation": {"name": "default__make_temp_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_temp_relation", "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n    {%- set temp_identifier = base_relation.identifier ~ suffix -%}\n    {%- set temp_relation = base_relation.incorporate(\n                                path={\"identifier\": temp_identifier}) -%}\n\n    {{ return(temp_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.789741, "supported_languages": null}, "macro.dbt.make_backup_relation": {"name": "make_backup_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_backup_relation", "macro_sql": "{% macro make_backup_relation(base_relation, backup_relation_type, suffix='__dbt_backup') %}\n    {{ return(adapter.dispatch('make_backup_relation', 'dbt')(base_relation, backup_relation_type, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_backup_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.789993, "supported_languages": null}, "macro.dbt.default__make_backup_relation": {"name": "default__make_backup_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_backup_relation", "macro_sql": "{% macro default__make_backup_relation(base_relation, backup_relation_type, suffix) %}\n    {%- set backup_identifier = base_relation.identifier ~ suffix -%}\n    {%- set backup_relation = base_relation.incorporate(\n                                  path={\"identifier\": backup_identifier},\n                                  type=backup_relation_type\n    ) -%}\n    {{ return(backup_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.790337, "supported_languages": null}, "macro.dbt.truncate_relation": {"name": "truncate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.truncate_relation", "macro_sql": "{% macro truncate_relation(relation) -%}\n  {{ return(adapter.dispatch('truncate_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__truncate_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.790533, "supported_languages": null}, "macro.dbt.default__truncate_relation": {"name": "default__truncate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__truncate_relation", "macro_sql": "{% macro default__truncate_relation(relation) -%}\n  {% call statement('truncate_relation') -%}\n    truncate table {{ relation }}\n  {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.790703, "supported_languages": null}, "macro.dbt.get_or_create_relation": {"name": "get_or_create_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.get_or_create_relation", "macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) -%}\n  {{ return(adapter.dispatch('get_or_create_relation', 'dbt')(database, schema, identifier, type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_or_create_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.79096, "supported_languages": null}, "macro.dbt.default__get_or_create_relation": {"name": "default__get_or_create_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__get_or_create_relation", "macro_sql": "{% macro default__get_or_create_relation(database, schema, identifier, type) %}\n  {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n  {% if target_relation %}\n    {% do return([true, target_relation]) %}\n  {% endif %}\n\n  {%- set new_relation = api.Relation.create(\n      database=database,\n      schema=schema,\n      identifier=identifier,\n      type=type\n  ) -%}\n  {% do return([false, new_relation]) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.791616, "supported_languages": null}, "macro.dbt.load_cached_relation": {"name": "load_cached_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.load_cached_relation", "macro_sql": "{% macro load_cached_relation(relation) %}\n  {% do return(adapter.get_relation(\n    database=relation.database,\n    schema=relation.schema,\n    identifier=relation.identifier\n  )) -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.791859, "supported_languages": null}, "macro.dbt.load_relation": {"name": "load_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.load_relation", "macro_sql": "{% macro load_relation(relation) %}\n    {{ return(load_cached_relation(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7920089, "supported_languages": null}, "macro.dbt.collect_freshness": {"name": "collect_freshness", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "unique_id": "macro.dbt.collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n  {{ return(adapter.dispatch('collect_freshness', 'dbt')(source, loaded_at_field, filter))}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.792446, "supported_languages": null}, "macro.dbt.default__collect_freshness": {"name": "default__collect_freshness", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "unique_id": "macro.dbt.default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n  {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n    select\n      max({{ loaded_at_field }}) as max_loaded_at,\n      {{ current_timestamp() }} as snapshotted_at\n    from {{ source }}\n    {% if filter %}\n    where {{ filter }}\n    {% endif %}\n  {% endcall %}\n  {{ return(load_result('collect_freshness')) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7928698, "supported_languages": null}, "macro.dbt.validate_sql": {"name": "validate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/validate_sql.sql", "original_file_path": "macros/adapters/validate_sql.sql", "unique_id": "macro.dbt.validate_sql", "macro_sql": "{% macro validate_sql(sql) -%}\n  {{ return(adapter.dispatch('validate_sql', 'dbt')(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__validate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.793159, "supported_languages": null}, "macro.dbt.default__validate_sql": {"name": "default__validate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/validate_sql.sql", "original_file_path": "macros/adapters/validate_sql.sql", "unique_id": "macro.dbt.default__validate_sql", "macro_sql": "{% macro default__validate_sql(sql) -%}\n  {% call statement('validate_sql') -%}\n    explain {{ sql }}\n  {% endcall %}\n  {{ return(load_result('validate_sql')) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7934248, "supported_languages": null}, "macro.dbt.copy_grants": {"name": "copy_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.copy_grants", "macro_sql": "{% macro copy_grants() %}\n    {{ return(adapter.dispatch('copy_grants', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__copy_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.795181, "supported_languages": null}, "macro.dbt.default__copy_grants": {"name": "default__copy_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__copy_grants", "macro_sql": "{% macro default__copy_grants() %}\n    {{ return(True) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7953029, "supported_languages": null}, "macro.dbt.support_multiple_grantees_per_dcl_statement": {"name": "support_multiple_grantees_per_dcl_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.support_multiple_grantees_per_dcl_statement", "macro_sql": "{% macro support_multiple_grantees_per_dcl_statement() %}\n    {{ return(adapter.dispatch('support_multiple_grantees_per_dcl_statement', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__support_multiple_grantees_per_dcl_statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7954812, "supported_languages": null}, "macro.dbt.default__support_multiple_grantees_per_dcl_statement": {"name": "default__support_multiple_grantees_per_dcl_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__support_multiple_grantees_per_dcl_statement", "macro_sql": "\n\n{%- macro default__support_multiple_grantees_per_dcl_statement() -%}\n    {{ return(True) }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.795598, "supported_languages": null}, "macro.dbt.should_revoke": {"name": "should_revoke", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.should_revoke", "macro_sql": "{% macro should_revoke(existing_relation, full_refresh_mode=True) %}\n\n    {% if not existing_relation %}\n        {#-- The table doesn't already exist, so no grants to copy over --#}\n        {{ return(False) }}\n    {% elif full_refresh_mode %}\n        {#-- The object is being REPLACED -- whether grants are copied over depends on the value of user config --#}\n        {{ return(copy_grants()) }}\n    {% else %}\n        {#-- The table is being merged/upserted/inserted -- grants will be carried over --#}\n        {{ return(True) }}\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.copy_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.795958, "supported_languages": null}, "macro.dbt.get_show_grant_sql": {"name": "get_show_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_show_grant_sql", "macro_sql": "{% macro get_show_grant_sql(relation) %}\n    {{ return(adapter.dispatch(\"get_show_grant_sql\", \"dbt\")(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_show_grant_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.79615, "supported_languages": null}, "macro.dbt.default__get_show_grant_sql": {"name": "default__get_show_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_show_grant_sql", "macro_sql": "{% macro default__get_show_grant_sql(relation) %}\n    show grants on {{ relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.796264, "supported_languages": null}, "macro.dbt.get_grant_sql": {"name": "get_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_grant_sql", "macro_sql": "{% macro get_grant_sql(relation, privilege, grantees) %}\n    {{ return(adapter.dispatch('get_grant_sql', 'dbt')(relation, privilege, grantees)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_grant_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.7965, "supported_languages": null}, "macro.dbt.default__get_grant_sql": {"name": "default__get_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_grant_sql", "macro_sql": "\n\n{%- macro default__get_grant_sql(relation, privilege, grantees) -%}\n    grant {{ privilege }} on {{ relation }} to {{ grantees | join(', ') }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.796693, "supported_languages": null}, "macro.dbt.get_revoke_sql": {"name": "get_revoke_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_revoke_sql", "macro_sql": "{% macro get_revoke_sql(relation, privilege, grantees) %}\n    {{ return(adapter.dispatch('get_revoke_sql', 'dbt')(relation, privilege, grantees)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_revoke_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.796932, "supported_languages": null}, "macro.dbt.default__get_revoke_sql": {"name": "default__get_revoke_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_revoke_sql", "macro_sql": "\n\n{%- macro default__get_revoke_sql(relation, privilege, grantees) -%}\n    revoke {{ privilege }} on {{ relation }} from {{ grantees | join(', ') }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.797125, "supported_languages": null}, "macro.dbt.get_dcl_statement_list": {"name": "get_dcl_statement_list", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_dcl_statement_list", "macro_sql": "{% macro get_dcl_statement_list(relation, grant_config, get_dcl_macro) %}\n    {{ return(adapter.dispatch('get_dcl_statement_list', 'dbt')(relation, grant_config, get_dcl_macro)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_dcl_statement_list"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.797361, "supported_languages": null}, "macro.dbt.default__get_dcl_statement_list": {"name": "default__get_dcl_statement_list", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_dcl_statement_list", "macro_sql": "\n\n{%- macro default__get_dcl_statement_list(relation, grant_config, get_dcl_macro) -%}\n    {#\n      -- Unpack grant_config into specific privileges and the set of users who need them granted/revoked.\n      -- Depending on whether this database supports multiple grantees per statement, pass in the list of\n      -- all grantees per privilege, or (if not) template one statement per privilege-grantee pair.\n      -- `get_dcl_macro` will be either `get_grant_sql` or `get_revoke_sql`\n    #}\n    {%- set dcl_statements = [] -%}\n    {%- for privilege, grantees in grant_config.items() %}\n        {%- if support_multiple_grantees_per_dcl_statement() and grantees -%}\n          {%- set dcl = get_dcl_macro(relation, privilege, grantees) -%}\n          {%- do dcl_statements.append(dcl) -%}\n        {%- else -%}\n          {%- for grantee in grantees -%}\n              {% set dcl = get_dcl_macro(relation, privilege, [grantee]) %}\n              {%- do dcl_statements.append(dcl) -%}\n          {% endfor -%}\n        {%- endif -%}\n    {%- endfor -%}\n    {{ return(dcl_statements) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.support_multiple_grantees_per_dcl_statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.798135, "supported_languages": null}, "macro.dbt.call_dcl_statements": {"name": "call_dcl_statements", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.call_dcl_statements", "macro_sql": "{% macro call_dcl_statements(dcl_statement_list) %}\n    {{ return(adapter.dispatch(\"call_dcl_statements\", \"dbt\")(dcl_statement_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__call_dcl_statements"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.798336, "supported_languages": null}, "macro.dbt.default__call_dcl_statements": {"name": "default__call_dcl_statements", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__call_dcl_statements", "macro_sql": "{% macro default__call_dcl_statements(dcl_statement_list) %}\n    {#\n      -- By default, supply all grant + revoke statements in a single semicolon-separated block,\n      -- so that they're all processed together.\n\n      -- Some databases do not support this. Those adapters will need to override this macro\n      -- to run each statement individually.\n    #}\n    {% call statement('grants') %}\n        {% for dcl_statement in dcl_statement_list %}\n            {{ dcl_statement }};\n        {% endfor %}\n    {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.798592, "supported_languages": null}, "macro.dbt.apply_grants": {"name": "apply_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.apply_grants", "macro_sql": "{% macro apply_grants(relation, grant_config, should_revoke) %}\n    {{ return(adapter.dispatch(\"apply_grants\", \"dbt\")(relation, grant_config, should_revoke)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.798835, "supported_languages": null}, "macro.dbt.default__apply_grants": {"name": "default__apply_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__apply_grants", "macro_sql": "{% macro default__apply_grants(relation, grant_config, should_revoke=True) %}\n    {#-- If grant_config is {} or None, this is a no-op --#}\n    {% if grant_config %}\n        {% if should_revoke %}\n            {#-- We think previous grants may have carried over --#}\n            {#-- Show current grants and calculate diffs --#}\n            {% set current_grants_table = run_query(get_show_grant_sql(relation)) %}\n            {% set current_grants_dict = adapter.standardize_grants_dict(current_grants_table) %}\n            {% set needs_granting = diff_of_two_dicts(grant_config, current_grants_dict) %}\n            {% set needs_revoking = diff_of_two_dicts(current_grants_dict, grant_config) %}\n            {% if not (needs_granting or needs_revoking) %}\n                {{ log('On ' ~ relation ~': All grants are in place, no revocation or granting needed.')}}\n            {% endif %}\n        {% else %}\n            {#-- We don't think there's any chance of previous grants having carried over. --#}\n            {#-- Jump straight to granting what the user has configured. --#}\n            {% set needs_revoking = {} %}\n            {% set needs_granting = grant_config %}\n        {% endif %}\n        {% if needs_granting or needs_revoking %}\n            {% set revoke_statement_list = get_dcl_statement_list(relation, needs_revoking, get_revoke_sql) %}\n            {% set grant_statement_list = get_dcl_statement_list(relation, needs_granting, get_grant_sql) %}\n            {% set dcl_statement_list = revoke_statement_list + grant_statement_list %}\n            {% if dcl_statement_list %}\n                {{ call_dcl_statements(dcl_statement_list) }}\n            {% endif %}\n        {% endif %}\n    {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.get_show_grant_sql", "macro.dbt.get_dcl_statement_list", "macro.dbt.call_dcl_statements"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.800027, "supported_languages": null}, "macro.dbt.get_show_sql": {"name": "get_show_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.get_show_sql", "macro_sql": "{% macro get_show_sql(compiled_code, sql_header, limit) -%}\n  {%- if sql_header -%}\n  {{ sql_header }}\n  {%- endif -%}\n  {%- if limit is not none -%}\n  {{ get_limit_subquery_sql(compiled_code, limit) }}\n  {%- else -%}\n  {{ compiled_code }}\n  {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_limit_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8005812, "supported_languages": null}, "macro.dbt.get_limit_subquery_sql": {"name": "get_limit_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.get_limit_subquery_sql", "macro_sql": "{% macro get_limit_subquery_sql(sql, limit) %}\n  {{ adapter.dispatch('get_limit_subquery_sql', 'dbt')(sql, limit) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_limit_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.800782, "supported_languages": null}, "macro.dbt.default__get_limit_subquery_sql": {"name": "default__get_limit_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.default__get_limit_subquery_sql", "macro_sql": "{% macro default__get_limit_subquery_sql(sql, limit) %}\n    select *\n    from (\n        {{ sql }}\n    ) as model_limit_subq\n    limit {{ limit }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.800925, "supported_languages": null}, "macro.dbt.alter_column_comment": {"name": "alter_column_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n  {{ return(adapter.dispatch('alter_column_comment', 'dbt')(relation, column_dict)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.801615, "supported_languages": null}, "macro.dbt.default__alter_column_comment": {"name": "default__alter_column_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.default__alter_column_comment", "macro_sql": "{% macro default__alter_column_comment(relation, column_dict) -%}\n  {{ exceptions.raise_not_implemented(\n    'alter_column_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.80179, "supported_languages": null}, "macro.dbt.alter_relation_comment": {"name": "alter_relation_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n  {{ return(adapter.dispatch('alter_relation_comment', 'dbt')(relation, relation_comment)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__alter_relation_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.802002, "supported_languages": null}, "macro.dbt.default__alter_relation_comment": {"name": "default__alter_relation_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.default__alter_relation_comment", "macro_sql": "{% macro default__alter_relation_comment(relation, relation_comment) -%}\n  {{ exceptions.raise_not_implemented(\n    'alter_relation_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.80218, "supported_languages": null}, "macro.dbt.persist_docs": {"name": "persist_docs", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n  {{ return(adapter.dispatch('persist_docs', 'dbt')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.802461, "supported_languages": null}, "macro.dbt.default__persist_docs": {"name": "default__persist_docs", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.default__persist_docs", "macro_sql": "{% macro default__persist_docs(relation, model, for_relation, for_columns) -%}\n  {% if for_relation and config.persist_relation_docs() and model.description %}\n    {% do run_query(alter_relation_comment(relation, model.description)) %}\n  {% endif %}\n\n  {% if for_columns and config.persist_column_docs() and model.columns %}\n    {% do run_query(alter_column_comment(relation, model.columns)) %}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.alter_relation_comment", "macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.802986, "supported_languages": null}, "macro.dbt.get_catalog_relations": {"name": "get_catalog_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_catalog_relations", "macro_sql": "{% macro get_catalog_relations(information_schema, relations) -%}\n  {{ return(adapter.dispatch('get_catalog_relations', 'dbt')(information_schema, relations)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_catalog_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8059058, "supported_languages": null}, "macro.dbt.default__get_catalog_relations": {"name": "default__get_catalog_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_catalog_relations", "macro_sql": "{% macro default__get_catalog_relations(information_schema, relations) -%}\n  {% set typename = adapter.type() %}\n  {% set msg -%}\n    get_catalog_relations not implemented for {{ typename }}\n  {%- endset %}\n\n  {{ exceptions.raise_compiler_error(msg) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.806178, "supported_languages": null}, "macro.dbt.get_catalog": {"name": "get_catalog", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n  {{ return(adapter.dispatch('get_catalog', 'dbt')(information_schema, schemas)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.806384, "supported_languages": null}, "macro.dbt.default__get_catalog": {"name": "default__get_catalog", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_catalog", "macro_sql": "{% macro default__get_catalog(information_schema, schemas) -%}\n\n  {% set typename = adapter.type() %}\n  {% set msg -%}\n    get_catalog not implemented for {{ typename }}\n  {%- endset %}\n\n  {{ exceptions.raise_compiler_error(msg) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8066509, "supported_languages": null}, "macro.dbt.information_schema_name": {"name": "information_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n  {{ return(adapter.dispatch('information_schema_name', 'dbt')(database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__information_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8068428, "supported_languages": null}, "macro.dbt.default__information_schema_name": {"name": "default__information_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__information_schema_name", "macro_sql": "{% macro default__information_schema_name(database) -%}\n  {%- if database -%}\n    {{ database }}.INFORMATION_SCHEMA\n  {%- else -%}\n    INFORMATION_SCHEMA\n  {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.807007, "supported_languages": null}, "macro.dbt.list_schemas": {"name": "list_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n  {{ return(adapter.dispatch('list_schemas', 'dbt')(database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__list_schemas"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.807192, "supported_languages": null}, "macro.dbt.default__list_schemas": {"name": "default__list_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__list_schemas", "macro_sql": "{% macro default__list_schemas(database) -%}\n  {% set sql %}\n    select distinct schema_name\n    from {{ information_schema_name(database) }}.SCHEMATA\n    where catalog_name ilike '{{ database }}'\n  {% endset %}\n  {{ return(run_query(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.information_schema_name", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.807518, "supported_languages": null}, "macro.dbt.check_schema_exists": {"name": "check_schema_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n  {{ return(adapter.dispatch('check_schema_exists', 'dbt')(information_schema, schema)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__check_schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.807729, "supported_languages": null}, "macro.dbt.default__check_schema_exists": {"name": "default__check_schema_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__check_schema_exists", "macro_sql": "{% macro default__check_schema_exists(information_schema, schema) -%}\n  {% set sql -%}\n        select count(*)\n        from {{ information_schema.replace(information_schema_view='SCHEMATA') }}\n        where catalog_name='{{ information_schema.database }}'\n          and schema_name='{{ schema }}'\n  {%- endset %}\n  {{ return(run_query(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.808044, "supported_languages": null}, "macro.dbt.list_relations_without_caching": {"name": "list_relations_without_caching", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n  {{ return(adapter.dispatch('list_relations_without_caching', 'dbt')(schema_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.808241, "supported_languages": null}, "macro.dbt.default__list_relations_without_caching": {"name": "default__list_relations_without_caching", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__list_relations_without_caching", "macro_sql": "{% macro default__list_relations_without_caching(schema_relation) %}\n  {{ exceptions.raise_not_implemented(\n    'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.808409, "supported_languages": null}, "macro.dbt.get_relations": {"name": "get_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_relations", "macro_sql": "{% macro get_relations() %}\n  {{ return(adapter.dispatch('get_relations', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.808584, "supported_languages": null}, "macro.dbt.default__get_relations": {"name": "default__get_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_relations", "macro_sql": "{% macro default__get_relations() %}\n  {{ exceptions.raise_not_implemented(\n    'get_relations macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.808745, "supported_languages": null}, "macro.dbt.get_relation_last_modified": {"name": "get_relation_last_modified", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_relation_last_modified", "macro_sql": "{% macro get_relation_last_modified(information_schema, relations) %}\n  {{ return(adapter.dispatch('get_relation_last_modified', 'dbt')(information_schema, relations)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_relation_last_modified"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8089652, "supported_languages": null}, "macro.dbt.default__get_relation_last_modified": {"name": "default__get_relation_last_modified", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_relation_last_modified", "macro_sql": "{% macro default__get_relation_last_modified(information_schema, relations) %}\n  {{ exceptions.raise_not_implemented(\n    'get_relation_last_modified macro not implemented for adapter ' + adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.809149, "supported_languages": null}, "macro.dbt.get_columns_in_relation": {"name": "get_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n  {{ return(adapter.dispatch('get_columns_in_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.811448, "supported_languages": null}, "macro.dbt.default__get_columns_in_relation": {"name": "default__get_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_columns_in_relation", "macro_sql": "{% macro default__get_columns_in_relation(relation) -%}\n  {{ exceptions.raise_not_implemented(\n    'get_columns_in_relation macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8116171, "supported_languages": null}, "macro.dbt.sql_convert_columns_in_relation": {"name": "sql_convert_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.sql_convert_columns_in_relation", "macro_sql": "{% macro sql_convert_columns_in_relation(table) -%}\n  {% set columns = [] %}\n  {% for row in table %}\n    {% do columns.append(api.Column(*row)) %}\n  {% endfor %}\n  {{ return(columns) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.811939, "supported_languages": null}, "macro.dbt.get_empty_subquery_sql": {"name": "get_empty_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_empty_subquery_sql", "macro_sql": "{% macro get_empty_subquery_sql(select_sql, select_sql_header=none) -%}\n  {{ return(adapter.dispatch('get_empty_subquery_sql', 'dbt')(select_sql, select_sql_header)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.81217, "supported_languages": null}, "macro.dbt.default__get_empty_subquery_sql": {"name": "default__get_empty_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_empty_subquery_sql", "macro_sql": "{% macro default__get_empty_subquery_sql(select_sql, select_sql_header=none) %}\n    {%- if select_sql_header is not none -%}\n    {{ select_sql_header }}\n    {%- endif -%}\n    select * from (\n        {{ select_sql }}\n    ) as __dbt_sbq\n    where false\n    limit 0\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.812385, "supported_languages": null}, "macro.dbt.get_empty_schema_sql": {"name": "get_empty_schema_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_empty_schema_sql", "macro_sql": "{% macro get_empty_schema_sql(columns) -%}\n  {{ return(adapter.dispatch('get_empty_schema_sql', 'dbt')(columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_empty_schema_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8125691, "supported_languages": null}, "macro.dbt.default__get_empty_schema_sql": {"name": "default__get_empty_schema_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_empty_schema_sql", "macro_sql": "{% macro default__get_empty_schema_sql(columns) %}\n    {%- set col_err = [] -%}\n    {%- set col_naked_numeric = [] -%}\n    select\n    {% for i in columns %}\n      {%- set col = columns[i] -%}\n      {%- if col['data_type'] is not defined -%}\n        {%- do col_err.append(col['name']) -%}\n      {#-- If this column's type is just 'numeric' then it is missing precision/scale, raise a warning --#}\n      {%- elif col['data_type'].strip().lower() in ('numeric', 'decimal', 'number') -%}\n        {%- do col_naked_numeric.append(col['name']) -%}\n      {%- endif -%}\n      {% set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] %}\n      cast(null as {{ col['data_type'] }}) as {{ col_name }}{{ \", \" if not loop.last }}\n    {%- endfor -%}\n    {%- if (col_err | length) > 0 -%}\n      {{ exceptions.column_type_missing(column_names=col_err) }}\n    {%- elif (col_naked_numeric | length) > 0 -%}\n      {{ exceptions.warn(\"Detected columns with numeric type and unspecified precision/scale, this can lead to unintended rounding: \" ~ col_naked_numeric ~ \"`\") }}\n    {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.813845, "supported_languages": null}, "macro.dbt.get_column_schema_from_query": {"name": "get_column_schema_from_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_column_schema_from_query", "macro_sql": "{% macro get_column_schema_from_query(select_sql, select_sql_header=none) -%}\n    {% set columns = [] %}\n    {# -- Using an 'empty subquery' here to get the same schema as the given select_sql statement, without necessitating a data scan.#}\n    {% set sql = get_empty_subquery_sql(select_sql, select_sql_header) %}\n    {% set column_schema = adapter.get_column_schema_from_query(sql) %}\n    {{ return(column_schema) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.814214, "supported_languages": null}, "macro.dbt.get_columns_in_query": {"name": "get_columns_in_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_columns_in_query", "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n  {{ return(adapter.dispatch('get_columns_in_query', 'dbt')(select_sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8144052, "supported_languages": null}, "macro.dbt.default__get_columns_in_query": {"name": "default__get_columns_in_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_columns_in_query", "macro_sql": "{% macro default__get_columns_in_query(select_sql) %}\n    {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n        {{ get_empty_subquery_sql(select_sql) }}\n    {% endcall %}\n    {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.814768, "supported_languages": null}, "macro.dbt.alter_column_type": {"name": "alter_column_type", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n  {{ return(adapter.dispatch('alter_column_type', 'dbt')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.815007, "supported_languages": null}, "macro.dbt.default__alter_column_type": {"name": "default__alter_column_type", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__alter_column_type", "macro_sql": "{% macro default__alter_column_type(relation, column_name, new_column_type) -%}\n  {#\n    1. Create a new column (w/ temp name and correct type)\n    2. Copy data over to it\n    3. Drop the existing column (cascade!)\n    4. Rename the new column to existing column\n  #}\n  {%- set tmp_column = column_name + \"__dbt_alter\" -%}\n\n  {% call statement('alter_column_type') %}\n    alter table {{ relation }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n    update {{ relation }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n    alter table {{ relation }} drop column {{ adapter.quote(column_name) }} cascade;\n    alter table {{ relation }} rename column {{ adapter.quote(tmp_column) }} to {{ adapter.quote(column_name) }}\n  {% endcall %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.815628, "supported_languages": null}, "macro.dbt.alter_relation_add_remove_columns": {"name": "alter_relation_add_remove_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.alter_relation_add_remove_columns", "macro_sql": "{% macro alter_relation_add_remove_columns(relation, add_columns = none, remove_columns = none) -%}\n  {{ return(adapter.dispatch('alter_relation_add_remove_columns', 'dbt')(relation, add_columns, remove_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__alter_relation_add_remove_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.815896, "supported_languages": null}, "macro.dbt.default__alter_relation_add_remove_columns": {"name": "default__alter_relation_add_remove_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__alter_relation_add_remove_columns", "macro_sql": "{% macro default__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n\n  {% if add_columns is none %}\n    {% set add_columns = [] %}\n  {% endif %}\n  {% if remove_columns is none %}\n    {% set remove_columns = [] %}\n  {% endif %}\n\n  {% set sql -%}\n\n     alter {{ relation.type }} {{ relation }}\n\n            {% for column in add_columns %}\n               add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n            {% endfor %}{{ ',' if add_columns and remove_columns }}\n\n            {% for column in remove_columns %}\n                drop column {{ column.name }}{{ ',' if not loop.last }}\n            {% endfor %}\n\n  {%- endset -%}\n\n  {% do run_query(sql) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.816715, "supported_languages": null}, "macro.dbt.resolve_model_name": {"name": "resolve_model_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.resolve_model_name", "macro_sql": "{% macro resolve_model_name(input_model_name) %}\n    {{ return(adapter.dispatch('resolve_model_name', 'dbt')(input_model_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.818374, "supported_languages": null}, "macro.dbt.default__resolve_model_name": {"name": "default__resolve_model_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.default__resolve_model_name", "macro_sql": "\n\n{%- macro default__resolve_model_name(input_model_name) -%}\n    {{  input_model_name | string | replace('\"', '\\\"') }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.818537, "supported_languages": null}, "macro.dbt.build_ref_function": {"name": "build_ref_function", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_ref_function", "macro_sql": "{% macro build_ref_function(model) %}\n\n    {%- set ref_dict = {} -%}\n    {%- for _ref in model.refs -%}\n        {% set _ref_args = [_ref.get('package'), _ref['name']] if _ref.get('package') else [_ref['name'],] %}\n        {%- set resolved = ref(*_ref_args, v=_ref.get('version')) -%}\n        {%- if _ref.get('version') -%}\n            {% do _ref_args.extend([\"v\" ~ _ref['version']]) %}\n        {%- endif -%}\n       {%- do ref_dict.update({_ref_args | join('.'): resolve_model_name(resolved)}) -%}\n    {%- endfor -%}\n\ndef ref(*args, **kwargs):\n    refs = {{ ref_dict | tojson }}\n    key = '.'.join(args)\n    version = kwargs.get(\"v\") or kwargs.get(\"version\")\n    if version:\n        key += f\".v{version}\"\n    dbt_load_df_function = kwargs.get(\"dbt_load_df_function\")\n    return dbt_load_df_function(refs[key])\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8193972, "supported_languages": null}, "macro.dbt.build_source_function": {"name": "build_source_function", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_source_function", "macro_sql": "{% macro build_source_function(model) %}\n\n    {%- set source_dict = {} -%}\n    {%- for _source in model.sources -%}\n        {%- set resolved = source(*_source) -%}\n        {%- do source_dict.update({_source | join('.'): resolve_model_name(resolved)}) -%}\n    {%- endfor -%}\n\ndef source(*args, dbt_load_df_function):\n    sources = {{ source_dict | tojson }}\n    key = '.'.join(args)\n    return dbt_load_df_function(sources[key])\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.819822, "supported_languages": null}, "macro.dbt.build_config_dict": {"name": "build_config_dict", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_config_dict", "macro_sql": "{% macro build_config_dict(model) %}\n    {%- set config_dict = {} -%}\n    {% set config_dbt_used = zip(model.config.config_keys_used, model.config.config_keys_defaults) | list %}\n    {%- for key, default in config_dbt_used -%}\n        {# weird type testing with enum, would be much easier to write this logic in Python! #}\n        {%- if key == \"language\" -%}\n          {%- set value = \"python\" -%}\n        {%- endif -%}\n        {%- set value = model.config.get(key, default) -%}\n        {%- do config_dict.update({key: value}) -%}\n    {%- endfor -%}\nconfig_dict = {{ config_dict }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.82043, "supported_languages": null}, "macro.dbt.py_script_postfix": {"name": "py_script_postfix", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.py_script_postfix", "macro_sql": "{% macro py_script_postfix(model) %}\n# This part is user provided model code\n# you will need to copy the next section to run the code\n# COMMAND ----------\n# this part is dbt logic for get ref work, do not modify\n\n{{ build_ref_function(model ) }}\n{{ build_source_function(model ) }}\n{{ build_config_dict(model) }}\n\nclass config:\n    def __init__(self, *args, **kwargs):\n        pass\n\n    @staticmethod\n    def get(key, default=None):\n        return config_dict.get(key, default)\n\nclass this:\n    \"\"\"dbt.this() or dbt.this.identifier\"\"\"\n    database = \"{{ this.database }}\"\n    schema = \"{{ this.schema }}\"\n    identifier = \"{{ this.identifier }}\"\n    {% set this_relation_name = resolve_model_name(this) %}\n    def __repr__(self):\n        return '{{ this_relation_name  }}'\n\n\nclass dbtObj:\n    def __init__(self, load_df_function) -> None:\n        self.source = lambda *args: source(*args, dbt_load_df_function=load_df_function)\n        self.ref = lambda *args, **kwargs: ref(*args, **kwargs, dbt_load_df_function=load_df_function)\n        self.config = config\n        self.this = this()\n        self.is_incremental = {{ is_incremental() }}\n\n# COMMAND ----------\n{{py_script_comment()}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.build_ref_function", "macro.dbt.build_source_function", "macro.dbt.build_config_dict", "macro.dbt.resolve_model_name", "macro.dbt.is_incremental", "macro.dbt.py_script_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.82092, "supported_languages": null}, "macro.dbt.py_script_comment": {"name": "py_script_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.py_script_comment", "macro_sql": "{%macro py_script_comment()%}\n{%endmacro%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.820993, "supported_languages": null}, "macro.dbt.test_unique": {"name": "test_unique", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_unique", "macro_sql": "{% test unique(model, column_name) %}\n    {% set macro = adapter.dispatch('test_unique', 'dbt') %}\n    {{ macro(model, column_name) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__test_unique"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.821511, "supported_languages": null}, "macro.dbt.test_not_null": {"name": "test_not_null", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_not_null", "macro_sql": "{% test not_null(model, column_name) %}\n    {% set macro = adapter.dispatch('test_not_null', 'dbt') %}\n    {{ macro(model, column_name) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.821748, "supported_languages": null}, "macro.dbt.test_accepted_values": {"name": "test_accepted_values", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_accepted_values", "macro_sql": "{% test accepted_values(model, column_name, values, quote=True) %}\n    {% set macro = adapter.dispatch('test_accepted_values', 'dbt') %}\n    {{ macro(model, column_name, values, quote) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.822047, "supported_languages": null}, "macro.dbt.test_relationships": {"name": "test_relationships", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_relationships", "macro_sql": "{% test relationships(model, column_name, to, field) %}\n    {% set macro = adapter.dispatch('test_relationships', 'dbt') %}\n    {{ macro(model, column_name, to, field) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_relationships"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.822334, "supported_languages": null}, "macro.dbt_utils.get_url_host": {"name": "get_url_host", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "unique_id": "macro.dbt_utils.get_url_host", "macro_sql": "{% macro get_url_host(field) -%}\n    {{ return(adapter.dispatch('get_url_host', 'dbt_utils')(field)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_host"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8226938, "supported_languages": null}, "macro.dbt_utils.default__get_url_host": {"name": "default__get_url_host", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "unique_id": "macro.dbt_utils.default__get_url_host", "macro_sql": "{% macro default__get_url_host(field) -%}\n\n{%- set parsed =\n    dbt.split_part(\n        dbt.split_part(\n            dbt.replace(\n                dbt.replace(\n                    dbt.replace(field, \"'android-app://'\", \"''\"\n                    ), \"'http://'\", \"''\"\n                ), \"'https://'\", \"''\"\n            ), \"'/'\", 1\n        ), \"'?'\", 1\n    )\n\n-%}\n\n\n    {{ dbt.safe_cast(\n        parsed,\n        dbt.type_string()\n        )}}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.split_part", "macro.dbt.replace", "macro.dbt.safe_cast", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8232582, "supported_languages": null}, "macro.dbt_utils.get_url_path": {"name": "get_url_path", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "unique_id": "macro.dbt_utils.get_url_path", "macro_sql": "{% macro get_url_path(field) -%}\n    {{ return(adapter.dispatch('get_url_path', 'dbt_utils')(field)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_path"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.823746, "supported_languages": null}, "macro.dbt_utils.default__get_url_path": {"name": "default__get_url_path", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "unique_id": "macro.dbt_utils.default__get_url_path", "macro_sql": "{% macro default__get_url_path(field) -%}\n\n    {%- set stripped_url =\n        dbt.replace(\n            dbt.replace(field, \"'http://'\", \"''\"), \"'https://'\", \"''\")\n    -%}\n\n    {%- set first_slash_pos -%}\n        coalesce(\n            nullif({{ dbt.position(\"'/'\", stripped_url) }}, 0),\n            {{ dbt.position(\"'?'\", stripped_url) }} - 1\n            )\n    {%- endset -%}\n\n    {%- set parsed_path =\n        dbt.split_part(\n            dbt.right(\n                stripped_url,\n                dbt.length(stripped_url) ~ \"-\" ~ first_slash_pos\n                ),\n            \"'?'\", 1\n            )\n    -%}\n\n    {{ dbt.safe_cast(\n        parsed_path,\n        dbt.type_string()\n    )}}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.replace", "macro.dbt.position", "macro.dbt.split_part", "macro.dbt.right", "macro.dbt.length", "macro.dbt.safe_cast", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.824438, "supported_languages": null}, "macro.dbt_utils.get_url_parameter": {"name": "get_url_parameter", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "unique_id": "macro.dbt_utils.get_url_parameter", "macro_sql": "{% macro get_url_parameter(field, url_parameter) -%}\n    {{ return(adapter.dispatch('get_url_parameter', 'dbt_utils')(field, url_parameter)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8247628, "supported_languages": null}, "macro.dbt_utils.default__get_url_parameter": {"name": "default__get_url_parameter", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "unique_id": "macro.dbt_utils.default__get_url_parameter", "macro_sql": "{% macro default__get_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"='\" -%}\n\n{%- set split = dbt.split_part(dbt.split_part(field, formatted_url_parameter, 2), \"'&'\", 1) -%}\n\nnullif({{ split }},'')\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.split_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.825094, "supported_languages": null}, "macro.dbt_utils.test_fewer_rows_than": {"name": "test_fewer_rows_than", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "unique_id": "macro.dbt_utils.test_fewer_rows_than", "macro_sql": "{% test fewer_rows_than(model, compare_model, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_fewer_rows_than', 'dbt_utils')(model, compare_model, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_fewer_rows_than"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.826199, "supported_languages": null}, "macro.dbt_utils.default__test_fewer_rows_than": {"name": "default__test_fewer_rows_than", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "unique_id": "macro.dbt_utils.default__test_fewer_rows_than", "macro_sql": "{% macro default__test_fewer_rows_than(model, compare_model, group_by_columns) %}\n\n{{ config(fail_calc = 'sum(coalesce(row_count_delta, 0))') }}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set join_gb_cols %}\n    {% for c in group_by_columns %}\n      and a.{{c}} = b.{{c}}\n    {% endfor %}\n  {% endset %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n{#-- We must add a fake join key in case additional grouping variables are not provided --#}\n{#-- Redshift does not allow for dynamically created join conditions (e.g. full join on 1 = 1 --#}\n{#-- The same logic is used in equal_rowcount. In case of changes, maintain consistent logic --#}\n{% set group_by_columns = ['id_dbtutils_test_fewer_rows_than'] + group_by_columns %}\n{% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n\n\nwith a as (\n\n    select \n      {{select_gb_cols}}\n      1 as id_dbtutils_test_fewer_rows_than,\n      count(*) as count_our_model \n    from {{ model }}\n    {{ groupby_gb_cols }}\n\n),\nb as (\n\n    select \n      {{select_gb_cols}}\n      1 as id_dbtutils_test_fewer_rows_than,\n      count(*) as count_comparison_model \n    from {{ compare_model }}\n    {{ groupby_gb_cols }}\n\n),\ncounts as (\n\n    select\n\n        {% for c in group_by_columns -%}\n          a.{{c}} as {{c}}_a,\n          b.{{c}} as {{c}}_b,\n        {% endfor %}\n\n        count_our_model,\n        count_comparison_model\n    from a\n    full join b on \n    a.id_dbtutils_test_fewer_rows_than = b.id_dbtutils_test_fewer_rows_than\n    {{ join_gb_cols }}\n\n),\nfinal as (\n\n    select *,\n        case\n            -- fail the test if we have more rows than the reference model and return the row count delta\n            when count_our_model > count_comparison_model then (count_our_model - count_comparison_model)\n            -- fail the test if they are the same number\n            when count_our_model = count_comparison_model then 1\n            -- pass the test if the delta is positive (i.e. return the number 0)\n            else 0\n    end as row_count_delta\n    from counts\n\n)\n\nselect * from final\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.827256, "supported_languages": null}, "macro.dbt_utils.test_equal_rowcount": {"name": "test_equal_rowcount", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "unique_id": "macro.dbt_utils.test_equal_rowcount", "macro_sql": "{% test equal_rowcount(model, compare_model, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_equal_rowcount', 'dbt_utils')(model, compare_model, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_equal_rowcount"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.82813, "supported_languages": null}, "macro.dbt_utils.default__test_equal_rowcount": {"name": "default__test_equal_rowcount", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "unique_id": "macro.dbt_utils.default__test_equal_rowcount", "macro_sql": "{% macro default__test_equal_rowcount(model, compare_model, group_by_columns) %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = 'sum(coalesce(diff_count, 0))') }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n    {{ return('') }}\n{% endif %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(', ') + ', ' %}\n  {% set join_gb_cols %}\n    {% for c in group_by_columns %}\n      and a.{{c}} = b.{{c}}\n    {% endfor %}\n  {% endset %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n{#-- We must add a fake join key in case additional grouping variables are not provided --#}\n{#-- Redshift does not allow for dynamically created join conditions (e.g. full join on 1 = 1 --#}\n{#-- The same logic is used in fewer_rows_than. In case of changes, maintain consistent logic --#}\n{% set group_by_columns = ['id_dbtutils_test_equal_rowcount'] + group_by_columns %}\n{% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n\nwith a as (\n\n    select \n      {{select_gb_cols}}\n      1 as id_dbtutils_test_equal_rowcount,\n      count(*) as count_a \n    from {{ model }}\n    {{groupby_gb_cols}}\n\n\n),\nb as (\n\n    select \n      {{select_gb_cols}}\n      1 as id_dbtutils_test_equal_rowcount,\n      count(*) as count_b \n    from {{ compare_model }}\n    {{groupby_gb_cols}}\n\n),\nfinal as (\n\n    select\n    \n        {% for c in group_by_columns -%}\n          a.{{c}} as {{c}}_a,\n          b.{{c}} as {{c}}_b,\n        {% endfor %}\n\n        count_a,\n        count_b,\n        abs(count_a - count_b) as diff_count\n\n    from a\n    full join b\n    on\n    a.id_dbtutils_test_equal_rowcount = b.id_dbtutils_test_equal_rowcount\n    {{join_gb_cols}}\n\n\n)\n\nselect * from final\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.829249, "supported_languages": null}, "macro.dbt_utils.test_relationships_where": {"name": "test_relationships_where", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "unique_id": "macro.dbt_utils.test_relationships_where", "macro_sql": "{% test relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n  {{ return(adapter.dispatch('test_relationships_where', 'dbt_utils')(model, column_name, to, field, from_condition, to_condition)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_relationships_where"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.829916, "supported_languages": null}, "macro.dbt_utils.default__test_relationships_where": {"name": "default__test_relationships_where", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "unique_id": "macro.dbt_utils.default__test_relationships_where", "macro_sql": "{% macro default__test_relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n\nwith left_table as (\n\n  select\n    {{column_name}} as id\n\n  from {{model}}\n\n  where {{column_name}} is not null\n    and {{from_condition}}\n\n),\n\nright_table as (\n\n  select\n    {{field}} as id\n\n  from {{to}}\n\n  where {{field}} is not null\n    and {{to_condition}}\n\n),\n\nexceptions as (\n\n  select\n    left_table.id,\n    right_table.id as right_id\n\n  from left_table\n\n  left join right_table\n         on left_table.id = right_table.id\n\n  where right_table.id is null\n\n)\n\nselect * from exceptions\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.830273, "supported_languages": null}, "macro.dbt_utils.test_recency": {"name": "test_recency", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "unique_id": "macro.dbt_utils.test_recency", "macro_sql": "{% test recency(model, field, datepart, interval, ignore_time_component=False, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_recency', 'dbt_utils')(model, field, datepart, interval, ignore_time_component, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_recency"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.831018, "supported_languages": null}, "macro.dbt_utils.default__test_recency": {"name": "default__test_recency", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "unique_id": "macro.dbt_utils.default__test_recency", "macro_sql": "{% macro default__test_recency(model, field, datepart, interval, ignore_time_component, group_by_columns) %}\n\n{% set threshold = 'cast(' ~ dbt.dateadd(datepart, interval * -1, dbt.current_timestamp()) ~ ' as ' ~ ('date' if ignore_time_component else dbt.type_timestamp()) ~ ')'  %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n\nwith recency as (\n\n    select \n\n      {{ select_gb_cols }}\n      {% if ignore_time_component %}\n        cast(max({{ field }}) as date) as most_recent\n      {%- else %}\n        max({{ field }}) as most_recent\n      {%- endif %}\n\n    from {{ model }}\n\n    {{ groupby_gb_cols }}\n\n)\n\nselect\n\n    {{ select_gb_cols }}\n    most_recent,\n    {{ threshold }} as threshold\n\nfrom recency\nwhere most_recent < {{ threshold }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.current_timestamp", "macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8318899, "supported_languages": null}, "macro.dbt_utils.test_not_constant": {"name": "test_not_constant", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "unique_id": "macro.dbt_utils.test_not_constant", "macro_sql": "{% test not_constant(model, column_name, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_not_constant', 'dbt_utils')(model, column_name, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_constant"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8323479, "supported_languages": null}, "macro.dbt_utils.default__test_not_constant": {"name": "default__test_not_constant", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "unique_id": "macro.dbt_utils.default__test_not_constant", "macro_sql": "{% macro default__test_not_constant(model, column_name, group_by_columns) %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n\nselect\n    {# In TSQL, subquery aggregate columns need aliases #}\n    {# thus: a filler col name, 'filler_column' #}\n    {{select_gb_cols}}\n    count(distinct {{ column_name }}) as filler_column\n\nfrom {{ model }}\n\n  {{groupby_gb_cols}}\n\nhaving count(distinct {{ column_name }}) = 1\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.832823, "supported_languages": null}, "macro.dbt_utils.test_accepted_range": {"name": "test_accepted_range", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "unique_id": "macro.dbt_utils.test_accepted_range", "macro_sql": "{% test accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n  {{ return(adapter.dispatch('test_accepted_range', 'dbt_utils')(model, column_name, min_value, max_value, inclusive)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_accepted_range"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.833442, "supported_languages": null}, "macro.dbt_utils.default__test_accepted_range": {"name": "default__test_accepted_range", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "unique_id": "macro.dbt_utils.default__test_accepted_range", "macro_sql": "{% macro default__test_accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n\nwith meet_condition as(\n  select *\n  from {{ model }}\n),\n\nvalidation_errors as (\n  select *\n  from meet_condition\n  where\n    -- never true, defaults to an empty result set. Exists to ensure any combo of the `or` clauses below succeeds\n    1 = 2\n\n  {%- if min_value is not none %}\n    -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.\n    or not {{ column_name }} > {{- \"=\" if inclusive }} {{ min_value }}\n  {%- endif %}\n\n  {%- if max_value is not none %}\n    -- records with a value <= max_value are permitted. The `not` flips this to find records that don't meet the rule.\n    or not {{ column_name }} < {{- \"=\" if inclusive }} {{ max_value }}\n  {%- endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8339489, "supported_languages": null}, "macro.dbt_utils.test_not_accepted_values": {"name": "test_not_accepted_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "unique_id": "macro.dbt_utils.test_not_accepted_values", "macro_sql": "{% test not_accepted_values(model, column_name, values, quote=True) %}\n  {{ return(adapter.dispatch('test_not_accepted_values', 'dbt_utils')(model, column_name, values, quote)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.834514, "supported_languages": null}, "macro.dbt_utils.default__test_not_accepted_values": {"name": "default__test_not_accepted_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "unique_id": "macro.dbt_utils.default__test_not_accepted_values", "macro_sql": "{% macro default__test_not_accepted_values(model, column_name, values, quote=True) %}\nwith all_values as (\n\n    select distinct\n        {{ column_name }} as value_field\n\n    from {{ model }}\n\n),\n\nvalidation_errors as (\n\n    select\n        value_field\n\n    from all_values\n    where value_field in (\n        {% for value in values -%}\n            {% if quote -%}\n            '{{ value }}'\n            {%- else -%}\n            {{ value }}\n            {%- endif -%}\n            {%- if not loop.last -%},{%- endif %}\n        {%- endfor %}\n        )\n\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8349729, "supported_languages": null}, "macro.dbt_utils.test_at_least_one": {"name": "test_at_least_one", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "unique_id": "macro.dbt_utils.test_at_least_one", "macro_sql": "{% test at_least_one(model, column_name, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_at_least_one', 'dbt_utils')(model, column_name, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_at_least_one"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8356428, "supported_languages": null}, "macro.dbt_utils.default__test_at_least_one": {"name": "default__test_at_least_one", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "unique_id": "macro.dbt_utils.default__test_at_least_one", "macro_sql": "{% macro default__test_at_least_one(model, column_name, group_by_columns) %}\n\n{% set pruned_cols = [column_name] %}\n\n{% if group_by_columns|length() > 0 %}\n\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n  {% set pruned_cols = group_by_columns %}\n\n  {% if column_name not in pruned_cols %}\n    {% do pruned_cols.append(column_name) %}\n  {% endif %}\n\n{% endif %}\n\n{% set select_pruned_cols = pruned_cols|join(' ,') %}\n\nselect *\nfrom (\n    with pruned_rows as (\n      select\n        {{ select_pruned_cols }}\n      from {{ model }}\n      where {{ column_name }} is not null\n      limit 1\n    )\n    select\n        {# In TSQL, subquery aggregate columns need aliases #}\n        {# thus: a filler col name, 'filler_column' #}\n      {{select_gb_cols}}\n      count({{ column_name }}) as filler_column\n\n    from pruned_rows\n\n    {{groupby_gb_cols}}\n\n    having count({{ column_name }}) = 0\n\n) validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.836473, "supported_languages": null}, "macro.dbt_utils.test_unique_combination_of_columns": {"name": "test_unique_combination_of_columns", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "unique_id": "macro.dbt_utils.test_unique_combination_of_columns", "macro_sql": "{% test unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n  {{ return(adapter.dispatch('test_unique_combination_of_columns', 'dbt_utils')(model, combination_of_columns, quote_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_combination_of_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.837112, "supported_languages": null}, "macro.dbt_utils.default__test_unique_combination_of_columns": {"name": "default__test_unique_combination_of_columns", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "unique_id": "macro.dbt_utils.default__test_unique_combination_of_columns", "macro_sql": "{% macro default__test_unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n\n{% if not quote_columns %}\n    {%- set column_list=combination_of_columns %}\n{% elif quote_columns %}\n    {%- set column_list=[] %}\n        {% for column in combination_of_columns -%}\n            {% set column_list = column_list.append( adapter.quote(column) ) %}\n        {%- endfor %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\n        \"`quote_columns` argument for unique_combination_of_columns test must be one of [True, False] Got: '\" ~ quote ~\"'.'\"\n    ) }}\n{% endif %}\n\n{%- set columns_csv=column_list | join(', ') %}\n\n\nwith validation_errors as (\n\n    select\n        {{ columns_csv }}\n    from {{ model }}\n    group by {{ columns_csv }}\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.837781, "supported_languages": null}, "macro.dbt_utils.test_cardinality_equality": {"name": "test_cardinality_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "unique_id": "macro.dbt_utils.test_cardinality_equality", "macro_sql": "{% test cardinality_equality(model, column_name, to, field) %}\n    {{ return(adapter.dispatch('test_cardinality_equality', 'dbt_utils')(model, column_name, to, field)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_cardinality_equality"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8383338, "supported_languages": null}, "macro.dbt_utils.default__test_cardinality_equality": {"name": "default__test_cardinality_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "unique_id": "macro.dbt_utils.default__test_cardinality_equality", "macro_sql": "{% macro default__test_cardinality_equality(model, column_name, to, field) %}\n\n{# T-SQL does not let you use numbers as aliases for columns #}\n{# Thus, no \"GROUP BY 1\" #}\n\nwith table_a as (\nselect\n  {{ column_name }},\n  count(*) as num_rows\nfrom {{ model }}\ngroup by {{ column_name }}\n),\n\ntable_b as (\nselect\n  {{ field }},\n  count(*) as num_rows\nfrom {{ to }}\ngroup by {{ field }}\n),\n\nexcept_a as (\n  select *\n  from table_a\n  {{ dbt.except() }}\n  select *\n  from table_b\n),\n\nexcept_b as (\n  select *\n  from table_b\n  {{ dbt.except() }}\n  select *\n  from table_a\n),\n\nunioned as (\n  select *\n  from except_a\n  union all\n  select *\n  from except_b\n)\n\nselect *\nfrom unioned\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.838697, "supported_languages": null}, "macro.dbt_utils.test_expression_is_true": {"name": "test_expression_is_true", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "unique_id": "macro.dbt_utils.test_expression_is_true", "macro_sql": "{% test expression_is_true(model, expression, column_name=None) %}\n  {{ return(adapter.dispatch('test_expression_is_true', 'dbt_utils')(model, expression, column_name)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.839108, "supported_languages": null}, "macro.dbt_utils.default__test_expression_is_true": {"name": "default__test_expression_is_true", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "unique_id": "macro.dbt_utils.default__test_expression_is_true", "macro_sql": "{% macro default__test_expression_is_true(model, expression, column_name) %}\n\n{% set column_list = '*' if should_store_failures() else \"1\" %}\n\nselect\n    {{ column_list }}\nfrom {{ model }}\n{% if column_name is none %}\nwhere not({{ expression }})\n{%- else %}\nwhere not({{ column_name }} {{ expression }})\n{%- endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_store_failures"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.839481, "supported_languages": null}, "macro.dbt_utils.test_not_null_proportion": {"name": "test_not_null_proportion", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "unique_id": "macro.dbt_utils.test_not_null_proportion", "macro_sql": "{% macro test_not_null_proportion(model, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_not_null_proportion', 'dbt_utils')(model, group_by_columns, **kwargs)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_proportion"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.840137, "supported_languages": null}, "macro.dbt_utils.default__test_not_null_proportion": {"name": "default__test_not_null_proportion", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "unique_id": "macro.dbt_utils.default__test_not_null_proportion", "macro_sql": "{% macro default__test_not_null_proportion(model, group_by_columns) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n{% set at_least = kwargs.get('at_least', kwargs.get('arg')) %}\n{% set at_most = kwargs.get('at_most', kwargs.get('arg', 1)) %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\nwith validation as (\n  select\n    {{select_gb_cols}}\n    sum(case when {{ column_name }} is null then 0 else 1 end) / cast(count(*) as numeric) as not_null_proportion\n  from {{ model }}\n  {{groupby_gb_cols}}\n),\nvalidation_errors as (\n  select\n    {{select_gb_cols}}\n    not_null_proportion\n  from validation\n  where not_null_proportion < {{ at_least }} or not_null_proportion > {{ at_most }}\n)\nselect\n  *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.840985, "supported_languages": null}, "macro.dbt_utils.test_sequential_values": {"name": "test_sequential_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "unique_id": "macro.dbt_utils.test_sequential_values", "macro_sql": "{% test sequential_values(model, column_name, interval=1, datepart=None, group_by_columns = []) %}\n\n  {{ return(adapter.dispatch('test_sequential_values', 'dbt_utils')(model, column_name, interval, datepart, group_by_columns)) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_sequential_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.841907, "supported_languages": null}, "macro.dbt_utils.default__test_sequential_values": {"name": "default__test_sequential_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "unique_id": "macro.dbt_utils.default__test_sequential_values", "macro_sql": "{% macro default__test_sequential_values(model, column_name, interval=1, datepart=None, group_by_columns = []) %}\n\n{% set previous_column_name = \"previous_\" ~ dbt_utils.slugify(column_name) %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(',') + ', ' %}\n  {% set partition_gb_cols = 'partition by ' + group_by_columns|join(',') %}\n{% endif %}\n\nwith windowed as (\n\n    select\n        {{ select_gb_cols }}\n        {{ column_name }},\n        lag({{ column_name }}) over (\n            {{partition_gb_cols}}\n            order by {{ column_name }}\n        ) as {{ previous_column_name }}\n    from {{ model }}\n),\n\nvalidation_errors as (\n    select\n        *\n    from windowed\n    {% if datepart %}\n    where not(cast({{ column_name }} as {{ dbt.type_timestamp() }})= cast({{ dbt.dateadd(datepart, interval, previous_column_name) }} as {{ dbt.type_timestamp() }}))\n    {% else %}\n    where not({{ column_name }} = {{ previous_column_name }} + {{ interval }})\n    {% endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.slugify", "macro.dbt.type_timestamp", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.842853, "supported_languages": null}, "macro.dbt_utils.test_equality": {"name": "test_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "unique_id": "macro.dbt_utils.test_equality", "macro_sql": "{% test equality(model, compare_model, compare_columns=None) %}\n  {{ return(adapter.dispatch('test_equality', 'dbt_utils')(model, compare_model, compare_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_equality"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8435872, "supported_languages": null}, "macro.dbt_utils.default__test_equality": {"name": "default__test_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "unique_id": "macro.dbt_utils.default__test_equality", "macro_sql": "{% macro default__test_equality(model, compare_model, compare_columns=None) %}\n\n{% set set_diff %}\n    count(*) + coalesce(abs(\n        sum(case when which_diff = 'a_minus_b' then 1 else 0 end) -\n        sum(case when which_diff = 'b_minus_a' then 1 else 0 end)\n    ), 0)\n{% endset %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = set_diff) }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n    {{ return('') }}\n{% endif %}\n\n-- setup\n{%- do dbt_utils._is_relation(model, 'test_equality') -%}\n\n{#-\nIf the compare_cols arg is provided, we can run this test without querying the\ninformation schema\u00a0\u2014 this allows the model to be an ephemeral model\n-#}\n\n{%- if not compare_columns -%}\n    {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n    {%- set compare_columns = adapter.get_columns_in_relation(model) | map(attribute='quoted') -%}\n{%- endif -%}\n\n{% set compare_cols_csv = compare_columns | join(', ') %}\n\nwith a as (\n\n    select * from {{ model }}\n\n),\n\nb as (\n\n    select * from {{ compare_model }}\n\n),\n\na_minus_b as (\n\n    select {{compare_cols_csv}} from a\n    {{ dbt.except() }}\n    select {{compare_cols_csv}} from b\n\n),\n\nb_minus_a as (\n\n    select {{compare_cols_csv}} from b\n    {{ dbt.except() }}\n    select {{compare_cols_csv}} from a\n\n),\n\nunioned as (\n\n    select 'a_minus_b' as which_diff, a_minus_b.* from a_minus_b\n    union all\n    select 'b_minus_a' as which_diff, b_minus_a.* from b_minus_a\n\n)\n\nselect * from unioned\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.844511, "supported_languages": null}, "macro.dbt_utils.test_not_empty_string": {"name": "test_not_empty_string", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_empty_string.sql", "original_file_path": "macros/generic_tests/not_empty_string.sql", "unique_id": "macro.dbt_utils.test_not_empty_string", "macro_sql": "{% test not_empty_string(model, column_name, trim_whitespace=true) %}\n\n  {{ return(adapter.dispatch('test_not_empty_string', 'dbt_utils')(model, column_name, trim_whitespace)) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_empty_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.845032, "supported_languages": null}, "macro.dbt_utils.default__test_not_empty_string": {"name": "default__test_not_empty_string", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_empty_string.sql", "original_file_path": "macros/generic_tests/not_empty_string.sql", "unique_id": "macro.dbt_utils.default__test_not_empty_string", "macro_sql": "{% macro default__test_not_empty_string(model, column_name, trim_whitespace=true) %}\n\n    with\n    \n    all_values as (\n\n        select \n\n\n            {% if trim_whitespace == true -%}\n\n                trim({{ column_name }}) as {{ column_name }}\n\n            {%- else -%}\n\n                {{ column_name }}\n\n            {%- endif %}\n            \n        from {{ model }}\n\n    ),\n\n    errors as (\n\n        select * from all_values\n        where {{ column_name }} = ''\n\n    )\n\n    select * from errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.845345, "supported_languages": null}, "macro.dbt_utils.test_mutually_exclusive_ranges": {"name": "test_mutually_exclusive_ranges", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "unique_id": "macro.dbt_utils.test_mutually_exclusive_ranges", "macro_sql": "{% test mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n  {{ return(adapter.dispatch('test_mutually_exclusive_ranges', 'dbt_utils')(model, lower_bound_column, upper_bound_column, partition_by, gaps, zero_length_range_allowed)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_mutually_exclusive_ranges"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.848795, "supported_languages": null}, "macro.dbt_utils.default__test_mutually_exclusive_ranges": {"name": "default__test_mutually_exclusive_ranges", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "unique_id": "macro.dbt_utils.default__test_mutually_exclusive_ranges", "macro_sql": "{% macro default__test_mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n{% if gaps == 'not_allowed' %}\n    {% set allow_gaps_operator='=' %}\n    {% set allow_gaps_operator_in_words='equal_to' %}\n{% elif gaps == 'allowed' %}\n    {% set allow_gaps_operator='<=' %}\n    {% set allow_gaps_operator_in_words='less_than_or_equal_to' %}\n{% elif gaps == 'required' %}\n    {% set allow_gaps_operator='<' %}\n    {% set allow_gaps_operator_in_words='less_than' %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\n        \"`gaps` argument for mutually_exclusive_ranges test must be one of ['not_allowed', 'allowed', 'required'] Got: '\" ~ gaps ~\"'.'\"\n    ) }}\n{% endif %}\n{% if not zero_length_range_allowed %}\n    {% set allow_zero_length_operator='<' %}\n    {% set allow_zero_length_operator_in_words='less_than' %}\n{% elif zero_length_range_allowed %}\n    {% set allow_zero_length_operator='<=' %}\n    {% set allow_zero_length_operator_in_words='less_than_or_equal_to' %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\n        \"`zero_length_range_allowed` argument for mutually_exclusive_ranges test must be one of [true, false] Got: '\" ~ zero_length_range_allowed ~\"'.'\"\n    ) }}\n{% endif %}\n\n{% set partition_clause=\"partition by \" ~ partition_by if partition_by else '' %}\n\nwith window_functions as (\n\n    select\n        {% if partition_by %}\n        {{ partition_by }} as partition_by_col,\n        {% endif %}\n        {{ lower_bound_column }} as lower_bound,\n        {{ upper_bound_column }} as upper_bound,\n\n        lead({{ lower_bound_column }}) over (\n            {{ partition_clause }}\n            order by {{ lower_bound_column }}, {{ upper_bound_column }}\n        ) as next_lower_bound,\n\n        row_number() over (\n            {{ partition_clause }}\n            order by {{ lower_bound_column }} desc, {{ upper_bound_column }} desc\n        ) = 1 as is_last_record\n\n    from {{ model }}\n\n),\n\ncalc as (\n    -- We want to return records where one of our assumptions fails, so we'll use\n    -- the `not` function with `and` statements so we can write our assumptions more cleanly\n    select\n        *,\n\n        -- For each record: lower_bound should be < upper_bound.\n        -- Coalesce it to return an error on the null case (implicit assumption\n        -- these columns are not_null)\n        coalesce(\n            lower_bound {{ allow_zero_length_operator }} upper_bound,\n            false\n        ) as lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound,\n\n        -- For each record: upper_bound {{ allow_gaps_operator }} the next lower_bound.\n        -- Coalesce it to handle null cases for the last record.\n        coalesce(\n            upper_bound {{ allow_gaps_operator }} next_lower_bound,\n            is_last_record,\n            false\n        ) as upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n\n    from window_functions\n\n),\n\nvalidation_errors as (\n\n    select\n        *\n    from calc\n\n    where not(\n        -- THE FOLLOWING SHOULD BE TRUE --\n        lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound\n        and upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n    )\n)\n\nselect * from validation_errors\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.850464, "supported_languages": null}, "macro.dbt_utils.pretty_log_format": {"name": "pretty_log_format", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "unique_id": "macro.dbt_utils.pretty_log_format", "macro_sql": "{% macro pretty_log_format(message) %}\n    {{ return(adapter.dispatch('pretty_log_format', 'dbt_utils')(message)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8507469, "supported_languages": null}, "macro.dbt_utils.default__pretty_log_format": {"name": "default__pretty_log_format", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "unique_id": "macro.dbt_utils.default__pretty_log_format", "macro_sql": "{% macro default__pretty_log_format(message) %}\n    {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.850919, "supported_languages": null}, "macro.dbt_utils._is_relation": {"name": "_is_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/_is_relation.sql", "original_file_path": "macros/jinja_helpers/_is_relation.sql", "unique_id": "macro.dbt_utils._is_relation", "macro_sql": "{% macro _is_relation(obj, macro) %}\n    {%- if not (obj is mapping and obj.get('metadata', {}).get('type', '').endswith('Relation')) -%}\n        {%- do exceptions.raise_compiler_error(\"Macro \" ~ macro ~ \" expected a Relation but received the value: \" ~ obj) -%}\n    {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.851375, "supported_languages": null}, "macro.dbt_utils.pretty_time": {"name": "pretty_time", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "unique_id": "macro.dbt_utils.pretty_time", "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n    {{ return(adapter.dispatch('pretty_time', 'dbt_utils')(format)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.851661, "supported_languages": null}, "macro.dbt_utils.default__pretty_time": {"name": "default__pretty_time", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "unique_id": "macro.dbt_utils.default__pretty_time", "macro_sql": "{% macro default__pretty_time(format='%H:%M:%S') %}\n    {{ return(modules.datetime.datetime.now().strftime(format)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.85187, "supported_languages": null}, "macro.dbt_utils.log_info": {"name": "log_info", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "unique_id": "macro.dbt_utils.log_info", "macro_sql": "{% macro log_info(message) %}\n    {{ return(adapter.dispatch('log_info', 'dbt_utils')(message)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__log_info"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.85213, "supported_languages": null}, "macro.dbt_utils.default__log_info": {"name": "default__log_info", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "unique_id": "macro.dbt_utils.default__log_info", "macro_sql": "{% macro default__log_info(message) %}\n    {{ log(dbt_utils.pretty_log_format(message), info=True) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.852308, "supported_languages": null}, "macro.dbt_utils.slugify": {"name": "slugify", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/slugify.sql", "original_file_path": "macros/jinja_helpers/slugify.sql", "unique_id": "macro.dbt_utils.slugify", "macro_sql": "{% macro slugify(string) %}\n\n{#- Lower case the string -#}\n{% set string = string | lower %}\n{#- Replace spaces and dashes with underscores -#}\n{% set string = modules.re.sub('[ -]+', '_', string) %}\n{#- Only take letters, numbers, and underscores -#}\n{% set string = modules.re.sub('[^a-z0-9_]+', '', string) %}\n{#- Prepends \"_\" if string begins with a number -#}\n{% set string = modules.re.sub('^[0-9]', '_' + string[0], string) %}\n\n{{ return(string) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.852944, "supported_languages": null}, "macro.dbt_utils._is_ephemeral": {"name": "_is_ephemeral", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/_is_ephemeral.sql", "original_file_path": "macros/jinja_helpers/_is_ephemeral.sql", "unique_id": "macro.dbt_utils._is_ephemeral", "macro_sql": "{% macro _is_ephemeral(obj, macro) %}\n    {%- if obj.is_cte -%}\n        {% set ephemeral_prefix = api.Relation.add_ephemeral_prefix('') %}\n        {% if obj.name.startswith(ephemeral_prefix) %}\n            {% set model_name = obj.name[(ephemeral_prefix|length):] %}\n        {% else %}\n            {% set model_name = obj.name %}\n        {%- endif -%}\n        {% set error_message %}\nThe `{{ macro }}` macro cannot be used with ephemeral models, as it relies on the information schema.\n\n`{{ model_name }}` is an ephemeral model. Consider making it a view or table instead.\n        {% endset %}\n        {%- do exceptions.raise_compiler_error(error_message) -%}\n    {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.853805, "supported_languages": null}, "macro.dbt_utils.get_intervals_between": {"name": "get_intervals_between", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n    {{ return(adapter.dispatch('get_intervals_between', 'dbt_utils')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.854514, "supported_languages": null}, "macro.dbt_utils.default__get_intervals_between": {"name": "default__get_intervals_between", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n    {%- call statement('get_intervals_between', fetch_result=True) %}\n\n        select {{ dbt.datediff(start_date, end_date, datepart) }}\n\n    {%- endcall -%}\n\n    {%- set value_list = load_result('get_intervals_between') -%}\n\n    {%- if value_list and value_list['data'] -%}\n        {%- set values = value_list['data'] | map(attribute=0) | list %}\n        {{ return(values[0]) }}\n    {%- else -%}\n        {{ return(1) }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.855131, "supported_languages": null}, "macro.dbt_utils.date_spine": {"name": "date_spine", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n    {{ return(adapter.dispatch('date_spine', 'dbt_utils')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8553731, "supported_languages": null}, "macro.dbt_utils.default__date_spine": {"name": "default__date_spine", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n{# call as follows:\n\ndate_spine(\n    \"day\",\n    \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n    \"dbt.dateadd(week, 1, current_date)\"\n) #}\n\n\nwith rawdata as (\n\n    {{dbt_utils.generate_series(\n        dbt_utils.get_intervals_between(start_date, end_date, datepart)\n    )}}\n\n),\n\nall_periods as (\n\n    select (\n        {{\n            dbt.dateadd(\n                datepart,\n                \"row_number() over (order by 1) - 1\",\n                start_date\n            )\n        }}\n    ) as date_{{datepart}}\n    from rawdata\n\n),\n\nfiltered as (\n\n    select *\n    from all_periods\n    where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.generate_series", "macro.dbt_utils.get_intervals_between", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8557498, "supported_languages": null}, "macro.dbt_utils.safe_subtract": {"name": "safe_subtract", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_subtract.sql", "original_file_path": "macros/sql/safe_subtract.sql", "unique_id": "macro.dbt_utils.safe_subtract", "macro_sql": "{%- macro safe_subtract(field_list) -%}\n    {{ return(adapter.dispatch('safe_subtract', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_subtract"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.856147, "supported_languages": null}, "macro.dbt_utils.default__safe_subtract": {"name": "default__safe_subtract", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_subtract.sql", "original_file_path": "macros/sql/safe_subtract.sql", "unique_id": "macro.dbt_utils.default__safe_subtract", "macro_sql": "\n\n{%- macro default__safe_subtract(field_list) -%}\n\n{%- if field_list is not iterable or field_list is string or field_list is mapping -%}\n\n{%- set error_message = '\nWarning: the `safe_subtract` macro takes a single list argument instead of \\\nstring arguments. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.raise_compiler_error(error_message) -%}\n\n{%- endif -%}\n\n{% set fields = [] %}\n\n{%- for field in field_list -%}\n\n    {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' -\\n  ') }}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.856715, "supported_languages": null}, "macro.dbt_utils.nullcheck_table": {"name": "nullcheck_table", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "unique_id": "macro.dbt_utils.nullcheck_table", "macro_sql": "{% macro nullcheck_table(relation) %}\n    {{ return(adapter.dispatch('nullcheck_table', 'dbt_utils')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.857035, "supported_languages": null}, "macro.dbt_utils.default__nullcheck_table": {"name": "default__nullcheck_table", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "unique_id": "macro.dbt_utils.default__nullcheck_table", "macro_sql": "{% macro default__nullcheck_table(relation) %}\n\n  {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%}\n  {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%}\n  {% set cols = adapter.get_columns_in_relation(relation) %}\n\n  select {{ dbt_utils.nullcheck(cols) }}\n  from {{relation}}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.857395, "supported_languages": null}, "macro.dbt_utils.get_relations_by_pattern": {"name": "get_relations_by_pattern", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "unique_id": "macro.dbt_utils.get_relations_by_pattern", "macro_sql": "{% macro get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {{ return(adapter.dispatch('get_relations_by_pattern', 'dbt_utils')(schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8580968, "supported_languages": null}, "macro.dbt_utils.default__get_relations_by_pattern": {"name": "default__get_relations_by_pattern", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "unique_id": "macro.dbt_utils.default__get_relations_by_pattern", "macro_sql": "{% macro default__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n    {%- call statement('get_tables', fetch_result=True) %}\n\n      {{ dbt_utils.get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude, database) }}\n\n    {%- endcall -%}\n\n    {%- set table_list = load_result('get_tables') -%}\n\n    {%- if table_list and table_list['table'] -%}\n        {%- set tbl_relations = [] -%}\n        {%- for row in table_list['table'] -%}\n            {%- set tbl_relation = api.Relation.create(\n                database=database,\n                schema=row.table_schema,\n                identifier=row.table_name,\n                type=row.table_type\n            ) -%}\n            {%- do tbl_relations.append(tbl_relation) -%}\n        {%- endfor -%}\n\n        {{ return(tbl_relations) }}\n    {%- else -%}\n        {{ return([]) }}\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.859074, "supported_languages": null}, "macro.dbt_utils.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n    {{ return(adapter.dispatch('get_powers_of_two', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8599522, "supported_languages": null}, "macro.dbt_utils.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n    {% if upper_bound <= 0 %}\n    {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n    {% endif %}\n\n    {% for _ in range(1, 100) %}\n       {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n    {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.860381, "supported_languages": null}, "macro.dbt_utils.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n    {{ return(adapter.dispatch('generate_series', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.860579, "supported_languages": null}, "macro.dbt_utils.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n    {% set n = dbt_utils.get_powers_of_two(upper_bound) %}\n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    {% for i in range(n) %}\n    p{{i}}.generated_number * power(2, {{i}})\n    {% if not loop.last %} + {% endif %}\n    {% endfor %}\n    + 1\n    as generated_number\n\n    from\n\n    {% for i in range(n) %}\n    p as p{{i}}\n    {% if not loop.last %} cross join {% endif %}\n    {% endfor %}\n\n    )\n\n    select *\n    from unioned\n    where generated_number <= {{upper_bound}}\n    order by generated_number\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.861121, "supported_languages": null}, "macro.dbt_utils.get_relations_by_prefix": {"name": "get_relations_by_prefix", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "unique_id": "macro.dbt_utils.get_relations_by_prefix", "macro_sql": "{% macro get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n    {{ return(adapter.dispatch('get_relations_by_prefix', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8618271, "supported_languages": null}, "macro.dbt_utils.default__get_relations_by_prefix": {"name": "default__get_relations_by_prefix", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "unique_id": "macro.dbt_utils.default__get_relations_by_prefix", "macro_sql": "{% macro default__get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n\n    {%- call statement('get_tables', fetch_result=True) %}\n\n      {{ dbt_utils.get_tables_by_prefix_sql(schema, prefix, exclude, database) }}\n\n    {%- endcall -%}\n\n    {%- set table_list = load_result('get_tables') -%}\n\n    {%- if table_list and table_list['table'] -%}\n        {%- set tbl_relations = [] -%}\n        {%- for row in table_list['table'] -%}\n            {%- set tbl_relation = api.Relation.create(\n                database=database,\n                schema=row.table_schema,\n                identifier=row.table_name,\n                type=row.table_type\n            ) -%}\n            {%- do tbl_relations.append(tbl_relation) -%}\n        {%- endfor -%}\n\n        {{ return(tbl_relations) }}\n    {%- else -%}\n        {{ return([]) }}\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8627179, "supported_languages": null}, "macro.dbt_utils.get_tables_by_prefix_sql": {"name": "get_tables_by_prefix_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "unique_id": "macro.dbt_utils.get_tables_by_prefix_sql", "macro_sql": "{% macro get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n    {{ return(adapter.dispatch('get_tables_by_prefix_sql', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8631349, "supported_languages": null}, "macro.dbt_utils.default__get_tables_by_prefix_sql": {"name": "default__get_tables_by_prefix_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "unique_id": "macro.dbt_utils.default__get_tables_by_prefix_sql", "macro_sql": "{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n\n    {{ dbt_utils.get_tables_by_pattern_sql(\n        schema_pattern = schema,\n        table_pattern = prefix ~ '%',\n        exclude = exclude,\n        database = database\n    ) }}\n    \n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.863439, "supported_languages": null}, "macro.dbt_utils.star": {"name": "star", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "unique_id": "macro.dbt_utils.star", "macro_sql": "{% macro star(from, relation_alias=False, except=[], prefix='', suffix='', quote_identifiers=True) -%}\r\n    {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix, quote_identifiers)) }}\r\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__star"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8647559, "supported_languages": null}, "macro.dbt_utils.default__star": {"name": "default__star", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "unique_id": "macro.dbt_utils.default__star", "macro_sql": "{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='', quote_identifiers=True) -%}\r\n    {%- do dbt_utils._is_relation(from, 'star') -%}\r\n    {%- do dbt_utils._is_ephemeral(from, 'star') -%}\r\n\r\n    {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\r\n    {%- if not execute -%}\r\n        {% do return('*') %}\r\n    {%- endif -%}\r\n\r\n    {% set cols = dbt_utils.get_filtered_columns_in_relation(from, except) %}\r\n\r\n    {%- if cols|length <= 0 -%}\r\n        {% if flags.WHICH == 'compile' %}\r\n            {% set response %}\r\n*\r\n/* No columns were returned. Maybe the relation doesn't exist yet \r\nor all columns were excluded. This star is only output during  \r\ndbt compile, and exists to keep SQLFluff happy. */\r\n            {% endset %}\r\n            {% do return(response) %}\r\n        {% else %}\r\n            {% do return(\"/* no columns returned from star() macro */\") %}\r\n        {% endif %}\r\n    {%- else -%}\r\n        {%- for col in cols %}\r\n            {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%}\r\n                {%- if quote_identifiers -%}\r\n                    {{ adapter.quote(col)|trim }} {%- if prefix!='' or suffix!='' %} as {{ adapter.quote(prefix ~ col ~ suffix)|trim }} {%- endif -%}\r\n                {%- else -%}\r\n                    {{ col|trim }} {%- if prefix!='' or suffix!='' %} as {{ (prefix ~ col ~ suffix)|trim }} {%- endif -%}\r\n                {% endif %}\r\n            {%- if not loop.last %},{{ '\\n  ' }}{%- endif -%}\r\n        {%- endfor -%}\r\n    {% endif %}\r\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.866242, "supported_languages": null}, "macro.dbt_utils.unpivot": {"name": "unpivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "unique_id": "macro.dbt_utils.unpivot", "macro_sql": "{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value') -%}\n    {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__unpivot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.867676, "supported_languages": null}, "macro.dbt_utils.default__unpivot": {"name": "default__unpivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "unique_id": "macro.dbt_utils.default__unpivot", "macro_sql": "{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value') -%}\n\n    {% if not relation %}\n        {{ exceptions.raise_compiler_error(\"Error: argument `relation` is required for `unpivot` macro.\") }}\n    {% endif %}\n\n  {%- set exclude = exclude if exclude is not none else [] %}\n  {%- set remove = remove if remove is not none else [] %}\n\n  {%- set include_cols = [] %}\n\n  {%- set table_columns = {} %}\n\n  {%- do table_columns.update({relation: []}) %}\n\n  {%- do dbt_utils._is_relation(relation, 'unpivot') -%}\n  {%- do dbt_utils._is_ephemeral(relation, 'unpivot') -%}\n  {%- set cols = adapter.get_columns_in_relation(relation) %}\n\n  {%- for col in cols -%}\n    {%- if col.column.lower() not in remove|map('lower') and col.column.lower() not in exclude|map('lower') -%}\n      {% do include_cols.append(col) %}\n    {%- endif %}\n  {%- endfor %}\n\n\n  {%- for col in include_cols -%}\n    select\n      {%- for exclude_col in exclude %}\n        {{ exclude_col }},\n      {%- endfor %}\n\n      cast('{{ col.column }}' as {{ dbt.type_string() }}) as {{ field_name }},\n      cast(  {% if col.data_type == 'boolean' %}\n           {{ dbt.cast_bool_to_text(col.column) }}\n             {% else %}\n           {{ col.column }}\n             {% endif %}\n           as {{ cast_to }}) as {{ value_name }}\n\n    from {{ relation }}\n\n    {% if not loop.last -%}\n      union all\n    {% endif -%}\n  {%- endfor -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.type_string", "macro.dbt.cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.869416, "supported_languages": null}, "macro.dbt_utils.safe_divide": {"name": "safe_divide", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_divide.sql", "original_file_path": "macros/sql/safe_divide.sql", "unique_id": "macro.dbt_utils.safe_divide", "macro_sql": "{% macro safe_divide(numerator, denominator) -%}\n  {{ return(adapter.dispatch('safe_divide', 'dbt_utils')(numerator, denominator)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_divide"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8697212, "supported_languages": null}, "macro.dbt_utils.default__safe_divide": {"name": "default__safe_divide", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_divide.sql", "original_file_path": "macros/sql/safe_divide.sql", "unique_id": "macro.dbt_utils.default__safe_divide", "macro_sql": "{% macro default__safe_divide(numerator, denominator) %}\n    ( {{ numerator }} ) / nullif( ( {{ denominator }} ), 0)\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8698602, "supported_languages": null}, "macro.dbt_utils.union_relations": {"name": "union_relations", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "unique_id": "macro.dbt_utils.union_relations", "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n    {{ return(adapter.dispatch('union_relations', 'dbt_utils')(relations, column_override, include, exclude, source_column_name, where)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__union_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8731809, "supported_languages": null}, "macro.dbt_utils.default__union_relations": {"name": "default__union_relations", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "unique_id": "macro.dbt_utils.default__union_relations", "macro_sql": "\n\n{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n\n    {%- if exclude and include -%}\n        {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n    {%- endif -%}\n\n    {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n    {%- if not execute %}\n        {{ return('') }}\n    {% endif -%}\n\n    {%- set column_override = column_override if column_override is not none else {} -%}\n\n    {%- set relation_columns = {} -%}\n    {%- set column_superset = {} -%}\n    {%- set all_excludes = [] -%}\n    {%- set all_includes = [] -%}\n\n    {%- if exclude -%}\n        {%- for exc in exclude -%}\n            {%- do all_excludes.append(exc | lower) -%}\n        {%- endfor -%}\n    {%- endif -%}\n\n    {%- if include -%}\n        {%- for inc in include -%}\n            {%- do all_includes.append(inc | lower) -%}\n        {%- endfor -%}\n    {%- endif -%}\n\n    {%- for relation in relations -%}\n\n        {%- do relation_columns.update({relation: []}) -%}\n\n        {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n        {%- do dbt_utils._is_ephemeral(relation, 'union_relations') -%}\n        {%- set cols = adapter.get_columns_in_relation(relation) -%}\n        {%- for col in cols -%}\n\n        {#- If an exclude list was provided and the column is in the list, do nothing -#}\n        {%- if exclude and col.column | lower in all_excludes -%}\n\n        {#- If an include list was provided and the column is not in the list, do nothing -#}\n        {%- elif include and col.column | lower not in all_includes -%}\n\n        {#- Otherwise add the column to the column superset -#}\n        {%- else -%}\n\n            {#- update the list of columns in this relation -#}\n            {%- do relation_columns[relation].append(col.column) -%}\n\n            {%- if col.column in column_superset -%}\n\n                {%- set stored = column_superset[col.column] -%}\n                {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n                    {%- do column_superset.update({col.column: col}) -%}\n\n                {%- endif %}\n\n            {%- else -%}\n\n                {%- do column_superset.update({col.column: col}) -%}\n\n            {%- endif -%}\n\n        {%- endif -%}\n\n        {%- endfor -%}\n    {%- endfor -%}\n\n    {%- set ordered_column_names = column_superset.keys() -%}\n    {%- set dbt_command = flags.WHICH -%}\n\n\n    {% if dbt_command in ['run', 'build'] %}\n    {% if (include | length > 0 or exclude | length > 0) and not column_superset.keys() %}\n        {%- set relations_string -%}\n            {%- for relation in relations -%}\n                {{ relation.name }}\n            {%- if not loop.last %}, {% endif -%}\n            {%- endfor -%}\n        {%- endset -%}\n\n        {%- set error_message -%}\n            There were no columns found to union for relations {{ relations_string }}\n        {%- endset -%}\n\n        {{ exceptions.raise_compiler_error(error_message) }}\n    {%- endif -%}\n    {%- endif -%}\n\n    {%- for relation in relations %}\n\n        (\n            select\n\n                {%- if source_column_name is not none %}\n                cast({{ dbt.string_literal(relation) }} as {{ dbt.type_string() }}) as {{ source_column_name }},\n                {%- endif %}\n\n                {% for col_name in ordered_column_names -%}\n\n                    {%- set col = column_superset[col_name] %}\n                    {%- set col_type = column_override.get(col.column, col.data_type) %}\n                    {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n                    cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n                {%- endfor %}\n\n            from {{ relation }}\n\n            {% if where -%}\n            where {{ where }}\n            {%- endif %}\n        )\n\n        {% if not loop.last -%}\n            union all\n        {% endif -%}\n\n    {%- endfor -%}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.string_literal", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8767948, "supported_languages": null}, "macro.dbt_utils.group_by": {"name": "group_by", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "unique_id": "macro.dbt_utils.group_by", "macro_sql": "{%- macro group_by(n) -%}\n    {{ return(adapter.dispatch('group_by', 'dbt_utils')(n)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__group_by"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.87711, "supported_languages": null}, "macro.dbt_utils.default__group_by": {"name": "default__group_by", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "unique_id": "macro.dbt_utils.default__group_by", "macro_sql": "\n\n{%- macro default__group_by(n) -%}\n\n  group by {% for i in range(1, n + 1) -%}\n      {{ i }}{{ ',' if not loop.last }}   \n   {%- endfor -%}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.877373, "supported_languages": null}, "macro.dbt_utils.deduplicate": {"name": "deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.deduplicate", "macro_sql": "{%- macro deduplicate(relation, partition_by, order_by) -%}\n    {{ return(adapter.dispatch('deduplicate', 'dbt_utils')(relation, partition_by, order_by)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.bigquery__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.878123, "supported_languages": null}, "macro.dbt_utils.default__deduplicate": {"name": "default__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.default__deduplicate", "macro_sql": "\n\n{%- macro default__deduplicate(relation, partition_by, order_by) -%}\n\n    with row_numbered as (\n        select\n            _inner.*,\n            row_number() over (\n                partition by {{ partition_by }}\n                order by {{ order_by }}\n            ) as rn\n        from {{ relation }} as _inner\n    )\n\n    select\n        distinct data.*\n    from {{ relation }} as data\n    {#\n    -- Not all DBs will support natural joins but the ones that do include:\n    -- Oracle, MySQL, SQLite, Redshift, Teradata, Materialize, Databricks\n    -- Apache Spark, SingleStore, Vertica\n    -- Those that do not appear to support natural joins include:\n    -- SQLServer, Trino, Presto, Rockset, Athena\n    #}\n    natural join row_numbered\n    where row_numbered.rn = 1\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.878352, "supported_languages": null}, "macro.dbt_utils.redshift__deduplicate": {"name": "redshift__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.redshift__deduplicate", "macro_sql": "{% macro redshift__deduplicate(relation, partition_by, order_by) -%}\n\n    {{ return(dbt_utils.default__deduplicate(relation, partition_by, order_by=order_by)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8785658, "supported_languages": null}, "macro.dbt_utils.postgres__deduplicate": {"name": "postgres__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.postgres__deduplicate", "macro_sql": "\n{%- macro postgres__deduplicate(relation, partition_by, order_by) -%}\n\n    select\n        distinct on ({{ partition_by }}) *\n    from {{ relation }}\n    order by {{ partition_by }}{{ ',' ~ order_by }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8787699, "supported_languages": null}, "macro.dbt_utils.snowflake__deduplicate": {"name": "snowflake__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.snowflake__deduplicate", "macro_sql": "\n{%- macro snowflake__deduplicate(relation, partition_by, order_by) -%}\n\n    select *\n    from {{ relation }}\n    qualify\n        row_number() over (\n            partition by {{ partition_by }}\n            order by {{ order_by }}\n        ) = 1\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.878946, "supported_languages": null}, "macro.dbt_utils.bigquery__deduplicate": {"name": "bigquery__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.bigquery__deduplicate", "macro_sql": "\n{%- macro bigquery__deduplicate(relation, partition_by, order_by) -%}\n\n    select unique.*\n    from (\n        select\n            array_agg (\n                original\n                order by {{ order_by }}\n                limit 1\n            )[offset(0)] unique\n        from {{ relation }} original\n        group by {{ partition_by }}\n    )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.879126, "supported_languages": null}, "macro.dbt_utils.surrogate_key": {"name": "surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "unique_id": "macro.dbt_utils.surrogate_key", "macro_sql": "{%- macro surrogate_key(field_list) -%}\n    {% set frustrating_jinja_feature = varargs %}\n    {{ return(adapter.dispatch('surrogate_key', 'dbt_utils')(field_list, *varargs)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.879518, "supported_languages": null}, "macro.dbt_utils.default__surrogate_key": {"name": "default__surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "unique_id": "macro.dbt_utils.default__surrogate_key", "macro_sql": "\n\n{%- macro default__surrogate_key(field_list) -%}\n\n{%- set error_message = '\nWarning: `dbt_utils.surrogate_key` has been replaced by \\\n`dbt_utils.generate_surrogate_key`. The new macro treats null values \\\ndifferently to empty strings. To restore the behaviour of the original \\\nmacro, add a global variable in dbt_project.yml called \\\n`surrogate_key_treat_nulls_as_empty_strings` to your \\\ndbt_project.yml file with a value of True. \\\nThe {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.raise_compiler_error(error_message) -%}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.879769, "supported_languages": null}, "macro.dbt_utils.safe_add": {"name": "safe_add", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "unique_id": "macro.dbt_utils.safe_add", "macro_sql": "{%- macro safe_add(field_list) -%}\n    {{ return(adapter.dispatch('safe_add', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_add"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.880158, "supported_languages": null}, "macro.dbt_utils.default__safe_add": {"name": "default__safe_add", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "unique_id": "macro.dbt_utils.default__safe_add", "macro_sql": "\n\n{%- macro default__safe_add(field_list) -%}\n\n{%- if field_list is not iterable or field_list is string or field_list is mapping -%}\n\n{%- set error_message = '\nWarning: the `safe_add` macro now takes a single list argument instead of \\\nstring arguments. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.warn(error_message) -%}\n\n{%- endif -%}\n\n{% set fields = [] %}\n\n{%- for field in field_list -%}\n\n    {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' +\\n  ') }}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8807192, "supported_languages": null}, "macro.dbt_utils.nullcheck": {"name": "nullcheck", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "unique_id": "macro.dbt_utils.nullcheck", "macro_sql": "{% macro nullcheck(cols) %}\n    {{ return(adapter.dispatch('nullcheck', 'dbt_utils')(cols)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.881078, "supported_languages": null}, "macro.dbt_utils.default__nullcheck": {"name": "default__nullcheck", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "unique_id": "macro.dbt_utils.default__nullcheck", "macro_sql": "{% macro default__nullcheck(cols) %}\n{%- for col in cols %}\n\n    {% if col.is_string() -%}\n\n    nullif({{col.name}},'') as {{col.name}}\n\n    {%- else -%}\n\n    {{col.name}}\n\n    {%- endif -%}\n\n{%- if not loop.last -%} , {%- endif -%}\n\n{%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.881429, "supported_languages": null}, "macro.dbt_utils.get_tables_by_pattern_sql": {"name": "get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.get_tables_by_pattern_sql", "macro_sql": "{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {{ return(adapter.dispatch('get_tables_by_pattern_sql', 'dbt_utils')\n        (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.bigquery__get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.883195, "supported_languages": null}, "macro.dbt_utils.default__get_tables_by_pattern_sql": {"name": "default__get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.default__get_tables_by_pattern_sql", "macro_sql": "{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n        select distinct\n            table_schema as {{ adapter.quote('table_schema') }},\n            table_name as {{ adapter.quote('table_name') }},\n            {{ dbt_utils.get_table_types_sql() }}\n        from {{ database }}.information_schema.tables\n        where table_schema ilike '{{ schema_pattern }}'\n        and table_name ilike '{{ table_pattern }}'\n        and table_name not ilike '{{ exclude }}'\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.883571, "supported_languages": null}, "macro.dbt_utils.bigquery__get_tables_by_pattern_sql": {"name": "bigquery__get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.bigquery__get_tables_by_pattern_sql", "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n    {% if '%' in schema_pattern %}\n        {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n    {% else %}\n        {% set schemata=[schema_pattern] %}\n    {% endif %}\n\n    {% set sql %}\n        {% for schema in schemata %}\n            select distinct\n                table_schema,\n                table_name,\n                {{ dbt_utils.get_table_types_sql() }}\n\n            from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES\n            where lower(table_name) like lower ('{{ table_pattern }}')\n                and lower(table_name) not like lower ('{{ exclude }}')\n\n            {% if not loop.last %} union all {% endif %}\n\n        {% endfor %}\n    {% endset %}\n\n    {{ return(sql) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._bigquery__get_matching_schemata", "macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.884507, "supported_languages": null}, "macro.dbt_utils._bigquery__get_matching_schemata": {"name": "_bigquery__get_matching_schemata", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils._bigquery__get_matching_schemata", "macro_sql": "{% macro _bigquery__get_matching_schemata(schema_pattern, database) %}\n    {% if execute %}\n\n        {% set sql %}\n        select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA\n        where lower(schema_name) like lower('{{ schema_pattern }}')\n        {% endset %}\n\n        {% set results=run_query(sql) %}\n\n        {% set schemata=results.columns['schema_name'].values() %}\n\n        {{ return(schemata) }}\n\n    {% else %}\n\n        {{ return([]) }}\n\n    {% endif %}\n\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.885037, "supported_languages": null}, "macro.dbt_utils.get_column_values": {"name": "get_column_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "unique_id": "macro.dbt_utils.get_column_values", "macro_sql": "{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n    {{ return(adapter.dispatch('get_column_values', 'dbt_utils')(table, column, order_by, max_records, default, where)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_column_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.886196, "supported_languages": null}, "macro.dbt_utils.default__get_column_values": {"name": "default__get_column_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "unique_id": "macro.dbt_utils.default__get_column_values", "macro_sql": "{% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n    {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n    {%- if not execute -%}\n        {% set default = [] if not default %}\n        {{ return(default) }}\n    {% endif %}\n\n    {%- do dbt_utils._is_ephemeral(table, 'get_column_values') -%}\n\n    {# Not all relations are tables. Renaming for internal clarity without breaking functionality for anyone using named arguments #}\n    {# TODO: Change the method signature in a future 0.x.0 release #}\n    {%- set target_relation = table -%}\n\n    {# adapter.load_relation is a convenience wrapper to avoid building a Relation when we already have one #}\n    {% set relation_exists = (load_relation(target_relation)) is not none %}\n\n    {%- call statement('get_column_values', fetch_result=true) %}\n\n        {%- if not relation_exists and default is none -%}\n\n          {{ exceptions.raise_compiler_error(\"In get_column_values(): relation \" ~ target_relation ~ \" does not exist and no default value was provided.\") }}\n\n        {%- elif not relation_exists and default is not none -%}\n\n          {{ log(\"Relation \" ~ target_relation ~ \" does not exist. Returning the default value: \" ~ default) }}\n\n          {{ return(default) }}\n\n        {%- else -%}\n\n\n            select\n                {{ column }} as value\n\n            from {{ target_relation }}\n\n            {% if where is not none %}\n            where {{ where }}\n            {% endif %}\n\n            group by {{ column }}\n            order by {{ order_by }}\n\n            {% if max_records is not none %}\n            limit {{ max_records }}\n            {% endif %}\n\n        {% endif %}\n\n    {%- endcall -%}\n\n    {%- set value_list = load_result('get_column_values') -%}\n\n    {%- if value_list and value_list['data'] -%}\n        {%- set values = value_list['data'] | map(attribute=0) | list %}\n        {{ return(values) }}\n    {%- else -%}\n        {{ return(default) }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_ephemeral", "macro.dbt.load_relation", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8877702, "supported_languages": null}, "macro.dbt_utils.pivot": {"name": "pivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "unique_id": "macro.dbt_utils.pivot", "macro_sql": "{% macro pivot(column,\n               values,\n               alias=True,\n               agg='sum',\n               cmp='=',\n               prefix='',\n               suffix='',\n               then_value=1,\n               else_value=0,\n               quote_identifiers=True,\n               distinct=False) %}\n    {{ return(adapter.dispatch('pivot', 'dbt_utils')(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pivot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.888858, "supported_languages": null}, "macro.dbt_utils.default__pivot": {"name": "default__pivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "unique_id": "macro.dbt_utils.default__pivot", "macro_sql": "{% macro default__pivot(column,\n               values,\n               alias=True,\n               agg='sum',\n               cmp='=',\n               prefix='',\n               suffix='',\n               then_value=1,\n               else_value=0,\n               quote_identifiers=True,\n               distinct=False) %}\n  {% for value in values %}\n    {{ agg }}(\n      {% if distinct %} distinct {% endif %}\n      case\n      when {{ column }} {{ cmp }} '{{ dbt.escape_single_quotes(value) }}'\n        then {{ then_value }}\n      else {{ else_value }}\n      end\n    )\n    {% if alias %}\n      {% if quote_identifiers %}\n            as {{ adapter.quote(prefix ~ value ~ suffix) }}\n      {% else %}\n        as {{ dbt_utils.slugify(prefix ~ value ~ suffix) }}\n      {% endif %}\n    {% endif %}\n    {% if not loop.last %},{% endif %}\n  {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.escape_single_quotes", "macro.dbt_utils.slugify"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.889739, "supported_languages": null}, "macro.dbt_utils.get_filtered_columns_in_relation": {"name": "get_filtered_columns_in_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "unique_id": "macro.dbt_utils.get_filtered_columns_in_relation", "macro_sql": "{% macro get_filtered_columns_in_relation(from, except=[]) -%}\n    {{ return(adapter.dispatch('get_filtered_columns_in_relation', 'dbt_utils')(from, except)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.890222, "supported_languages": null}, "macro.dbt_utils.default__get_filtered_columns_in_relation": {"name": "default__get_filtered_columns_in_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "unique_id": "macro.dbt_utils.default__get_filtered_columns_in_relation", "macro_sql": "{% macro default__get_filtered_columns_in_relation(from, except=[]) -%}\n    {%- do dbt_utils._is_relation(from, 'get_filtered_columns_in_relation') -%}\n    {%- do dbt_utils._is_ephemeral(from, 'get_filtered_columns_in_relation') -%}\n\n    {# -- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n    {%- if not execute -%}\n        {{ return('') }}\n    {% endif %}\n\n    {%- set include_cols = [] %}\n    {%- set cols = adapter.get_columns_in_relation(from) -%}\n    {%- set except = except | map(\"lower\") | list %}\n    {%- for col in cols -%}\n        {%- if col.column|lower not in except -%}\n            {% do include_cols.append(col.column) %}\n        {%- endif %}\n    {%- endfor %}\n\n    {{ return(include_cols) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.890979, "supported_languages": null}, "macro.dbt_utils.width_bucket": {"name": "width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.width_bucket", "macro_sql": "{% macro width_bucket(expr, min_value, max_value, num_buckets) %}\n  {{ return(adapter.dispatch('width_bucket', 'dbt_utils') (expr, min_value, max_value, num_buckets)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__width_bucket"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8917649, "supported_languages": null}, "macro.dbt_utils.default__width_bucket": {"name": "default__width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.default__width_bucket", "macro_sql": "{% macro default__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n    {% set bin_size -%}\n    (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n    {%- endset %}\n    (\n        -- to break ties when the amount is eaxtly at the bucket egde\n        case\n            when\n                mod(\n                    {{ dbt.safe_cast(expr, dbt.type_numeric() ) }},\n                    {{ dbt.safe_cast(bin_size, dbt.type_numeric() ) }}\n                ) = 0\n            then 1\n            else 0\n        end\n    ) +\n      -- Anything over max_value goes the N+1 bucket\n    least(\n        ceil(\n            ({{ expr }} - {{ min_value }})/{{ bin_size }}\n        ),\n        {{ num_buckets }} + 1\n    )\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.safe_cast", "macro.dbt.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.892249, "supported_languages": null}, "macro.dbt_utils.snowflake__width_bucket": {"name": "snowflake__width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.snowflake__width_bucket", "macro_sql": "{% macro snowflake__width_bucket(expr, min_value, max_value, num_buckets) %}\n    width_bucket({{ expr }}, {{ min_value }}, {{ max_value }}, {{ num_buckets }} )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.892447, "supported_languages": null}, "macro.dbt_utils.get_query_results_as_dict": {"name": "get_query_results_as_dict", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "unique_id": "macro.dbt_utils.get_query_results_as_dict", "macro_sql": "{% macro get_query_results_as_dict(query) %}\n    {{ return(adapter.dispatch('get_query_results_as_dict', 'dbt_utils')(query)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_query_results_as_dict"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.892847, "supported_languages": null}, "macro.dbt_utils.default__get_query_results_as_dict": {"name": "default__get_query_results_as_dict", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "unique_id": "macro.dbt_utils.default__get_query_results_as_dict", "macro_sql": "{% macro default__get_query_results_as_dict(query) %}\n\n{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #}\n\n    {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%}\n\n        {{ query }}\n\n    {%- endcall -%}\n\n    {% set sql_results={} %}\n\n    {%- if execute -%}\n        {% set sql_results_table = load_result('get_query_results').table.columns %}\n        {% for column_name, column in sql_results_table.items() %}\n            {% do sql_results.update({column_name: column.values()}) %}\n        {% endfor %}\n    {%- endif -%}\n\n    {{ return(sql_results) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.893467, "supported_languages": null}, "macro.dbt_utils.generate_surrogate_key": {"name": "generate_surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_surrogate_key.sql", "original_file_path": "macros/sql/generate_surrogate_key.sql", "unique_id": "macro.dbt_utils.generate_surrogate_key", "macro_sql": "{%- macro generate_surrogate_key(field_list) -%}\n    {{ return(adapter.dispatch('generate_surrogate_key', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__generate_surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.893939, "supported_languages": null}, "macro.dbt_utils.default__generate_surrogate_key": {"name": "default__generate_surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_surrogate_key.sql", "original_file_path": "macros/sql/generate_surrogate_key.sql", "unique_id": "macro.dbt_utils.default__generate_surrogate_key", "macro_sql": "\n\n{%- macro default__generate_surrogate_key(field_list) -%}\n\n{%- if var('surrogate_key_treat_nulls_as_empty_strings', False) -%}\n    {%- set default_null_value = \"\" -%}\n{%- else -%}\n    {%- set default_null_value = '_dbt_utils_surrogate_key_null_' -%}\n{%- endif -%}\n\n{%- set fields = [] -%}\n\n{%- for field in field_list -%}\n\n    {%- do fields.append(\n        \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt.type_string() ~ \"), '\" ~ default_null_value  ~\"')\"\n    ) -%}\n\n    {%- if not loop.last %}\n        {%- do fields.append(\"'-'\") -%}\n    {%- endif -%}\n\n{%- endfor -%}\n\n{{ dbt.hash(dbt.concat(fields)) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.hash", "macro.dbt.concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.894597, "supported_languages": null}, "macro.dbt_utils.get_table_types_sql": {"name": "get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.get_table_types_sql", "macro_sql": "{%- macro get_table_types_sql() -%}\n  {{ return(adapter.dispatch('get_table_types_sql', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_utils.default__get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8951318, "supported_languages": null}, "macro.dbt_utils.default__get_table_types_sql": {"name": "default__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.default__get_table_types_sql", "macro_sql": "{% macro default__get_table_types_sql() %}\n            case table_type\n                when 'BASE TABLE' then 'table'\n                when 'EXTERNAL TABLE' then 'external'\n                when 'MATERIALIZED VIEW' then 'materializedview'\n                else lower(table_type)\n            end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.895277, "supported_languages": null}, "macro.dbt_utils.postgres__get_table_types_sql": {"name": "postgres__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.postgres__get_table_types_sql", "macro_sql": "{% macro postgres__get_table_types_sql() %}\n            case table_type\n                when 'BASE TABLE' then 'table'\n                when 'FOREIGN' then 'external'\n                when 'MATERIALIZED VIEW' then 'materializedview'\n                else lower(table_type)\n            end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.895423, "supported_languages": null}, "macro.dbt_utils.databricks__get_table_types_sql": {"name": "databricks__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.databricks__get_table_types_sql", "macro_sql": "{% macro databricks__get_table_types_sql() %}\n            case table_type\n                when 'MANAGED' then 'table'\n                when 'BASE TABLE' then 'table'\n                when 'MATERIALIZED VIEW' then 'materializedview'\n                else lower(table_type)\n            end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8955672, "supported_languages": null}, "macro.dbt_utils.get_single_value": {"name": "get_single_value", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_single_value.sql", "original_file_path": "macros/sql/get_single_value.sql", "unique_id": "macro.dbt_utils.get_single_value", "macro_sql": "{% macro get_single_value(query, default=none) %}\n    {{ return(adapter.dispatch('get_single_value', 'dbt_utils')(query, default)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_single_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8961, "supported_languages": null}, "macro.dbt_utils.default__get_single_value": {"name": "default__get_single_value", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_single_value.sql", "original_file_path": "macros/sql/get_single_value.sql", "unique_id": "macro.dbt_utils.default__get_single_value", "macro_sql": "{% macro default__get_single_value(query, default) %}\n\n{# This macro returns the (0, 0) record in a query, i.e. the first row of the first column #}\n\n    {%- call statement('get_query_result', fetch_result=True, auto_begin=false) -%}\n\n        {{ query }}\n\n    {%- endcall -%}\n\n    {%- if execute -%}\n\n        {% set r = load_result('get_query_result').table.columns[0].values() %}\n        {% if r | length == 0 %}\n            {% do print('Query `' ~ query ~ '` returned no rows. Using the default value: ' ~ default) %}\n            {% set sql_result = default %}\n        {% else %}\n            {% set sql_result = r[0] %}\n        {% endif %}\n        \n    {%- else -%}\n    \n        {% set sql_result = default %}\n    \n    {%- endif -%}\n\n    {% do return(sql_result) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8969269, "supported_languages": null}, "macro.dbt_utils.degrees_to_radians": {"name": "degrees_to_radians", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.degrees_to_radians", "macro_sql": "{% macro degrees_to_radians(degrees) -%}\n    acos(-1) * {{degrees}} / 180\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.89803, "supported_languages": null}, "macro.dbt_utils.haversine_distance": {"name": "haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.haversine_distance", "macro_sql": "{% macro haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n    {{ return(adapter.dispatch('haversine_distance', 'dbt_utils')(lat1,lon1,lat2,lon2,unit)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.bigquery__haversine_distance"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.8983219, "supported_languages": null}, "macro.dbt_utils.default__haversine_distance": {"name": "default__haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{%- if unit == 'mi' %}\n    {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n    {% set conversion_rate = 1.60934 %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n\n    2 * 3961 * asin(sqrt(power((sin(radians(({{ lat2 }} - {{ lat1 }}) / 2))), 2) +\n    cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n    power((sin(radians(({{ lon2 }} - {{ lon1 }}) / 2))), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.898915, "supported_languages": null}, "macro.dbt_utils.bigquery__haversine_distance": {"name": "bigquery__haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.bigquery__haversine_distance", "macro_sql": "{% macro bigquery__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{% set radians_lat1 = dbt_utils.degrees_to_radians(lat1) %}\n{% set radians_lat2 = dbt_utils.degrees_to_radians(lat2) %}\n{% set radians_lon1 = dbt_utils.degrees_to_radians(lon1) %}\n{% set radians_lon2 = dbt_utils.degrees_to_radians(lon2) %}\n{%- if unit == 'mi' %}\n    {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n    {% set conversion_rate = 1.60934 %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n    2 * 3961 * asin(sqrt(power(sin(({{ radians_lat2 }} - {{ radians_lat1 }}) / 2), 2) +\n    cos({{ radians_lat1 }}) * cos({{ radians_lat2 }}) *\n    power(sin(({{ radians_lon2 }} - {{ radians_lon1 }}) / 2), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.degrees_to_radians"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.899751, "supported_languages": null}, "macro.spark_utils.get_tables": {"name": "get_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.get_tables", "macro_sql": "{% macro get_tables(table_regex_pattern='.*') %}\n\n  {% set tables = [] %}\n  {% for database in spark__list_schemas('not_used') %}\n    {% for table in spark__list_relations_without_caching(database[0]) %}\n      {% set db_tablename = database[0] ~ \".\" ~ table[1] %}\n      {% set is_match = modules.re.match(table_regex_pattern, db_tablename) %}\n      {% if is_match %}\n        {% call statement('table_detail', fetch_result=True) -%}\n          describe extended {{ db_tablename }}\n        {% endcall %}\n\n        {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('type', 'TYPE', 'Type'))|first %}\n        {% if table_type[1]|lower != 'view' %}\n          {{ tables.append(db_tablename) }}\n        {% endif %}\n      {% endif %}\n    {% endfor %}\n  {% endfor %}\n  {{ return(tables) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9052181, "supported_languages": null}, "macro.spark_utils.get_delta_tables": {"name": "get_delta_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.get_delta_tables", "macro_sql": "{% macro get_delta_tables(table_regex_pattern='.*') %}\n\n  {% set delta_tables = [] %}\n  {% for db_tablename in get_tables(table_regex_pattern) %}\n    {% call statement('table_detail', fetch_result=True) -%}\n      describe extended {{ db_tablename }}\n    {% endcall %}\n\n    {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('provider', 'PROVIDER', 'Provider'))|first %}\n    {% if table_type[1]|lower == 'delta' %}\n      {{ delta_tables.append(db_tablename) }}\n    {% endif %}\n  {% endfor %}\n  {{ return(delta_tables) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.905948, "supported_languages": null}, "macro.spark_utils.get_statistic_columns": {"name": "get_statistic_columns", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.get_statistic_columns", "macro_sql": "{% macro get_statistic_columns(table) %}\n\n  {% call statement('input_columns', fetch_result=True) %}\n    SHOW COLUMNS IN {{ table }}\n  {% endcall %}\n  {% set input_columns = load_result('input_columns').table %}\n\n  {% set output_columns = [] %}\n  {% for column in input_columns %}\n    {% call statement('column_information', fetch_result=True) %}\n      DESCRIBE TABLE {{ table }} `{{ column[0] }}`\n    {% endcall %}\n    {% if not load_result('column_information').table[1][1].startswith('struct') and not load_result('column_information').table[1][1].startswith('array')  %}\n      {{ output_columns.append('`' ~ column[0] ~ '`') }}\n    {% endif %}\n  {% endfor %}\n  {{ return(output_columns) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.906877, "supported_languages": null}, "macro.spark_utils.spark_optimize_delta_tables": {"name": "spark_optimize_delta_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.spark_optimize_delta_tables", "macro_sql": "{% macro spark_optimize_delta_tables(table_regex_pattern='.*') %}\n\n  {% for table in get_delta_tables(table_regex_pattern) %}\n    {% set start=modules.datetime.datetime.now() %}\n    {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Optimizing \" ~ table) }}\n    {% do run_query(\"optimize \" ~ table) %}\n    {% set end=modules.datetime.datetime.now() %}\n    {% set total_seconds = (end - start).total_seconds() | round(2)  %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n  {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9076521, "supported_languages": null}, "macro.spark_utils.spark_vacuum_delta_tables": {"name": "spark_vacuum_delta_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.spark_vacuum_delta_tables", "macro_sql": "{% macro spark_vacuum_delta_tables(table_regex_pattern='.*') %}\n\n  {% for table in get_delta_tables(table_regex_pattern) %}\n    {% set start=modules.datetime.datetime.now() %}\n    {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Vacuuming \" ~ table) }}\n    {% do run_query(\"vacuum \" ~ table) %}\n    {% set end=modules.datetime.datetime.now() %}\n    {% set total_seconds = (end - start).total_seconds() | round(2)  %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n  {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.908417, "supported_languages": null}, "macro.spark_utils.spark_analyze_tables": {"name": "spark_analyze_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.spark_analyze_tables", "macro_sql": "{% macro spark_analyze_tables(table_regex_pattern='.*') %}\n\n  {% for table in get_tables(table_regex_pattern) %}\n    {% set start=modules.datetime.datetime.now() %}\n    {% set columns = get_statistic_columns(table) | join(',') %}\n    {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Analyzing \" ~ table) }}\n    {% if columns != '' %}\n      {% do run_query(\"analyze table \" ~ table ~ \" compute statistics for columns \" ~ columns) %}\n    {% endif %}\n    {% set end=modules.datetime.datetime.now() %}\n    {% set total_seconds = (end - start).total_seconds() | round(2)  %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n  {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.spark_utils.get_statistic_columns", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.909434, "supported_languages": null}, "macro.spark_utils.spark__concat": {"name": "spark__concat", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/concat.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/concat.sql", "unique_id": "macro.spark_utils.spark__concat", "macro_sql": "{% macro spark__concat(fields) -%}\n    concat({{ fields|join(', ') }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.909615, "supported_languages": null}, "macro.spark_utils.spark__type_numeric": {"name": "spark__type_numeric", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "unique_id": "macro.spark_utils.spark__type_numeric", "macro_sql": "{% macro spark__type_numeric() %}\n    decimal(28, 6)\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9097269, "supported_languages": null}, "macro.spark_utils.spark__dateadd": {"name": "spark__dateadd", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "unique_id": "macro.spark_utils.spark__dateadd", "macro_sql": "{% macro spark__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n    {%- set clock_component -%}\n        {# make sure the dates + timestamps are real, otherwise raise an error asap #}\n        to_unix_timestamp({{ spark_utils.assert_not_null('to_timestamp', from_date_or_timestamp) }})\n        - to_unix_timestamp({{ spark_utils.assert_not_null('date', from_date_or_timestamp) }})\n    {%- endset -%}\n\n    {%- if datepart in ['day', 'week'] -%}\n        \n        {%- set multiplier = 7 if datepart == 'week' else 1 -%}\n\n        to_timestamp(\n            to_unix_timestamp(\n                date_add(\n                    {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n                    cast({{interval}} * {{multiplier}} as int)\n                )\n            ) + {{clock_component}}\n        )\n\n    {%- elif datepart in ['month', 'quarter', 'year'] -%}\n    \n        {%- set multiplier -%} \n            {%- if datepart == 'month' -%} 1\n            {%- elif datepart == 'quarter' -%} 3\n            {%- elif datepart == 'year' -%} 12\n            {%- endif -%}\n        {%- endset -%}\n\n        to_timestamp(\n            to_unix_timestamp(\n                add_months(\n                    {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n                    cast({{interval}} * {{multiplier}} as int)\n                )\n            ) + {{clock_component}}\n        )\n\n    {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n    \n        {%- set multiplier -%} \n            {%- if datepart == 'hour' -%} 3600\n            {%- elif datepart == 'minute' -%} 60\n            {%- elif datepart == 'second' -%} 1\n            {%- elif datepart == 'millisecond' -%} (1/1000000)\n            {%- elif datepart == 'microsecond' -%} (1/1000000)\n            {%- endif -%}\n        {%- endset -%}\n\n        to_timestamp(\n            {{ spark_utils.assert_not_null('to_unix_timestamp', from_date_or_timestamp) }}\n            + cast({{interval}} * {{multiplier}} as int)\n        )\n\n    {%- else -%}\n\n        {{ exceptions.raise_compiler_error(\"macro dateadd not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.912697, "supported_languages": null}, "macro.spark_utils.spark__datediff": {"name": "spark__datediff", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/datediff.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datediff.sql", "unique_id": "macro.spark_utils.spark__datediff", "macro_sql": "{% macro spark__datediff(first_date, second_date, datepart) %}\n\n    {%- if datepart in ['day', 'week', 'month', 'quarter', 'year'] -%}\n    \n        {# make sure the dates are real, otherwise raise an error asap #}\n        {% set first_date = spark_utils.assert_not_null('date', first_date) %}\n        {% set second_date = spark_utils.assert_not_null('date', second_date) %}\n    \n    {%- endif -%}\n    \n    {%- if datepart == 'day' -%}\n    \n        datediff({{second_date}}, {{first_date}})\n    \n    {%- elif datepart == 'week' -%}\n    \n        case when {{first_date}} < {{second_date}}\n            then floor(datediff({{second_date}}, {{first_date}})/7)\n            else ceil(datediff({{second_date}}, {{first_date}})/7)\n            end\n        \n        -- did we cross a week boundary (Sunday)?\n        + case\n            when {{first_date}} < {{second_date}} and dayofweek({{second_date}}) < dayofweek({{first_date}}) then 1\n            when {{first_date}} > {{second_date}} and dayofweek({{second_date}}) > dayofweek({{first_date}}) then -1\n            else 0 end\n\n    {%- elif datepart == 'month' -%}\n\n        case when {{first_date}} < {{second_date}}\n            then floor(months_between(date({{second_date}}), date({{first_date}})))\n            else ceil(months_between(date({{second_date}}), date({{first_date}})))\n            end\n        \n        -- did we cross a month boundary?\n        + case\n            when {{first_date}} < {{second_date}} and dayofmonth({{second_date}}) < dayofmonth({{first_date}}) then 1\n            when {{first_date}} > {{second_date}} and dayofmonth({{second_date}}) > dayofmonth({{first_date}}) then -1\n            else 0 end\n        \n    {%- elif datepart == 'quarter' -%}\n    \n        case when {{first_date}} < {{second_date}}\n            then floor(months_between(date({{second_date}}), date({{first_date}}))/3)\n            else ceil(months_between(date({{second_date}}), date({{first_date}}))/3)\n            end\n        \n        -- did we cross a quarter boundary?\n        + case\n            when {{first_date}} < {{second_date}} and (\n                (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n                < (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n            ) then 1\n            when {{first_date}} > {{second_date}} and (\n                (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n                > (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n            ) then -1\n            else 0 end\n\n    {%- elif datepart == 'year' -%}\n    \n        year({{second_date}}) - year({{first_date}})\n\n    {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n    \n        {%- set divisor -%} \n            {%- if datepart == 'hour' -%} 3600\n            {%- elif datepart == 'minute' -%} 60\n            {%- elif datepart == 'second' -%} 1\n            {%- elif datepart == 'millisecond' -%} (1/1000)\n            {%- elif datepart == 'microsecond' -%} (1/1000000)\n            {%- endif -%}\n        {%- endset -%}\n\n        case when {{first_date}} < {{second_date}}\n            then ceil((\n                {# make sure the timestamps are real, otherwise raise an error asap #}\n                {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n                - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n            ) / {{divisor}})\n            else floor((\n                {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n                - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n            ) / {{divisor}})\n            end\n            \n            {% if datepart == 'millisecond' %}\n                + cast(date_format({{second_date}}, 'SSS') as int)\n                - cast(date_format({{first_date}}, 'SSS') as int)\n            {% endif %}\n            \n            {% if datepart == 'microsecond' %}    \n                {% set capture_str = '[0-9]{4}-[0-9]{2}-[0-9]{2}.[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]{6})' %}\n                -- Spark doesn't really support microseconds, so this is a massive hack!\n                -- It will only work if the timestamp-string is of the format\n                -- 'yyyy-MM-dd-HH mm.ss.SSSSSS'\n                + cast(regexp_extract({{second_date}}, '{{capture_str}}', 1) as int)\n                - cast(regexp_extract({{first_date}}, '{{capture_str}}', 1) as int)    \n            {% endif %}\n\n    {%- else -%}\n\n        {{ exceptions.raise_compiler_error(\"macro datediff not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.920376, "supported_languages": null}, "macro.spark_utils.spark__current_timestamp": {"name": "spark__current_timestamp", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "unique_id": "macro.spark_utils.spark__current_timestamp", "macro_sql": "{% macro spark__current_timestamp() %}\n    current_timestamp()\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.920521, "supported_languages": null}, "macro.spark_utils.spark__current_timestamp_in_utc": {"name": "spark__current_timestamp_in_utc", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "unique_id": "macro.spark_utils.spark__current_timestamp_in_utc", "macro_sql": "{% macro spark__current_timestamp_in_utc() %}\n    unix_timestamp()\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.920598, "supported_languages": null}, "macro.spark_utils.spark__split_part": {"name": "spark__split_part", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/split_part.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/split_part.sql", "unique_id": "macro.spark_utils.spark__split_part", "macro_sql": "{% macro spark__split_part(string_text, delimiter_text, part_number) %}\n\n    {% set delimiter_expr %}\n    \n        -- escape if starts with a special character\n        case when regexp_extract({{ delimiter_text }}, '([^A-Za-z0-9])(.*)', 1) != '_'\n            then concat('\\\\', {{ delimiter_text }})\n            else {{ delimiter_text }} end\n    \n    {% endset %}\n\n    {% set split_part_expr %}\n    \n    split(\n        {{ string_text }},\n        {{ delimiter_expr }}\n        )[({{ part_number - 1 }})]\n    \n    {% endset %}\n    \n    {{ return(split_part_expr) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.921191, "supported_languages": null}, "macro.spark_utils.spark__get_relations_by_pattern": {"name": "spark__get_relations_by_pattern", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "unique_id": "macro.spark_utils.spark__get_relations_by_pattern", "macro_sql": "{% macro spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n    {%- call statement('get_tables', fetch_result=True) %}\n\n        show table extended in {{ schema_pattern }} like '{{ table_pattern }}'\n\n    {%- endcall -%}\n\n    {%- set table_list = load_result('get_tables') -%}\n\n    {%- if table_list and table_list['table'] -%}\n    {%- set tbl_relations = [] -%}\n    {%- for row in table_list['table'] -%}\n        {%- set tbl_relation = api.Relation.create(\n            database=None,\n            schema=row[0],\n            identifier=row[1],\n            type=('view' if 'Type: VIEW' in row[3] else 'table')\n        ) -%}\n        {%- do tbl_relations.append(tbl_relation) -%}\n    {%- endfor -%}\n\n    {{ return(tbl_relations) }}\n    {%- else -%}\n    {{ return([]) }}\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.922828, "supported_languages": null}, "macro.spark_utils.spark__get_relations_by_prefix": {"name": "spark__get_relations_by_prefix", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "unique_id": "macro.spark_utils.spark__get_relations_by_prefix", "macro_sql": "{% macro spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {% set table_pattern = table_pattern ~ '*' %}\n    {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.923178, "supported_languages": null}, "macro.spark_utils.spark__get_tables_by_pattern": {"name": "spark__get_tables_by_pattern", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "unique_id": "macro.spark_utils.spark__get_tables_by_pattern", "macro_sql": "{% macro spark__get_tables_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.923467, "supported_languages": null}, "macro.spark_utils.spark__get_tables_by_prefix": {"name": "spark__get_tables_by_prefix", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "unique_id": "macro.spark_utils.spark__get_tables_by_prefix", "macro_sql": "{% macro spark__get_tables_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {{ return(spark_utils.spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.923754, "supported_languages": null}, "macro.spark_utils.assert_not_null": {"name": "assert_not_null", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "unique_id": "macro.spark_utils.assert_not_null", "macro_sql": "{% macro assert_not_null(function, arg) -%}\n  {{ return(adapter.dispatch('assert_not_null', 'spark_utils')(function, arg)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.spark_utils.default__assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9240801, "supported_languages": null}, "macro.spark_utils.default__assert_not_null": {"name": "default__assert_not_null", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "unique_id": "macro.spark_utils.default__assert_not_null", "macro_sql": "{% macro default__assert_not_null(function, arg) %}\n\n    coalesce({{function}}({{arg}}), nvl2({{function}}({{arg}}), assert_true({{function}}({{arg}}) is not null), null))\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.924284, "supported_languages": null}, "macro.spark_utils.spark__convert_timezone": {"name": "spark__convert_timezone", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/snowplow/convert_timezone.sql", "original_file_path": "macros/snowplow/convert_timezone.sql", "unique_id": "macro.spark_utils.spark__convert_timezone", "macro_sql": "{% macro spark__convert_timezone(in_tz, out_tz, in_timestamp) %}\n    from_utc_timestamp(to_utc_timestamp({{in_timestamp}}, {{in_tz}}), {{out_tz}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9244952, "supported_languages": null}, "macro.dbt_date.get_date_dimension": {"name": "get_date_dimension", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_date_dimension.sql", "original_file_path": "macros/get_date_dimension.sql", "unique_id": "macro.dbt_date.get_date_dimension", "macro_sql": "{% macro get_date_dimension(start_date, end_date) %}\n    {{ adapter.dispatch('get_date_dimension', 'dbt_date') (start_date, end_date) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__get_date_dimension"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.933038, "supported_languages": null}, "macro.dbt_date.default__get_date_dimension": {"name": "default__get_date_dimension", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_date_dimension.sql", "original_file_path": "macros/get_date_dimension.sql", "unique_id": "macro.dbt_date.default__get_date_dimension", "macro_sql": "{% macro default__get_date_dimension(start_date, end_date) %}\nwith base_dates as (\n    {{ dbt_date.get_base_dates(start_date, end_date) }}\n),\ndates_with_prior_year_dates as (\n\n    select\n        cast(d.date_day as date) as date_day,\n        cast({{ dbt.dateadd('year', -1 , 'd.date_day') }} as date) as prior_year_date_day,\n        cast({{ dbt.dateadd('day', -364 , 'd.date_day') }} as date) as prior_year_over_year_date_day\n    from\n    \tbase_dates d\n\n)\nselect\n    d.date_day,\n    {{ dbt_date.yesterday('d.date_day') }} as prior_date_day,\n    {{ dbt_date.tomorrow('d.date_day') }} as next_date_day,\n    d.prior_year_date_day as prior_year_date_day,\n    d.prior_year_over_year_date_day,\n    {{ dbt_date.day_of_week('d.date_day', isoweek=false) }} as day_of_week,\n    {{ dbt_date.day_of_week('d.date_day', isoweek=true) }} as day_of_week_iso,\n    {{ dbt_date.day_name('d.date_day', short=false) }} as day_of_week_name,\n    {{ dbt_date.day_name('d.date_day', short=true) }} as day_of_week_name_short,\n    {{ dbt_date.day_of_month('d.date_day') }} as day_of_month,\n    {{ dbt_date.day_of_year('d.date_day') }} as day_of_year,\n\n    {{ dbt_date.week_start('d.date_day') }} as week_start_date,\n    {{ dbt_date.week_end('d.date_day') }} as week_end_date,\n    {{ dbt_date.week_start('d.prior_year_over_year_date_day') }} as prior_year_week_start_date,\n    {{ dbt_date.week_end('d.prior_year_over_year_date_day') }} as prior_year_week_end_date,\n    {{ dbt_date.week_of_year('d.date_day') }} as week_of_year,\n\n    {{ dbt_date.iso_week_start('d.date_day') }} as iso_week_start_date,\n    {{ dbt_date.iso_week_end('d.date_day') }} as iso_week_end_date,\n    {{ dbt_date.iso_week_start('d.prior_year_over_year_date_day') }} as prior_year_iso_week_start_date,\n    {{ dbt_date.iso_week_end('d.prior_year_over_year_date_day') }} as prior_year_iso_week_end_date,\n    {{ dbt_date.iso_week_of_year('d.date_day') }} as iso_week_of_year,\n\n    {{ dbt_date.week_of_year('d.prior_year_over_year_date_day') }} as prior_year_week_of_year,\n    {{ dbt_date.iso_week_of_year('d.prior_year_over_year_date_day') }} as prior_year_iso_week_of_year,\n\n    cast({{ dbt_date.date_part('month', 'd.date_day') }} as {{ dbt.type_int() }}) as month_of_year,\n    {{ dbt_date.month_name('d.date_day', short=false) }}  as month_name,\n    {{ dbt_date.month_name('d.date_day', short=true) }}  as month_name_short,\n\n    cast({{ dbt.date_trunc('month', 'd.date_day') }} as date) as month_start_date,\n    cast({{ last_day('d.date_day', 'month') }} as date) as month_end_date,\n\n    cast({{ dbt.date_trunc('month', 'd.prior_year_date_day') }} as date) as prior_year_month_start_date,\n    cast({{ last_day('d.prior_year_date_day', 'month') }} as date) as prior_year_month_end_date,\n\n    cast({{ dbt_date.date_part('quarter', 'd.date_day') }} as {{ dbt.type_int() }}) as quarter_of_year,\n    cast({{ dbt.date_trunc('quarter', 'd.date_day') }} as date) as quarter_start_date,\n    cast({{ last_day('d.date_day', 'quarter') }} as date) as quarter_end_date,\n\n    cast({{ dbt_date.date_part('year', 'd.date_day') }} as {{ dbt.type_int() }}) as year_number,\n    cast({{ dbt.date_trunc('year', 'd.date_day') }} as date) as year_start_date,\n    cast({{ last_day('d.date_day', 'year') }} as date) as year_end_date\nfrom\n    dates_with_prior_year_dates d\norder by 1\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.get_base_dates", "macro.dbt.dateadd", "macro.dbt_date.yesterday", "macro.dbt_date.tomorrow", "macro.dbt_date.day_of_week", "macro.dbt_date.day_name", "macro.dbt_date.day_of_month", "macro.dbt_date.day_of_year", "macro.dbt_date.week_start", "macro.dbt_date.week_end", "macro.dbt_date.week_of_year", "macro.dbt_date.iso_week_start", "macro.dbt_date.iso_week_end", "macro.dbt_date.iso_week_of_year", "macro.dbt_date.date_part", "macro.dbt.type_int", "macro.dbt_date.month_name", "macro.dbt.date_trunc", "macro.dbt.last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9354382, "supported_languages": null}, "macro.dbt_date.postgres__get_date_dimension": {"name": "postgres__get_date_dimension", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_date_dimension.sql", "original_file_path": "macros/get_date_dimension.sql", "unique_id": "macro.dbt_date.postgres__get_date_dimension", "macro_sql": "{% macro postgres__get_date_dimension(start_date, end_date) %}\nwith base_dates as (\n    {{ dbt_date.get_base_dates(start_date, end_date) }}\n),\ndates_with_prior_year_dates as (\n\n    select\n        cast(d.date_day as date) as date_day,\n        cast({{ dbt.dateadd('year', -1 , 'd.date_day') }} as date) as prior_year_date_day,\n        cast({{ dbt.dateadd('day', -364 , 'd.date_day') }} as date) as prior_year_over_year_date_day\n    from\n    \tbase_dates d\n\n)\nselect\n    d.date_day,\n    {{ dbt_date.yesterday('d.date_day') }} as prior_date_day,\n    {{ dbt_date.tomorrow('d.date_day') }} as next_date_day,\n    d.prior_year_date_day as prior_year_date_day,\n    d.prior_year_over_year_date_day,\n    {{ dbt_date.day_of_week('d.date_day', isoweek=true) }} as day_of_week,\n\n    {{ dbt_date.day_name('d.date_day', short=false) }} as day_of_week_name,\n    {{ dbt_date.day_name('d.date_day', short=true) }} as day_of_week_name_short,\n    {{ dbt_date.day_of_month('d.date_day') }} as day_of_month,\n    {{ dbt_date.day_of_year('d.date_day') }} as day_of_year,\n\n    {{ dbt_date.week_start('d.date_day') }} as week_start_date,\n    {{ dbt_date.week_end('d.date_day') }} as week_end_date,\n    {{ dbt_date.week_start('d.prior_year_over_year_date_day') }} as prior_year_week_start_date,\n    {{ dbt_date.week_end('d.prior_year_over_year_date_day') }} as prior_year_week_end_date,\n    {{ dbt_date.week_of_year('d.date_day') }} as week_of_year,\n\n    {{ dbt_date.iso_week_start('d.date_day') }} as iso_week_start_date,\n    {{ dbt_date.iso_week_end('d.date_day') }} as iso_week_end_date,\n    {{ dbt_date.iso_week_start('d.prior_year_over_year_date_day') }} as prior_year_iso_week_start_date,\n    {{ dbt_date.iso_week_end('d.prior_year_over_year_date_day') }} as prior_year_iso_week_end_date,\n    {{ dbt_date.iso_week_of_year('d.date_day') }} as iso_week_of_year,\n\n    {{ dbt_date.week_of_year('d.prior_year_over_year_date_day') }} as prior_year_week_of_year,\n    {{ dbt_date.iso_week_of_year('d.prior_year_over_year_date_day') }} as prior_year_iso_week_of_year,\n\n    cast({{ dbt_date.date_part('month', 'd.date_day') }} as {{ dbt.type_int() }}) as month_of_year,\n    {{ dbt_date.month_name('d.date_day', short=false) }}  as month_name,\n    {{ dbt_date.month_name('d.date_day', short=true) }}  as month_name_short,\n\n    cast({{ dbt.date_trunc('month', 'd.date_day') }} as date) as month_start_date,\n    cast({{ last_day('d.date_day', 'month') }} as date) as month_end_date,\n\n    cast({{ dbt.date_trunc('month', 'd.prior_year_date_day') }} as date) as prior_year_month_start_date,\n    cast({{ last_day('d.prior_year_date_day', 'month') }} as date) as prior_year_month_end_date,\n\n    cast({{ dbt_date.date_part('quarter', 'd.date_day') }} as {{ dbt.type_int() }}) as quarter_of_year,\n    cast({{ dbt.date_trunc('quarter', 'd.date_day') }} as date) as quarter_start_date,\n    {# last_day does not support quarter because postgresql does not support quarter interval. #}\n    cast({{dbt.dateadd('day', '-1', dbt.dateadd('month', '3', dbt.date_trunc('quarter', 'd.date_day')))}} as date) as quarter_end_date,\n\n    cast({{ dbt_date.date_part('year', 'd.date_day') }} as {{ dbt.type_int() }}) as year_number,\n    cast({{ dbt.date_trunc('year', 'd.date_day') }} as date) as year_start_date,\n    cast({{ last_day('d.date_day', 'year') }} as date) as year_end_date\nfrom\n    dates_with_prior_year_dates d\norder by 1\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.get_base_dates", "macro.dbt.dateadd", "macro.dbt_date.yesterday", "macro.dbt_date.tomorrow", "macro.dbt_date.day_of_week", "macro.dbt_date.day_name", "macro.dbt_date.day_of_month", "macro.dbt_date.day_of_year", "macro.dbt_date.week_start", "macro.dbt_date.week_end", "macro.dbt_date.week_of_year", "macro.dbt_date.iso_week_start", "macro.dbt_date.iso_week_end", "macro.dbt_date.iso_week_of_year", "macro.dbt_date.date_part", "macro.dbt.type_int", "macro.dbt_date.month_name", "macro.dbt.date_trunc", "macro.dbt.last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9378529, "supported_languages": null}, "macro.dbt_date.get_base_dates": {"name": "get_base_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "unique_id": "macro.dbt_date.get_base_dates", "macro_sql": "{% macro get_base_dates(start_date=None, end_date=None, n_dateparts=None, datepart=\"day\") %}\n    {{ adapter.dispatch('get_base_dates', 'dbt_date') (start_date, end_date, n_dateparts, datepart) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.bigquery__get_base_dates"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.939521, "supported_languages": null}, "macro.dbt_date.default__get_base_dates": {"name": "default__get_base_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "unique_id": "macro.dbt_date.default__get_base_dates", "macro_sql": "{% macro default__get_base_dates(start_date, end_date, n_dateparts, datepart) %}\n\n{%- if start_date and end_date -%}\n{%- set start_date=\"cast('\" ~ start_date ~ \"' as \" ~ dbt.type_timestamp() ~ \")\" -%}\n{%- set end_date=\"cast('\" ~ end_date ~ \"' as \" ~ dbt.type_timestamp() ~ \")\"  -%}\n\n{%- elif n_dateparts and datepart -%}\n\n{%- set start_date = dbt.dateadd(datepart, -1 * n_dateparts, dbt_date.today()) -%}\n{%- set end_date = dbt_date.tomorrow() -%}\n{%- endif -%}\n\nwith date_spine as\n(\n\n    {{ dbt_date.date_spine(\n        datepart=datepart,\n        start_date=start_date,\n        end_date=end_date,\n       )\n    }}\n\n)\nselect\n    cast(d.date_{{ datepart }} as {{ dbt.type_timestamp() }}) as date_{{ datepart }}\nfrom\n    date_spine d\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp", "macro.dbt.dateadd", "macro.dbt_date.today", "macro.dbt_date.tomorrow", "macro.dbt_date.date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.940305, "supported_languages": null}, "macro.dbt_date.bigquery__get_base_dates": {"name": "bigquery__get_base_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "unique_id": "macro.dbt_date.bigquery__get_base_dates", "macro_sql": "{% macro bigquery__get_base_dates(start_date, end_date, n_dateparts, datepart) %}\n\n{%- if start_date and end_date -%}\n{%- set start_date=\"cast('\" ~ start_date ~ \"' as datetime )\" -%}\n{%- set end_date=\"cast('\" ~ end_date ~ \"' as datetime )\" -%}\n\n{%- elif n_dateparts and datepart -%}\n\n{%- set start_date = dbt.dateadd(datepart, -1 * n_dateparts, dbt_date.today()) -%}\n{%- set end_date = dbt_date.tomorrow() -%}\n{%- endif -%}\n\nwith date_spine as\n(\n\n    {{ dbt_date.date_spine(\n        datepart=datepart,\n        start_date=start_date,\n        end_date=end_date,\n       )\n    }}\n\n)\nselect\n    cast(d.date_{{ datepart }} as {{ dbt.type_timestamp() }}) as date_{{ datepart }}\nfrom\n    date_spine d\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt_date.today", "macro.dbt_date.tomorrow", "macro.dbt_date.date_spine", "macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9410188, "supported_languages": null}, "macro.dbt_date.trino__get_base_dates": {"name": "trino__get_base_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "unique_id": "macro.dbt_date.trino__get_base_dates", "macro_sql": "{% macro trino__get_base_dates(start_date, end_date, n_dateparts, datepart) %}\n\n{%- if start_date and end_date -%}\n{%- set start_date=\"cast('\" ~ start_date ~ \"' as \" ~ dbt.type_timestamp() ~ \")\" -%}\n{%- set end_date=\"cast('\" ~ end_date ~ \"' as \" ~ dbt.type_timestamp() ~ \")\"  -%}\n\n{%- elif n_dateparts and datepart -%}\n\n{%- set start_date = dbt.dateadd(datepart, -1 * n_dateparts, dbt_date.now()) -%}\n{%- set end_date = dbt_date.tomorrow() -%}\n{%- endif -%}\n\nwith date_spine as\n(\n\n    {{ dbt_date.date_spine(\n        datepart=datepart,\n        start_date=start_date,\n        end_date=end_date,\n       )\n    }}\n\n)\nselect\n    cast(d.date_{{ datepart }} as {{ dbt.type_timestamp() }}) as date_{{ datepart }}\nfrom\n    date_spine d\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp", "macro.dbt.dateadd", "macro.dbt_date.now", "macro.dbt_date.tomorrow", "macro.dbt_date.date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.941804, "supported_languages": null}, "macro.dbt_date.get_intervals_between": {"name": "get_intervals_between", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/date_spine.sql", "original_file_path": "macros/_utils/date_spine.sql", "unique_id": "macro.dbt_date.get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n    {{ return(adapter.dispatch('get_intervals_between', 'dbt_date')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.942525, "supported_languages": null}, "macro.dbt_date.default__get_intervals_between": {"name": "default__get_intervals_between", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/date_spine.sql", "original_file_path": "macros/_utils/date_spine.sql", "unique_id": "macro.dbt_date.default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n    {%- call statement('get_intervals_between', fetch_result=True) %}\n\n        select {{ dbt.datediff(start_date, end_date, datepart) }}\n\n    {%- endcall -%}\n\n    {%- set value_list = load_result('get_intervals_between') -%}\n\n    {%- if value_list and value_list['data'] -%}\n        {%- set values = value_list['data'] | map(attribute=0) | list %}\n        {{ return(values[0]) }}\n    {%- else -%}\n        {{ return(1) }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.943136, "supported_languages": null}, "macro.dbt_date.date_spine": {"name": "date_spine", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/date_spine.sql", "original_file_path": "macros/_utils/date_spine.sql", "unique_id": "macro.dbt_date.date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n    {{ return(adapter.dispatch('date_spine', 'dbt_date')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.943378, "supported_languages": null}, "macro.dbt_date.default__date_spine": {"name": "default__date_spine", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/date_spine.sql", "original_file_path": "macros/_utils/date_spine.sql", "unique_id": "macro.dbt_date.default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n{# call as follows:\n\ndate_spine(\n    \"day\",\n    \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n    \"dbt.dateadd(week, 1, current_date)\"\n) #}\n\n\nwith rawdata as (\n\n    {{\n        dbt_date.generate_series(\n            dbt_date.get_intervals_between(start_date, end_date, datepart)\n        )\n    }}\n\n),\n\nall_periods as (\n\n    select (\n        {{\n            dbt.dateadd(\n                datepart,\n                \"(row_number() over (order by 1) - 1)\",\n                start_date\n            )\n        }}\n    ) as date_{{datepart}}\n    from rawdata\n\n),\n\nfiltered as (\n\n    select *\n    from all_periods\n    where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.generate_series", "macro.dbt_date.get_intervals_between", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.943758, "supported_languages": null}, "macro.dbt_date.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/generate_series.sql", "original_file_path": "macros/_utils/generate_series.sql", "unique_id": "macro.dbt_date.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n    {{ return(adapter.dispatch('get_powers_of_two', 'dbt_date')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9446132, "supported_languages": null}, "macro.dbt_date.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/generate_series.sql", "original_file_path": "macros/_utils/generate_series.sql", "unique_id": "macro.dbt_date.default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n    {% if upper_bound <= 0 %}\n    {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n    {% endif %}\n\n    {% for _ in range(1, 100) %}\n       {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n    {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.945041, "supported_languages": null}, "macro.dbt_date.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/generate_series.sql", "original_file_path": "macros/_utils/generate_series.sql", "unique_id": "macro.dbt_date.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n    {{ return(adapter.dispatch('generate_series', 'dbt_date')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.945247, "supported_languages": null}, "macro.dbt_date.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/generate_series.sql", "original_file_path": "macros/_utils/generate_series.sql", "unique_id": "macro.dbt_date.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n    {% set n = dbt_date.get_powers_of_two(upper_bound) %}\n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    {% for i in range(n) %}\n    p{{i}}.generated_number * power(2, {{i}})\n    {% if not loop.last %} + {% endif %}\n    {% endfor %}\n    + 1\n    as generated_number\n\n    from\n\n    {% for i in range(n) %}\n    p as p{{i}}\n    {% if not loop.last %} cross join {% endif %}\n    {% endfor %}\n\n    )\n\n    select *\n    from unioned\n    where generated_number <= {{upper_bound}}\n    order by generated_number\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9457972, "supported_languages": null}, "macro.dbt_date.date": {"name": "date", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/modules_datetime.sql", "original_file_path": "macros/_utils/modules_datetime.sql", "unique_id": "macro.dbt_date.date", "macro_sql": "{% macro date(year, month, day) %}\n    {{ return(modules.datetime.date(year, month, day)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.946142, "supported_languages": null}, "macro.dbt_date.datetime": {"name": "datetime", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/modules_datetime.sql", "original_file_path": "macros/_utils/modules_datetime.sql", "unique_id": "macro.dbt_date.datetime", "macro_sql": "{% macro datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tz=None) %}\n    {% set tz = tz if tz else var(\"dbt_date:time_zone\") %}\n    {{ return(\n        modules.datetime.datetime(\n            year=year, month=month, day=day, hour=hour,\n            minute=minute, second=second, microsecond=microsecond,\n            tzinfo=modules.pytz.timezone(tz)\n        )\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.946719, "supported_languages": null}, "macro.dbt_date.get_fiscal_year_dates": {"name": "get_fiscal_year_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/fiscal_date/get_fiscal_year_dates.sql", "original_file_path": "macros/fiscal_date/get_fiscal_year_dates.sql", "unique_id": "macro.dbt_date.get_fiscal_year_dates", "macro_sql": "{% macro get_fiscal_year_dates(dates, year_end_month=12, week_start_day=1, shift_year=1) %}\n{{ adapter.dispatch('get_fiscal_year_dates', 'dbt_date') (dates, year_end_month, week_start_day, shift_year) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__get_fiscal_year_dates"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.948401, "supported_languages": null}, "macro.dbt_date.default__get_fiscal_year_dates": {"name": "default__get_fiscal_year_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/fiscal_date/get_fiscal_year_dates.sql", "original_file_path": "macros/fiscal_date/get_fiscal_year_dates.sql", "unique_id": "macro.dbt_date.default__get_fiscal_year_dates", "macro_sql": "{% macro default__get_fiscal_year_dates(dates, year_end_month, week_start_day, shift_year) %}\n-- this gets all the dates within a fiscal year\n-- determined by the given year-end-month\n-- ending on the saturday closest to that month's end date\nwith fsc_date_dimension as (\n    select * from {{ dates }}\n),\nyear_month_end as (\n\n    select\n       d.year_number - {{ shift_year }} as fiscal_year_number,\n       d.month_end_date\n    from\n        fsc_date_dimension d\n    where\n        d.month_of_year = {{ year_end_month }}\n    group by 1,2\n\n),\nweeks as (\n\n    select\n        d.year_number,\n        d.month_of_year,\n        d.date_day as week_start_date,\n        cast({{ dbt.dateadd('day', 6, 'd.date_day') }} as date) as week_end_date\n    from\n        fsc_date_dimension d\n    where\n        d.day_of_week = {{ week_start_day }}\n\n),\n-- get all the weeks that start in the month the year ends\nyear_week_ends as (\n\n    select\n        d.year_number - {{ shift_year }} as fiscal_year_number,\n        d.week_end_date\n    from\n        weeks d\n    where\n        d.month_of_year = {{ year_end_month }}\n    group by\n        1,2\n\n),\n-- then calculate which Saturday is closest to month end\nweeks_at_month_end as (\n\n    select\n        d.fiscal_year_number,\n        d.week_end_date,\n        m.month_end_date,\n        rank() over\n            (partition by d.fiscal_year_number\n                order by\n                abs({{ dbt.datediff('d.week_end_date', 'm.month_end_date', 'day') }})\n\n            ) as closest_to_month_end\n    from\n        year_week_ends d\n        join\n        year_month_end m on d.fiscal_year_number = m.fiscal_year_number\n),\nfiscal_year_range as (\n\n    select\n        w.fiscal_year_number,\n        cast(\n            {{ dbt.dateadd('day', 1,\n            'lag(w.week_end_date) over(order by w.week_end_date)') }}\n            as date) as fiscal_year_start_date,\n        w.week_end_date as fiscal_year_end_date\n    from\n        weeks_at_month_end w\n    where\n        w.closest_to_month_end = 1\n\n),\nfiscal_year_dates as (\n\n    select\n        d.date_day,\n        m.fiscal_year_number,\n        m.fiscal_year_start_date,\n        m.fiscal_year_end_date,\n        w.week_start_date,\n        w.week_end_date,\n        -- we reset the weeks of the year starting with the merch year start date\n        dense_rank()\n            over(\n                partition by m.fiscal_year_number\n                order by w.week_start_date\n                ) as fiscal_week_of_year\n    from\n        fsc_date_dimension d\n        join\n        fiscal_year_range m on d.date_day between m.fiscal_year_start_date and m.fiscal_year_end_date\n        join\n        weeks w on d.date_day between w.week_start_date and w.week_end_date\n\n)\nselect * from fiscal_year_dates order by 1\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9490209, "supported_languages": null}, "macro.dbt_date.get_fiscal_periods": {"name": "get_fiscal_periods", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/fiscal_date/get_fiscal_periods.sql", "original_file_path": "macros/fiscal_date/get_fiscal_periods.sql", "unique_id": "macro.dbt_date.get_fiscal_periods", "macro_sql": "{% macro get_fiscal_periods(dates, year_end_month, week_start_day, shift_year=1) %}\n{#\nThis macro requires you to pass in a ref to a date dimension, created via\ndbt_date.get_date_dimension()s\n#}\nwith fscl_year_dates_for_periods as (\n    {{ dbt_date.get_fiscal_year_dates(dates, year_end_month, week_start_day, shift_year) }}\n),\nfscl_year_w13 as (\n\n    select\n        f.*,\n        -- We count the weeks in a 13 week period\n        -- and separate the 4-5-4 week sequences\n        mod(cast(\n            (f.fiscal_week_of_year-1) as {{ dbt.type_int() }}\n            ), 13) as w13_number,\n        -- Chop weeks into 13 week merch quarters\n        cast(\n            least(\n                floor((f.fiscal_week_of_year-1)/13.0)\n                , 3)\n            as {{ dbt.type_int() }}) as quarter_number\n    from\n        fscl_year_dates_for_periods f\n\n),\nfscl_periods as (\n\n    select\n        f.date_day,\n        f.fiscal_year_number,\n        f.week_start_date,\n        f.week_end_date,\n        f.fiscal_week_of_year,\n        case\n            -- we move week 53 into the 3rd period of the quarter\n            when f.fiscal_week_of_year = 53 then 3\n            when f.w13_number between 0 and 3 then 1\n            when f.w13_number between 4 and 8 then 2\n            when f.w13_number between 9 and 12 then 3\n        end as period_of_quarter,\n        f.quarter_number\n    from\n        fscl_year_w13 f\n\n),\nfscl_periods_quarters as (\n\n    select\n        f.*,\n        cast((\n            (f.quarter_number * 3) + f.period_of_quarter\n         ) as {{ dbt.type_int() }}) as fiscal_period_number\n    from\n        fscl_periods f\n\n)\nselect\n    date_day,\n    fiscal_year_number,\n    week_start_date,\n    week_end_date,\n    fiscal_week_of_year,\n    dense_rank() over(partition by fiscal_period_number order by fiscal_week_of_year) as fiscal_week_of_period,\n    fiscal_period_number,\n    quarter_number+1 as fiscal_quarter_number,\n    period_of_quarter as fiscal_period_of_quarter\nfrom\n    fscl_periods_quarters\norder by 1,2\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.get_fiscal_year_dates", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9499369, "supported_languages": null}, "macro.dbt_date.tomorrow": {"name": "tomorrow", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/tomorrow.sql", "original_file_path": "macros/calendar_date/tomorrow.sql", "unique_id": "macro.dbt_date.tomorrow", "macro_sql": "{%- macro tomorrow(date=None, tz=None) -%}\n{{ dbt_date.n_days_away(1, date, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.950166, "supported_languages": null}, "macro.dbt_date.next_week": {"name": "next_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/next_week.sql", "original_file_path": "macros/calendar_date/next_week.sql", "unique_id": "macro.dbt_date.next_week", "macro_sql": "{%- macro next_week(tz=None) -%}\n{{ dbt_date.n_weeks_away(1, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_weeks_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.950352, "supported_languages": null}, "macro.dbt_date.next_month_name": {"name": "next_month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/next_month_name.sql", "original_file_path": "macros/calendar_date/next_month_name.sql", "unique_id": "macro.dbt_date.next_month_name", "macro_sql": "{%- macro next_month_name(short=True, tz=None) -%}\n{{ dbt_date.month_name(dbt_date.next_month(tz), short=short) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.month_name", "macro.dbt_date.next_month"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.950658, "supported_languages": null}, "macro.dbt_date.next_month": {"name": "next_month", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/next_month.sql", "original_file_path": "macros/calendar_date/next_month.sql", "unique_id": "macro.dbt_date.next_month", "macro_sql": "{%- macro next_month(tz=None) -%}\n{{ dbt_date.n_months_away(1, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_months_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.95084, "supported_languages": null}, "macro.dbt_date.day_name": {"name": "day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.day_name", "macro_sql": "{%- macro day_name(date, short=True) -%}\n    {{ adapter.dispatch('day_name', 'dbt_date') (date, short) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.bigquery__day_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.951683, "supported_languages": null}, "macro.dbt_date.default__day_name": {"name": "default__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.default__day_name", "macro_sql": "\n\n{%- macro default__day_name(date, short) -%}\n{%- set f = 'Dy' if short else 'Day' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.951892, "supported_languages": null}, "macro.dbt_date.snowflake__day_name": {"name": "snowflake__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.snowflake__day_name", "macro_sql": "\n\n{%- macro snowflake__day_name(date, short) -%}\n    {%- if short -%}\n    dayname({{ date }})\n    {%- else -%}\n    -- long version not implemented on Snowflake so we're doing it manually :/\n    case dayname({{ date }})\n        when 'Mon' then 'Monday'\n        when 'Tue' then 'Tuesday'\n        when 'Wed' then 'Wednesday'\n        when 'Thu' then 'Thursday'\n        when 'Fri' then 'Friday'\n        when 'Sat' then 'Saturday'\n        when 'Sun' then 'Sunday'\n    end\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.952115, "supported_languages": null}, "macro.dbt_date.bigquery__day_name": {"name": "bigquery__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.bigquery__day_name", "macro_sql": "\n\n{%- macro bigquery__day_name(date, short) -%}\n{%- set f = '%a' if short else '%A' -%}\n    format_date('{{ f }}', cast({{ date }} as date))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.952321, "supported_languages": null}, "macro.dbt_date.postgres__day_name": {"name": "postgres__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.postgres__day_name", "macro_sql": "\n\n{%- macro postgres__day_name(date, short) -%}\n{# FM = Fill mode, which suppresses padding blanks #}\n{%- set f = 'FMDy' if short else 'FMDay' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.95253, "supported_languages": null}, "macro.dbt_date.duckdb__day_name": {"name": "duckdb__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.duckdb__day_name", "macro_sql": "\n\n{%- macro duckdb__day_name(date, short) -%}\n    {%- if short -%}\n    substr(dayname({{ date }}), 1, 3)\n    {%- else -%}\n    dayname({{ date }})\n    {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.952724, "supported_languages": null}, "macro.dbt_date.spark__day_name": {"name": "spark__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.spark__day_name", "macro_sql": "\n\n{%- macro spark__day_name(date, short) -%}\n{%- set f = 'E' if short else 'EEEE' -%}\n    date_format({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.952928, "supported_languages": null}, "macro.dbt_date.trino__day_name": {"name": "trino__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.trino__day_name", "macro_sql": "\n\n{%- macro trino__day_name(date, short) -%}\n{%- set f = 'a' if short else 'W' -%}\n    date_format({{ date }}, '%{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9531279, "supported_languages": null}, "macro.dbt_date.to_unixtimestamp": {"name": "to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.to_unixtimestamp", "macro_sql": "{%- macro to_unixtimestamp(timestamp) -%}\n    {{ adapter.dispatch('to_unixtimestamp', 'dbt_date') (timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.bigquery__to_unixtimestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.953542, "supported_languages": null}, "macro.dbt_date.default__to_unixtimestamp": {"name": "default__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.default__to_unixtimestamp", "macro_sql": "\n\n{%- macro default__to_unixtimestamp(timestamp) -%}\n    {{ dbt_date.date_part('epoch', timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.953685, "supported_languages": null}, "macro.dbt_date.snowflake__to_unixtimestamp": {"name": "snowflake__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.snowflake__to_unixtimestamp", "macro_sql": "\n\n{%- macro snowflake__to_unixtimestamp(timestamp) -%}\n    {{ dbt_date.date_part('epoch_seconds', timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.95383, "supported_languages": null}, "macro.dbt_date.bigquery__to_unixtimestamp": {"name": "bigquery__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.bigquery__to_unixtimestamp", "macro_sql": "\n\n{%- macro bigquery__to_unixtimestamp(timestamp) -%}\n    unix_seconds({{ timestamp }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9539342, "supported_languages": null}, "macro.dbt_date.spark__to_unixtimestamp": {"name": "spark__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.spark__to_unixtimestamp", "macro_sql": "\n\n{%- macro spark__to_unixtimestamp(timestamp) -%}\n    unix_timestamp({{ timestamp }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.954039, "supported_languages": null}, "macro.dbt_date.trino__to_unixtimestamp": {"name": "trino__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.trino__to_unixtimestamp", "macro_sql": "\n\n{%- macro trino__to_unixtimestamp(timestamp) -%}\n    to_unixtime({{ timestamp }} AT TIME ZONE 'UTC')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.954144, "supported_languages": null}, "macro.dbt_date.n_days_away": {"name": "n_days_away", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_days_away.sql", "original_file_path": "macros/calendar_date/n_days_away.sql", "unique_id": "macro.dbt_date.n_days_away", "macro_sql": "{%- macro n_days_away(n, date=None, tz=None) -%}\n{{ dbt_date.n_days_ago(-1 * n, date, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_days_ago"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.954394, "supported_languages": null}, "macro.dbt_date.week_start": {"name": "week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.week_start", "macro_sql": "{%- macro week_start(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('week_start', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.954902, "supported_languages": null}, "macro.dbt_date.default__week_start": {"name": "default__week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.default__week_start", "macro_sql": "{%- macro default__week_start(date) -%}\ncast({{ dbt.date_trunc('week', date) }} as date)\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.955055, "supported_languages": null}, "macro.dbt_date.snowflake__week_start": {"name": "snowflake__week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.snowflake__week_start", "macro_sql": "\n\n{%- macro snowflake__week_start(date) -%}\n    {#\n        Get the day of week offset: e.g. if the date is a Sunday,\n        dbt_date.day_of_week returns 1, so we subtract 1 to get a 0 offset\n    #}\n    {% set off_set = dbt_date.day_of_week(date, isoweek=False) ~ \" - 1\" %}\n    cast({{ dbt.dateadd(\"day\", \"-1 * (\" ~ off_set ~ \")\", date) }} as date)\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.day_of_week", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.955422, "supported_languages": null}, "macro.dbt_date.postgres__week_start": {"name": "postgres__week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.postgres__week_start", "macro_sql": "\n\n{%- macro postgres__week_start(date) -%}\n-- Sunday as week start date\ncast({{ dbt.dateadd('day', -1, dbt.date_trunc('week', dbt.dateadd('day', 1, date))) }} as date)\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.955696, "supported_languages": null}, "macro.dbt_date.duckdb__week_start": {"name": "duckdb__week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.duckdb__week_start", "macro_sql": "\n\n{%- macro duckdb__week_start(date) -%}\n{{ return(dbt_date.postgres__week_start(date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.955847, "supported_languages": null}, "macro.dbt_date.iso_week_start": {"name": "iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.iso_week_start", "macro_sql": "{%- macro iso_week_start(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('iso_week_start', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.956531, "supported_languages": null}, "macro.dbt_date._iso_week_start": {"name": "_iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date._iso_week_start", "macro_sql": "{%- macro _iso_week_start(date, week_type) -%}\ncast({{ dbt.date_trunc(week_type, date) }} as date)\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.956692, "supported_languages": null}, "macro.dbt_date.default__iso_week_start": {"name": "default__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.default__iso_week_start", "macro_sql": "\n\n{%- macro default__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'isoweek') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9568372, "supported_languages": null}, "macro.dbt_date.snowflake__iso_week_start": {"name": "snowflake__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.snowflake__iso_week_start", "macro_sql": "\n\n{%- macro snowflake__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.95698, "supported_languages": null}, "macro.dbt_date.postgres__iso_week_start": {"name": "postgres__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.postgres__iso_week_start", "macro_sql": "\n\n{%- macro postgres__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9571211, "supported_languages": null}, "macro.dbt_date.duckdb__iso_week_start": {"name": "duckdb__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.duckdb__iso_week_start", "macro_sql": "\n\n{%- macro duckdb__iso_week_start(date) -%}\n{{ return(dbt_date.postgres__iso_week_start(date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.957268, "supported_languages": null}, "macro.dbt_date.spark__iso_week_start": {"name": "spark__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.spark__iso_week_start", "macro_sql": "\n\n{%- macro spark__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.95741, "supported_languages": null}, "macro.dbt_date.trino__iso_week_start": {"name": "trino__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.trino__iso_week_start", "macro_sql": "\n\n{%- macro trino__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.957555, "supported_languages": null}, "macro.dbt_date.n_days_ago": {"name": "n_days_ago", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_days_ago.sql", "original_file_path": "macros/calendar_date/n_days_ago.sql", "unique_id": "macro.dbt_date.n_days_ago", "macro_sql": "{%- macro n_days_ago(n, date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{%- set n = n|int -%}\ncast({{ dbt.dateadd('day', -1 * n, dt) }} as date)\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.957979, "supported_languages": null}, "macro.dbt_date.last_week": {"name": "last_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/last_week.sql", "original_file_path": "macros/calendar_date/last_week.sql", "unique_id": "macro.dbt_date.last_week", "macro_sql": "{%- macro last_week(tz=None) -%}\n{{ dbt_date.n_weeks_ago(1, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_weeks_ago"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.958165, "supported_languages": null}, "macro.dbt_date.now": {"name": "now", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/now.sql", "original_file_path": "macros/calendar_date/now.sql", "unique_id": "macro.dbt_date.now", "macro_sql": "{%- macro now(tz=None) -%}\n{{ dbt_date.convert_timezone(dbt.current_timestamp(), tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.convert_timezone", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.958368, "supported_languages": null}, "macro.dbt_date.periods_since": {"name": "periods_since", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/periods_since.sql", "original_file_path": "macros/calendar_date/periods_since.sql", "unique_id": "macro.dbt_date.periods_since", "macro_sql": "{%- macro periods_since(date_col, period_name='day', tz=None) -%}\n{{ dbt.datediff(date_col, dbt_date.now(tz), period_name) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt_date.now"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9586308, "supported_languages": null}, "macro.dbt_date.today": {"name": "today", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/today.sql", "original_file_path": "macros/calendar_date/today.sql", "unique_id": "macro.dbt_date.today", "macro_sql": "{%- macro today(tz=None) -%}\ncast({{ dbt_date.now(tz) }} as date)\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.now"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.958813, "supported_languages": null}, "macro.dbt_date.last_month": {"name": "last_month", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/last_month.sql", "original_file_path": "macros/calendar_date/last_month.sql", "unique_id": "macro.dbt_date.last_month", "macro_sql": "{%- macro last_month(tz=None) -%}\n{{ dbt_date.n_months_ago(1, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_months_ago"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.958994, "supported_languages": null}, "macro.dbt_date.day_of_year": {"name": "day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.day_of_year", "macro_sql": "{%- macro day_of_year(date) -%}\n{{ adapter.dispatch('day_of_year', 'dbt_date') (date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__day_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.95941, "supported_languages": null}, "macro.dbt_date.default__day_of_year": {"name": "default__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.default__day_of_year", "macro_sql": "\n\n{%- macro default__day_of_year(date) -%}\n    {{ dbt_date.date_part('dayofyear', date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.959552, "supported_languages": null}, "macro.dbt_date.postgres__day_of_year": {"name": "postgres__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.postgres__day_of_year", "macro_sql": "\n\n{%- macro postgres__day_of_year(date) -%}\n    {{ dbt_date.date_part('doy', date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.959695, "supported_languages": null}, "macro.dbt_date.redshift__day_of_year": {"name": "redshift__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.redshift__day_of_year", "macro_sql": "\n\n{%- macro redshift__day_of_year(date) -%}\n    cast({{ dbt_date.date_part('dayofyear', date) }} as {{ dbt.type_bigint() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.959892, "supported_languages": null}, "macro.dbt_date.spark__day_of_year": {"name": "spark__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.spark__day_of_year", "macro_sql": "\n\n{%- macro spark__day_of_year(date) -%}\n    dayofyear({{ date }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.960066, "supported_languages": null}, "macro.dbt_date.trino__day_of_year": {"name": "trino__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.trino__day_of_year", "macro_sql": "\n\n{%- macro trino__day_of_year(date) -%}\n    {{ dbt_date.date_part('day_of_year', date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.960207, "supported_languages": null}, "macro.dbt_date.round_timestamp": {"name": "round_timestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/round_timestamp.sql", "original_file_path": "macros/calendar_date/round_timestamp.sql", "unique_id": "macro.dbt_date.round_timestamp", "macro_sql": "{% macro round_timestamp(timestamp) %}\n    {{ dbt.date_trunc(\"day\", dbt.dateadd(\"hour\", 12, timestamp)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.960456, "supported_languages": null}, "macro.dbt_date.from_unixtimestamp": {"name": "from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.from_unixtimestamp", "macro_sql": "{%- macro from_unixtimestamp(epochs, format=\"seconds\") -%}\n    {{ adapter.dispatch('from_unixtimestamp', 'dbt_date') (epochs, format) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.bigquery__from_unixtimestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.962642, "supported_languages": null}, "macro.dbt_date.default__from_unixtimestamp": {"name": "default__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.default__from_unixtimestamp", "macro_sql": "\n\n{%- macro default__from_unixtimestamp(epochs, format=\"seconds\") -%}\n    {%- if format != \"seconds\" -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n    to_timestamp({{ epochs }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.962912, "supported_languages": null}, "macro.dbt_date.postgres__from_unixtimestamp": {"name": "postgres__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.postgres__from_unixtimestamp", "macro_sql": "\n\n{%- macro postgres__from_unixtimestamp(epochs, format=\"seconds\") -%}\n    {%- if format != \"seconds\" -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n    cast(to_timestamp({{ epochs }}) at time zone 'UTC' as timestamp)\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.963188, "supported_languages": null}, "macro.dbt_date.snowflake__from_unixtimestamp": {"name": "snowflake__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.snowflake__from_unixtimestamp", "macro_sql": "\n\n{%- macro snowflake__from_unixtimestamp(epochs, format) -%}\n    {%- if format == \"seconds\" -%}\n    {%- set scale = 0 -%}\n    {%- elif format == \"milliseconds\" -%}\n    {%- set scale = 3 -%}\n    {%- elif format == \"microseconds\" -%}\n    {%- set scale = 6 -%}\n    {%- else -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n    to_timestamp_ntz({{ epochs }}, {{ scale }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.963673, "supported_languages": null}, "macro.dbt_date.bigquery__from_unixtimestamp": {"name": "bigquery__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.bigquery__from_unixtimestamp", "macro_sql": "\n\n{%- macro bigquery__from_unixtimestamp(epochs, format) -%}\n    {%- if format == \"seconds\" -%}\n        timestamp_seconds({{ epochs }})\n    {%- elif format == \"milliseconds\" -%}\n        timestamp_millis({{ epochs }})\n    {%- elif format == \"microseconds\" -%}\n        timestamp_micros({{ epochs }})\n    {%- else -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9640808, "supported_languages": null}, "macro.dbt_date.trino__from_unixtimestamp": {"name": "trino__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.trino__from_unixtimestamp", "macro_sql": "\n\n{%- macro trino__from_unixtimestamp(epochs, format) -%}\n    {%- if format == \"seconds\" -%}\n        cast(from_unixtime({{ epochs }}) AT TIME ZONE 'UTC' as {{ dbt.type_timestamp() }})\n    {%- elif format == \"milliseconds\" -%}\n        cast(from_unixtime_nanos({{ epochs }} * pow(10, 6)) AT TIME ZONE 'UTC' as {{ dbt.type_timestamp() }})\n    {%- elif format == \"microseconds\" -%}\n        cast(from_unixtime_nanos({{ epochs }} * pow(10, 3)) AT TIME ZONE 'UTC' as {{ dbt.type_timestamp() }})\n    {%- elif format == \"nanoseconds\" -%}\n        cast(from_unixtime_nanos({{ epochs }}) AT TIME ZONE 'UTC' as {{ dbt.type_timestamp() }})\n    {%- else -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.964709, "supported_languages": null}, "macro.dbt_date.n_months_ago": {"name": "n_months_ago", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_months_ago.sql", "original_file_path": "macros/calendar_date/n_months_ago.sql", "unique_id": "macro.dbt_date.n_months_ago", "macro_sql": "{%- macro n_months_ago(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt.date_trunc('month',\n    dbt.dateadd('month', -1 * n,\n        dbt_date.today(tz)\n        )\n    ) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.96509, "supported_languages": null}, "macro.dbt_date.date_part": {"name": "date_part", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "unique_id": "macro.dbt_date.date_part", "macro_sql": "{% macro date_part(datepart, date) -%}\n    {{ adapter.dispatch('date_part', 'dbt_date') (datepart, date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.bigquery__date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.965444, "supported_languages": null}, "macro.dbt_date.default__date_part": {"name": "default__date_part", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "unique_id": "macro.dbt_date.default__date_part", "macro_sql": "{% macro default__date_part(datepart, date) -%}\n    date_part('{{ datepart }}', {{  date }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9655838, "supported_languages": null}, "macro.dbt_date.bigquery__date_part": {"name": "bigquery__date_part", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "unique_id": "macro.dbt_date.bigquery__date_part", "macro_sql": "{% macro bigquery__date_part(datepart, date) -%}\n    extract({{ datepart }} from {{ date }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.965718, "supported_languages": null}, "macro.dbt_date.trino__date_part": {"name": "trino__date_part", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "unique_id": "macro.dbt_date.trino__date_part", "macro_sql": "{% macro trino__date_part(datepart, date) -%}\n    extract({{ datepart }} from {{ date }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.965853, "supported_languages": null}, "macro.dbt_date.n_weeks_away": {"name": "n_weeks_away", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_weeks_away.sql", "original_file_path": "macros/calendar_date/n_weeks_away.sql", "unique_id": "macro.dbt_date.n_weeks_away", "macro_sql": "{%- macro n_weeks_away(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt.date_trunc('week',\n    dbt.dateadd('week', n,\n        dbt_date.today(tz)\n        )\n    ) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.966212, "supported_languages": null}, "macro.dbt_date.day_of_month": {"name": "day_of_month", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_month.sql", "original_file_path": "macros/calendar_date/day_of_month.sql", "unique_id": "macro.dbt_date.day_of_month", "macro_sql": "{%- macro day_of_month(date) -%}\n{{ dbt_date.date_part('day', date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.966429, "supported_languages": null}, "macro.dbt_date.redshift__day_of_month": {"name": "redshift__day_of_month", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_month.sql", "original_file_path": "macros/calendar_date/day_of_month.sql", "unique_id": "macro.dbt_date.redshift__day_of_month", "macro_sql": "\n\n{%- macro redshift__day_of_month(date) -%}\ncast({{ dbt_date.date_part('day', date) }} as {{ dbt.type_bigint() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.966617, "supported_languages": null}, "macro.dbt_date.yesterday": {"name": "yesterday", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/yesterday.sql", "original_file_path": "macros/calendar_date/yesterday.sql", "unique_id": "macro.dbt_date.yesterday", "macro_sql": "{%- macro yesterday(date=None, tz=None) -%}\n{{ dbt_date.n_days_ago(1, date, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_days_ago"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.966836, "supported_languages": null}, "macro.dbt_date.day_of_week": {"name": "day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.day_of_week", "macro_sql": "{%- macro day_of_week(date, isoweek=true) -%}\n{{ adapter.dispatch('day_of_week', 'dbt_date') (date, isoweek) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.bigquery__day_of_week"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9696362, "supported_languages": null}, "macro.dbt_date.default__day_of_week": {"name": "default__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.default__day_of_week", "macro_sql": "\n\n{%- macro default__day_of_week(date, isoweek) -%}\n\n    {%- set dow = dbt_date.date_part('dayofweek', date) -%}\n\n    {%- if isoweek -%}\n    case\n        -- Shift start of week from Sunday (0) to Monday (1)\n        when {{ dow }} = 0 then 7\n        else {{ dow }}\n    end\n    {%- else -%}\n    {{ dow }} + 1\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9699998, "supported_languages": null}, "macro.dbt_date.snowflake__day_of_week": {"name": "snowflake__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.snowflake__day_of_week", "macro_sql": "\n\n{%- macro snowflake__day_of_week(date, isoweek) -%}\n\n    {%- if isoweek -%}\n        {%- set dow_part = 'dayofweekiso' -%}\n        {{ dbt_date.date_part(dow_part, date) }}\n    {%- else -%}\n        {%- set dow_part = 'dayofweek' -%}\n        case\n            when {{ dbt_date.date_part(dow_part, date) }} = 7 then 1\n            else {{ dbt_date.date_part(dow_part, date) }} + 1\n        end\n    {%- endif -%}\n\n\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.970426, "supported_languages": null}, "macro.dbt_date.bigquery__day_of_week": {"name": "bigquery__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.bigquery__day_of_week", "macro_sql": "\n\n{%- macro bigquery__day_of_week(date, isoweek) -%}\n\n    {%- set dow = dbt_date.date_part('dayofweek', date) -%}\n\n    {%- if isoweek -%}\n    case\n        -- Shift start of week from Sunday (1) to Monday (2)\n        when {{ dow }} = 1 then 7\n        else {{ dow }} - 1\n    end\n    {%- else -%}\n    {{ dow }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.970724, "supported_languages": null}, "macro.dbt_date.postgres__day_of_week": {"name": "postgres__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.postgres__day_of_week", "macro_sql": "\n\n\n{%- macro postgres__day_of_week(date, isoweek) -%}\n\n    {%- if isoweek -%}\n        {%- set dow_part = 'isodow' -%}\n        -- Monday(1) to Sunday (7)\n        cast({{ dbt_date.date_part(dow_part, date) }} as {{ dbt.type_int() }})\n    {%- else -%}\n        {%- set dow_part = 'dow' -%}\n        -- Sunday(1) to Saturday (7)\n        cast({{ dbt_date.date_part(dow_part, date) }} + 1 as {{ dbt.type_int() }})\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.971158, "supported_languages": null}, "macro.dbt_date.redshift__day_of_week": {"name": "redshift__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.redshift__day_of_week", "macro_sql": "\n\n\n{%- macro redshift__day_of_week(date, isoweek) -%}\n\n    {%- set dow = dbt_date.date_part('dayofweek', date) -%}\n\n    {%- if isoweek -%}\n    case\n        -- Shift start of week from Sunday (0) to Monday (1)\n        when {{ dow }} = 0 then 7\n        else cast({{ dow }} as {{ dbt.type_bigint() }})\n    end\n    {%- else -%}\n    cast({{ dow }} + 1 as {{ dbt.type_bigint() }})\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.971539, "supported_languages": null}, "macro.dbt_date.duckdb__day_of_week": {"name": "duckdb__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.duckdb__day_of_week", "macro_sql": "\n\n{%- macro duckdb__day_of_week(date, isoweek) -%}\n{{ return(dbt_date.postgres__day_of_week(date, isoweek)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__day_of_week"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9717171, "supported_languages": null}, "macro.dbt_date.spark__day_of_week": {"name": "spark__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.spark__day_of_week", "macro_sql": "\n\n\n{%- macro spark__day_of_week(date, isoweek) -%}\n\n    {%- set dow = \"dayofweek_iso\" if isoweek else \"dayofweek\" -%}\n\n    {{ dbt_date.date_part(dow, date) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.971943, "supported_languages": null}, "macro.dbt_date.trino__day_of_week": {"name": "trino__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.trino__day_of_week", "macro_sql": "\n\n\n{%- macro trino__day_of_week(date, isoweek) -%}\n\n    {%- set dow = dbt_date.date_part('day_of_week', date) -%}\n\n    {%- if isoweek -%}\n        {{ dow }}\n    {%- else -%}\n        case\n            when {{ dow }} = 7 then 1\n            else {{ dow }} + 1\n        end\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.972233, "supported_languages": null}, "macro.dbt_date.iso_week_end": {"name": "iso_week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "unique_id": "macro.dbt_date.iso_week_end", "macro_sql": "{%- macro iso_week_end(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('iso_week_end', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__iso_week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9726999, "supported_languages": null}, "macro.dbt_date._iso_week_end": {"name": "_iso_week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "unique_id": "macro.dbt_date._iso_week_end", "macro_sql": "{%- macro _iso_week_end(date, week_type) -%}\n{%- set dt = dbt_date.iso_week_start(date) -%}\n{{ dbt_date.n_days_away(6, dt) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.iso_week_start", "macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9729202, "supported_languages": null}, "macro.dbt_date.default__iso_week_end": {"name": "default__iso_week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "unique_id": "macro.dbt_date.default__iso_week_end", "macro_sql": "\n\n{%- macro default__iso_week_end(date) -%}\n{{ dbt_date._iso_week_end(date, 'isoweek') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9730618, "supported_languages": null}, "macro.dbt_date.snowflake__iso_week_end": {"name": "snowflake__iso_week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "unique_id": "macro.dbt_date.snowflake__iso_week_end", "macro_sql": "\n\n{%- macro snowflake__iso_week_end(date) -%}\n{{ dbt_date._iso_week_end(date, 'weekiso') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.973206, "supported_languages": null}, "macro.dbt_date.n_weeks_ago": {"name": "n_weeks_ago", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_weeks_ago.sql", "original_file_path": "macros/calendar_date/n_weeks_ago.sql", "unique_id": "macro.dbt_date.n_weeks_ago", "macro_sql": "{%- macro n_weeks_ago(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt.date_trunc('week',\n    dbt.dateadd('week', -1 * n,\n        dbt_date.today(tz)\n        )\n    ) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.973577, "supported_languages": null}, "macro.dbt_date.month_name": {"name": "month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.month_name", "macro_sql": "{%- macro month_name(date, short=True) -%}\n    {{ adapter.dispatch('month_name', 'dbt_date') (date, short) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.bigquery__month_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.974282, "supported_languages": null}, "macro.dbt_date.default__month_name": {"name": "default__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.default__month_name", "macro_sql": "\n\n{%- macro default__month_name(date, short) -%}\n{%- set f = 'MON' if short else 'MONTH' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.974493, "supported_languages": null}, "macro.dbt_date.bigquery__month_name": {"name": "bigquery__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.bigquery__month_name", "macro_sql": "\n\n{%- macro bigquery__month_name(date, short) -%}\n{%- set f = '%b' if short else '%B' -%}\n    format_date('{{ f }}', cast({{ date }} as date))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.974699, "supported_languages": null}, "macro.dbt_date.snowflake__month_name": {"name": "snowflake__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.snowflake__month_name", "macro_sql": "\n\n{%- macro snowflake__month_name(date, short) -%}\n{%- set f = 'MON' if short else 'MMMM' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.974902, "supported_languages": null}, "macro.dbt_date.postgres__month_name": {"name": "postgres__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.postgres__month_name", "macro_sql": "\n\n{%- macro postgres__month_name(date, short) -%}\n{# FM = Fill mode, which suppresses padding blanks #}\n{%- set f = 'FMMon' if short else 'FMMonth' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9751081, "supported_languages": null}, "macro.dbt_date.duckdb__month_name": {"name": "duckdb__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.duckdb__month_name", "macro_sql": "\n\n\n{%- macro duckdb__month_name(date, short) -%}\n    {%- if short -%}\n    substr(monthname({{ date }}), 1, 3)\n    {%- else -%}\n    monthname({{ date }})\n    {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.975304, "supported_languages": null}, "macro.dbt_date.spark__month_name": {"name": "spark__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.spark__month_name", "macro_sql": "\n\n{%- macro spark__month_name(date, short) -%}\n{%- set f = 'LLL' if short else 'LLLL' -%}\n    date_format({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.975509, "supported_languages": null}, "macro.dbt_date.trino__month_name": {"name": "trino__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.trino__month_name", "macro_sql": "\n\n{%- macro trino__month_name(date, short) -%}\n{%- set f = 'b' if short else 'M' -%}\n    date_format({{ date }}, '%{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.975778, "supported_languages": null}, "macro.dbt_date.last_month_name": {"name": "last_month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/last_month_name.sql", "original_file_path": "macros/calendar_date/last_month_name.sql", "unique_id": "macro.dbt_date.last_month_name", "macro_sql": "{%- macro last_month_name(short=True, tz=None) -%}\n{{ dbt_date.month_name(dbt_date.last_month(tz), short=short) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.month_name", "macro.dbt_date.last_month"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.976035, "supported_languages": null}, "macro.dbt_date.week_of_year": {"name": "week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "unique_id": "macro.dbt_date.week_of_year", "macro_sql": "{%- macro week_of_year(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('week_of_year', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9764879, "supported_languages": null}, "macro.dbt_date.default__week_of_year": {"name": "default__week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "unique_id": "macro.dbt_date.default__week_of_year", "macro_sql": "{%- macro default__week_of_year(date) -%}\ncast({{ dbt_date.date_part('week', date) }} as {{ dbt.type_int() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.976682, "supported_languages": null}, "macro.dbt_date.postgres__week_of_year": {"name": "postgres__week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "unique_id": "macro.dbt_date.postgres__week_of_year", "macro_sql": "\n\n{%- macro postgres__week_of_year(date) -%}\n{# postgresql 'week' returns isoweek. Use to_char instead.\n   WW = the first week starts on the first day of the year #}\ncast(to_char({{ date }}, 'WW') as {{ dbt.type_int() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9768362, "supported_languages": null}, "macro.dbt_date.duckdb__week_of_year": {"name": "duckdb__week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "unique_id": "macro.dbt_date.duckdb__week_of_year", "macro_sql": "\n\n{%- macro duckdb__week_of_year(date) -%}\ncast(ceil(dayofyear({{ date }}) / 7) as int)\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.976941, "supported_languages": null}, "macro.dbt_date.convert_timezone": {"name": "convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.convert_timezone", "macro_sql": "{%- macro convert_timezone(column, target_tz=None, source_tz=None) -%}\n{%- set source_tz = \"UTC\" if not source_tz else source_tz -%}\n{%- set target_tz = var(\"dbt_date:time_zone\") if not target_tz else target_tz -%}\n{{ adapter.dispatch('convert_timezone', 'dbt_date') (column, target_tz, source_tz) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.bigquery__convert_timezone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9782348, "supported_languages": null}, "macro.dbt_date.default__convert_timezone": {"name": "default__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.default__convert_timezone", "macro_sql": "{% macro default__convert_timezone(column, target_tz, source_tz) -%}\nconvert_timezone('{{ source_tz }}', '{{ target_tz }}',\n    cast({{ column }} as {{ dbt.type_timestamp() }})\n)\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.978446, "supported_languages": null}, "macro.dbt_date.bigquery__convert_timezone": {"name": "bigquery__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.bigquery__convert_timezone", "macro_sql": "{%- macro bigquery__convert_timezone(column, target_tz, source_tz=None) -%}\ntimestamp(datetime({{ column }}, '{{ target_tz}}'))\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.978602, "supported_languages": null}, "macro.dbt_date.postgres__convert_timezone": {"name": "postgres__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.postgres__convert_timezone", "macro_sql": "{% macro postgres__convert_timezone(column, target_tz, source_tz) -%}\ncast(\n    cast({{ column }} as {{ dbt.type_timestamp() }})\n        at time zone '{{ source_tz }}' at time zone '{{ target_tz }}' as {{ dbt.type_timestamp() }}\n)\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.978852, "supported_languages": null}, "macro.dbt_date.redshift__convert_timezone": {"name": "redshift__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.redshift__convert_timezone", "macro_sql": "{%- macro redshift__convert_timezone(column, target_tz, source_tz) -%}\n{{ return(dbt_date.default__convert_timezone(column, target_tz, source_tz)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.default__convert_timezone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.97905, "supported_languages": null}, "macro.dbt_date.duckdb__convert_timezone": {"name": "duckdb__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.duckdb__convert_timezone", "macro_sql": "{% macro duckdb__convert_timezone(column, target_tz, source_tz) -%}\n{{ return(dbt_date.postgres__convert_timezone(column, target_tz, source_tz)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.postgres__convert_timezone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.979248, "supported_languages": null}, "macro.dbt_date.spark__convert_timezone": {"name": "spark__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.spark__convert_timezone", "macro_sql": "{%- macro spark__convert_timezone(column, target_tz, source_tz) -%}\nfrom_utc_timestamp(\n        to_utc_timestamp({{ column }}, '{{ source_tz }}'),\n        '{{ target_tz }}'\n        )\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.979414, "supported_languages": null}, "macro.dbt_date.trino__convert_timezone": {"name": "trino__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.trino__convert_timezone", "macro_sql": "{%- macro trino__convert_timezone(column, target_tz, source_tz) -%}\n    cast((at_timezone(with_timezone(cast({{ column }} as {{ dbt.type_timestamp() }}), '{{ source_tz }}'), '{{ target_tz }}')) as {{ dbt.type_timestamp() }})\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.979657, "supported_languages": null}, "macro.dbt_date.n_months_away": {"name": "n_months_away", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_months_away.sql", "original_file_path": "macros/calendar_date/n_months_away.sql", "unique_id": "macro.dbt_date.n_months_away", "macro_sql": "{%- macro n_months_away(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt.date_trunc('month',\n    dbt.dateadd('month', n,\n        dbt_date.today(tz)\n        )\n    ) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.980018, "supported_languages": null}, "macro.dbt_date.iso_week_of_year": {"name": "iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.iso_week_of_year", "macro_sql": "{%- macro iso_week_of_year(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('iso_week_of_year', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.980758, "supported_languages": null}, "macro.dbt_date._iso_week_of_year": {"name": "_iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date._iso_week_of_year", "macro_sql": "{%- macro _iso_week_of_year(date, week_type) -%}\ncast({{ dbt_date.date_part(week_type, date) }} as {{ dbt.type_int() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.980959, "supported_languages": null}, "macro.dbt_date.default__iso_week_of_year": {"name": "default__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.default__iso_week_of_year", "macro_sql": "\n\n{%- macro default__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'isoweek') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9811032, "supported_languages": null}, "macro.dbt_date.snowflake__iso_week_of_year": {"name": "snowflake__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.snowflake__iso_week_of_year", "macro_sql": "\n\n{%- macro snowflake__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'weekiso') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.981245, "supported_languages": null}, "macro.dbt_date.postgres__iso_week_of_year": {"name": "postgres__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.postgres__iso_week_of_year", "macro_sql": "\n\n{%- macro postgres__iso_week_of_year(date) -%}\n-- postgresql week is isoweek, the first week of a year containing January 4 of that year.\n{{ dbt_date._iso_week_of_year(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9814541, "supported_languages": null}, "macro.dbt_date.duckdb__iso_week_of_year": {"name": "duckdb__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.duckdb__iso_week_of_year", "macro_sql": "\n\n{%- macro duckdb__iso_week_of_year(date) -%}\n{{ return(dbt_date.postgres__iso_week_of_year(date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.981601, "supported_languages": null}, "macro.dbt_date.spark__iso_week_of_year": {"name": "spark__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.spark__iso_week_of_year", "macro_sql": "\n\n{%- macro spark__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.981746, "supported_languages": null}, "macro.dbt_date.trino__iso_week_of_year": {"name": "trino__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.trino__iso_week_of_year", "macro_sql": "\n\n{%- macro trino__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.981889, "supported_languages": null}, "macro.dbt_date.week_end": {"name": "week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.week_end", "macro_sql": "{%- macro week_end(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('week_end', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9824052, "supported_languages": null}, "macro.dbt_date.default__week_end": {"name": "default__week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.default__week_end", "macro_sql": "{%- macro default__week_end(date) -%}\n{{ last_day(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.982542, "supported_languages": null}, "macro.dbt_date.snowflake__week_end": {"name": "snowflake__week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.snowflake__week_end", "macro_sql": "\n\n{%- macro snowflake__week_end(date) -%}\n{%- set dt = dbt_date.week_start(date) -%}\n{{ dbt_date.n_days_away(6, dt) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.week_start", "macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.98275, "supported_languages": null}, "macro.dbt_date.postgres__week_end": {"name": "postgres__week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.postgres__week_end", "macro_sql": "\n\n{%- macro postgres__week_end(date) -%}\n{%- set dt = dbt_date.week_start(date) -%}\n{{ dbt_date.n_days_away(6, dt) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.week_start", "macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.982956, "supported_languages": null}, "macro.dbt_date.duckdb__week_end": {"name": "duckdb__week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.duckdb__week_end", "macro_sql": "\n\n{%- macro duckdb__week_end(date) -%}\n{{ return(dbt_date.postgres__week_end(date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.983105, "supported_languages": null}, "macro.dbt_date.next_month_number": {"name": "next_month_number", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/next_month_number.sql", "original_file_path": "macros/calendar_date/next_month_number.sql", "unique_id": "macro.dbt_date.next_month_number", "macro_sql": "{%- macro next_month_number(tz=None) -%}\n{{ dbt_date.date_part('month', dbt_date.next_month(tz)) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_date.next_month"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.98333, "supported_languages": null}, "macro.dbt_date.last_month_number": {"name": "last_month_number", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/last_month_number.sql", "original_file_path": "macros/calendar_date/last_month_number.sql", "unique_id": "macro.dbt_date.last_month_number", "macro_sql": "{%- macro last_month_number(tz=None) -%}\n{{ dbt_date.date_part('month', dbt_date.last_month(tz)) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_date.last_month"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.983548, "supported_languages": null}, "macro.fivetran_utils.enabled_vars": {"name": "enabled_vars", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/enabled_vars.sql", "original_file_path": "macros/enabled_vars.sql", "unique_id": "macro.fivetran_utils.enabled_vars", "macro_sql": "{% macro enabled_vars(vars) %}\n\n{% for v in vars %}\n    \n    {% if var(v, True) == False %}\n    {{ return(False) }}\n    {% endif %}\n\n{% endfor %}\n\n{{ return(True) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.983959, "supported_languages": null}, "macro.fivetran_utils.percentile": {"name": "percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.percentile", "macro_sql": "{% macro percentile(percentile_field, partition_field, percent) -%}\n\n{{ adapter.dispatch('percentile', 'fivetran_utils') (percentile_field, partition_field, percent) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.bigquery__percentile"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9849138, "supported_languages": null}, "macro.fivetran_utils.default__percentile": {"name": "default__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.default__percentile", "macro_sql": "{% macro default__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile_cont( \n        {{ percent }} )\n        within group ( order by {{ percentile_field }} )\n        over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.985086, "supported_languages": null}, "macro.fivetran_utils.redshift__percentile": {"name": "redshift__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.redshift__percentile", "macro_sql": "{% macro redshift__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile_cont( \n        {{ percent }} )\n        within group ( order by {{ percentile_field }} )\n        over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.985257, "supported_languages": null}, "macro.fivetran_utils.bigquery__percentile": {"name": "bigquery__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.bigquery__percentile", "macro_sql": "{% macro bigquery__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile_cont( \n        {{ percentile_field }}, \n        {{ percent }}) \n        over (partition by {{ partition_field }}    \n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9854221, "supported_languages": null}, "macro.fivetran_utils.postgres__percentile": {"name": "postgres__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.postgres__percentile", "macro_sql": "{% macro postgres__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile_cont( \n        {{ percent }} )\n        within group ( order by {{ percentile_field }} )\n    /* have to group by partition field */\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9855769, "supported_languages": null}, "macro.fivetran_utils.spark__percentile": {"name": "spark__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.spark__percentile", "macro_sql": "{% macro spark__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile( \n        {{ percentile_field }}, \n        {{ percent }}) \n        over (partition by {{ partition_field }}    \n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.985745, "supported_languages": null}, "macro.fivetran_utils.pivot_json_extract": {"name": "pivot_json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/pivot_json_extract.sql", "original_file_path": "macros/pivot_json_extract.sql", "unique_id": "macro.fivetran_utils.pivot_json_extract", "macro_sql": "{% macro pivot_json_extract(string, list_of_properties) %}\n\n{%- for property in list_of_properties -%}\n{%- if property is mapping -%}\nreplace( {{ fivetran_utils.json_extract(string, property.name) }}, '\"', '') as {{ property.alias if property.alias else property.name | replace(' ', '_') | replace('.', '_') | lower }}\n\n{%- else -%}\nreplace( {{ fivetran_utils.json_extract(string, property) }}, '\"', '') as {{ property | replace(' ', '_') | lower }}\n\n{%- endif -%}\n{%- if not loop.last -%},{%- endif %}\n{% endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.json_extract"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.986561, "supported_languages": null}, "macro.fivetran_utils.persist_pass_through_columns": {"name": "persist_pass_through_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/persist_pass_through_columns.sql", "original_file_path": "macros/persist_pass_through_columns.sql", "unique_id": "macro.fivetran_utils.persist_pass_through_columns", "macro_sql": "{% macro persist_pass_through_columns(pass_through_variable, identifier=none, transform='') %}\n\n{% if var(pass_through_variable, none) %}\n    {% for field in var(pass_through_variable) %}\n        , {{ transform ~ '(' ~ (identifier ~ '.' if identifier else '') ~ (field.alias if field.alias else field.name) ~ ')' }} as {{ field.alias if field.alias else field.name }}\n    {% endfor %}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9872892, "supported_languages": null}, "macro.fivetran_utils.json_parse": {"name": "json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.json_parse", "macro_sql": "{% macro json_parse(string, string_path) -%}\n\n{{ adapter.dispatch('json_parse', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.bigquery__json_parse"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.988427, "supported_languages": null}, "macro.fivetran_utils.default__json_parse": {"name": "default__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.default__json_parse", "macro_sql": "{% macro default__json_parse(string, string_path) %}\n\n  json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9886851, "supported_languages": null}, "macro.fivetran_utils.redshift__json_parse": {"name": "redshift__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.redshift__json_parse", "macro_sql": "{% macro redshift__json_parse(string, string_path) %}\n\n  json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.988949, "supported_languages": null}, "macro.fivetran_utils.bigquery__json_parse": {"name": "bigquery__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.bigquery__json_parse", "macro_sql": "{% macro bigquery__json_parse(string, string_path) %}\n\n \n  json_extract_scalar({{string}}, '$.{%- for s in string_path -%}{{ s }}{%- if not loop.last -%}.{%- endif -%}{%- endfor -%} ')\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9891992, "supported_languages": null}, "macro.fivetran_utils.postgres__json_parse": {"name": "postgres__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.postgres__json_parse", "macro_sql": "{% macro postgres__json_parse(string, string_path) %}\n\n  {{string}}::json #>> '{ {%- for s in string_path -%}{{ s }}{%- if not loop.last -%},{%- endif -%}{%- endfor -%} }'\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.989449, "supported_languages": null}, "macro.fivetran_utils.snowflake__json_parse": {"name": "snowflake__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.snowflake__json_parse", "macro_sql": "{% macro snowflake__json_parse(string, string_path) %}\n\n  parse_json( {{string}} ) {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.989729, "supported_languages": null}, "macro.fivetran_utils.spark__json_parse": {"name": "spark__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.spark__json_parse", "macro_sql": "{% macro spark__json_parse(string, string_path) %}\n\n  {{string}} : {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.990002, "supported_languages": null}, "macro.fivetran_utils.max_bool": {"name": "max_bool", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "unique_id": "macro.fivetran_utils.max_bool", "macro_sql": "{% macro max_bool(boolean_field) -%}\n\n{{ adapter.dispatch('max_bool', 'fivetran_utils') (boolean_field) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.bigquery__max_bool"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.990331, "supported_languages": null}, "macro.fivetran_utils.default__max_bool": {"name": "default__max_bool", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "unique_id": "macro.fivetran_utils.default__max_bool", "macro_sql": "{% macro default__max_bool(boolean_field)  %}\n\n    bool_or( {{ boolean_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.990438, "supported_languages": null}, "macro.fivetran_utils.snowflake__max_bool": {"name": "snowflake__max_bool", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "unique_id": "macro.fivetran_utils.snowflake__max_bool", "macro_sql": "{% macro snowflake__max_bool(boolean_field)  %}\n\n    max( {{ boolean_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9905438, "supported_languages": null}, "macro.fivetran_utils.bigquery__max_bool": {"name": "bigquery__max_bool", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "unique_id": "macro.fivetran_utils.bigquery__max_bool", "macro_sql": "{% macro bigquery__max_bool(boolean_field)  %}\n\n    max( {{ boolean_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.990645, "supported_languages": null}, "macro.fivetran_utils.calculated_fields": {"name": "calculated_fields", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/calculated_fields.sql", "original_file_path": "macros/calculated_fields.sql", "unique_id": "macro.fivetran_utils.calculated_fields", "macro_sql": "{% macro calculated_fields(variable) -%}\n\n{% if var(variable, none) %}\n    {% for field in var(variable) %}\n        , {{ field.transform_sql }} as {{ field.name }} \n    {% endfor %}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9910269, "supported_languages": null}, "macro.fivetran_utils.drop_schemas_automation": {"name": "drop_schemas_automation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/drop_schemas_automation.sql", "original_file_path": "macros/drop_schemas_automation.sql", "unique_id": "macro.fivetran_utils.drop_schemas_automation", "macro_sql": "{% macro drop_schemas_automation(drop_target_schema=true) %}\n    {{ return(adapter.dispatch('drop_schemas_automation', 'fivetran_utils')(drop_target_schema)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__drop_schemas_automation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9917362, "supported_languages": null}, "macro.fivetran_utils.default__drop_schemas_automation": {"name": "default__drop_schemas_automation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/drop_schemas_automation.sql", "original_file_path": "macros/drop_schemas_automation.sql", "unique_id": "macro.fivetran_utils.default__drop_schemas_automation", "macro_sql": "{% macro default__drop_schemas_automation(drop_target_schema=true) %}\n\n{% set fetch_list_sql %}\n    {% if target.type not in ('databricks', 'spark') %}\n        select schema_name\n        from \n        {{ wrap_in_quotes(target.database) }}.INFORMATION_SCHEMA.SCHEMATA\n        where lower(schema_name) like '{{ target.schema | lower }}{%- if not drop_target_schema -%}_{%- endif -%}%'\n    {% else %}\n        SHOW SCHEMAS LIKE '{{ target.schema }}{%- if not drop_target_schema -%}_{%- endif -%}*'\n    {% endif %}\n{% endset %}\n\n{% set results = run_query(fetch_list_sql) %}\n\n{% if execute %}\n    {% set results_list = results.columns[0].values() %}\n{% else %}\n    {% set results_list = [] %}\n{% endif %}\n\n{% for schema_to_drop in results_list %}\n    {% do adapter.drop_schema(api.Relation.create(database=target.database, schema=schema_to_drop)) %}\n    {{ print('Schema ' ~ schema_to_drop ~ ' successfully dropped from the ' ~ target.database ~ ' database.\\n')}}\n{% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.wrap_in_quotes", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.992945, "supported_languages": null}, "macro.fivetran_utils.seed_data_helper": {"name": "seed_data_helper", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/seed_data_helper.sql", "original_file_path": "macros/seed_data_helper.sql", "unique_id": "macro.fivetran_utils.seed_data_helper", "macro_sql": "{% macro seed_data_helper(seed_name, warehouses) %}\n\n{% if target.type in warehouses %}\n    {% for w in warehouses %}\n        {% if target.type == w %}\n            {{ return(ref(seed_name ~ \"_\" ~ w ~ \"\")) }}\n        {% endif %}\n    {% endfor %}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.993549, "supported_languages": null}, "macro.fivetran_utils.fill_pass_through_columns": {"name": "fill_pass_through_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fill_pass_through_columns.sql", "original_file_path": "macros/fill_pass_through_columns.sql", "unique_id": "macro.fivetran_utils.fill_pass_through_columns", "macro_sql": "{% macro fill_pass_through_columns(pass_through_variable) %}\n\n{% if var(pass_through_variable) %}\n    {% for field in var(pass_through_variable) %}\n        {% if field is mapping %}\n            {% if field.transform_sql %}\n                , {{ field.transform_sql }} as {{ field.alias if field.alias else field.name }}\n            {% else %}\n                , {{ field.alias if field.alias else field.name }}\n            {% endif %}\n        {% else %}\n        , {{ field }}\n        {% endif %}\n    {% endfor %}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9943628, "supported_languages": null}, "macro.fivetran_utils.string_agg": {"name": "string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.string_agg", "macro_sql": "{% macro string_agg(field_to_agg, delimiter) -%}\n\n{{ adapter.dispatch('string_agg', 'fivetran_utils') (field_to_agg, delimiter) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__string_agg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9948459, "supported_languages": null}, "macro.fivetran_utils.default__string_agg": {"name": "default__string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.default__string_agg", "macro_sql": "{% macro default__string_agg(field_to_agg, delimiter) %}\n    string_agg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.994981, "supported_languages": null}, "macro.fivetran_utils.snowflake__string_agg": {"name": "snowflake__string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.snowflake__string_agg", "macro_sql": "{% macro snowflake__string_agg(field_to_agg, delimiter) %}\n    listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.995113, "supported_languages": null}, "macro.fivetran_utils.redshift__string_agg": {"name": "redshift__string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.redshift__string_agg", "macro_sql": "{% macro redshift__string_agg(field_to_agg, delimiter) %}\n    listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.995245, "supported_languages": null}, "macro.fivetran_utils.spark__string_agg": {"name": "spark__string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.spark__string_agg", "macro_sql": "{% macro spark__string_agg(field_to_agg, delimiter) %}\n    -- collect set will remove duplicates\n    replace(replace(replace(cast( collect_set({{ field_to_agg }}) as string), '[', ''), ']', ''), ', ', {{ delimiter }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9953861, "supported_languages": null}, "macro.fivetran_utils.timestamp_diff": {"name": "timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.timestamp_diff", "macro_sql": "{% macro timestamp_diff(first_date, second_date, datepart) %}\n  {{ adapter.dispatch('timestamp_diff', 'fivetran_utils')(first_date, second_date, datepart) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.bigquery__timestamp_diff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9983969, "supported_languages": null}, "macro.fivetran_utils.default__timestamp_diff": {"name": "default__timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.default__timestamp_diff", "macro_sql": "{% macro default__timestamp_diff(first_date, second_date, datepart) %}\n\n    datediff(\n        {{ datepart }},\n        {{ first_date }},\n        {{ second_date }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.998563, "supported_languages": null}, "macro.fivetran_utils.redshift__timestamp_diff": {"name": "redshift__timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.redshift__timestamp_diff", "macro_sql": "{% macro redshift__timestamp_diff(first_date, second_date, datepart) %}\n\n    datediff(\n        {{ datepart }},\n        {{ first_date }},\n        {{ second_date }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.9987268, "supported_languages": null}, "macro.fivetran_utils.bigquery__timestamp_diff": {"name": "bigquery__timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.bigquery__timestamp_diff", "macro_sql": "{% macro bigquery__timestamp_diff(first_date, second_date, datepart) %}\n\n    timestamp_diff(\n        {{second_date}},\n        {{first_date}},\n        {{datepart}}\n    )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984807.998894, "supported_languages": null}, "macro.fivetran_utils.postgres__timestamp_diff": {"name": "postgres__timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.postgres__timestamp_diff", "macro_sql": "{% macro postgres__timestamp_diff(first_date, second_date, datepart) %}\n\n    {% if datepart == 'year' %}\n        (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n    {% elif datepart == 'quarter' %}\n        ({{ dbt.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n    {% elif datepart == 'month' %}\n        ({{ dbt.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n    {% elif datepart == 'day' %}\n        (({{second_date}})::date - ({{first_date}})::date)\n    {% elif datepart == 'week' %}\n        ({{ dbt.datediff(first_date, second_date, 'day') }} / 7 + case\n            when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n                case when {{first_date}} <= {{second_date}} then 0 else -1 end\n            else\n                case when {{first_date}} <= {{second_date}} then 1 else 0 end\n        end)\n    {% elif datepart == 'hour' %}\n        ({{ dbt.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n    {% elif datepart == 'minute' %}\n        ({{ dbt.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n    {% elif datepart == 'second' %}\n        ({{ dbt.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n    {% elif datepart == 'millisecond' %}\n        ({{ dbt.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n    {% elif datepart == 'microsecond' %}\n        ({{ dbt.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n    {% else %}\n        {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.000715, "supported_languages": null}, "macro.fivetran_utils.try_cast": {"name": "try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.try_cast", "macro_sql": "{% macro try_cast(field, type) %}\n    {{ adapter.dispatch('try_cast', 'fivetran_utils') (field, type) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.bigquery__try_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.001587, "supported_languages": null}, "macro.fivetran_utils.default__safe_cast": {"name": "default__safe_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n    {# most databases don't support this function yet\n    so we just need to use cast #}\n    cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.001728, "supported_languages": null}, "macro.fivetran_utils.redshift__try_cast": {"name": "redshift__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.redshift__try_cast", "macro_sql": "{% macro redshift__try_cast(field, type) %}\n{%- if type == 'numeric' -%}\n\n    case\n        when trim({{field}}) ~ '^(0|[1-9][0-9]*)$' then trim({{field}})\n        else null\n    end::{{type}}\n\n{% else %}\n    {{ exceptions.raise_compiler_error(\n            \"non-numeric datatypes are not currently supported\") }}\n\n{% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.002012, "supported_languages": null}, "macro.fivetran_utils.postgres__try_cast": {"name": "postgres__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.postgres__try_cast", "macro_sql": "{% macro postgres__try_cast(field, type) %}\n{%- if type == 'numeric' -%}\n\n    case\n        when replace(cast({{field}} as varchar),cast(' ' as varchar),cast('' as varchar)) ~ '^(0|[1-9][0-9]*)$' \n        then replace(cast({{field}} as varchar),cast(' ' as varchar),cast('' as varchar))\n        else null\n    end::{{type}}\n\n{% else %}\n    {{ exceptions.raise_compiler_error(\n            \"non-numeric datatypes are not currently supported\") }}\n\n{% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.0023081, "supported_languages": null}, "macro.fivetran_utils.snowflake__try_cast": {"name": "snowflake__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.snowflake__try_cast", "macro_sql": "{% macro snowflake__try_cast(field, type) %}\n    try_cast(cast({{field}} as varchar) as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.002442, "supported_languages": null}, "macro.fivetran_utils.bigquery__try_cast": {"name": "bigquery__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.bigquery__try_cast", "macro_sql": "{% macro bigquery__try_cast(field, type) %}\n    safe_cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.00257, "supported_languages": null}, "macro.fivetran_utils.spark__try_cast": {"name": "spark__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.spark__try_cast", "macro_sql": "{% macro spark__try_cast(field, type) %}\n    try_cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.002699, "supported_languages": null}, "macro.fivetran_utils.source_relation": {"name": "source_relation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "unique_id": "macro.fivetran_utils.source_relation", "macro_sql": "{% macro source_relation(union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('source_relation', 'fivetran_utils') (union_schema_variable, union_database_variable) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__source_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.0031948, "supported_languages": null}, "macro.fivetran_utils.default__source_relation": {"name": "default__source_relation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "unique_id": "macro.fivetran_utils.default__source_relation", "macro_sql": "{% macro default__source_relation(union_schema_variable, union_database_variable) %}\n\n{% if var(union_schema_variable, none)  %}\n, case\n    {% for schema in var(union_schema_variable) %}\n    when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%.{{ schema|lower }}.%' then '{{ schema|lower }}'\n    {% endfor %}\n  end as source_relation\n{% elif var(union_database_variable, none) %}\n, case\n    {% for database in var(union_database_variable) %}\n    when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%{{ database|lower }}.%' then '{{ database|lower }}'\n    {% endfor %}\n  end as source_relation\n{% else %}\n, cast('' as {{ dbt.type_string() }}) as source_relation\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.003802, "supported_languages": null}, "macro.fivetran_utils.first_value": {"name": "first_value", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "unique_id": "macro.fivetran_utils.first_value", "macro_sql": "{% macro first_value(first_value_field, partition_field, order_by_field, order=\"asc\") -%}\n\n{{ adapter.dispatch('first_value', 'fivetran_utils') (first_value_field, partition_field, order_by_field, order) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__first_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.004309, "supported_languages": null}, "macro.fivetran_utils.default__first_value": {"name": "default__first_value", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "unique_id": "macro.fivetran_utils.default__first_value", "macro_sql": "{% macro default__first_value(first_value_field, partition_field, order_by_field, order=\"asc\")  %}\n\n    first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.004522, "supported_languages": null}, "macro.fivetran_utils.redshift__first_value": {"name": "redshift__first_value", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "unique_id": "macro.fivetran_utils.redshift__first_value", "macro_sql": "{% macro redshift__first_value(first_value_field, partition_field, order_by_field, order=\"asc\") %}\n\n    first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} , {{ partition_field }} rows unbounded preceding )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.004755, "supported_languages": null}, "macro.fivetran_utils.add_dbt_source_relation": {"name": "add_dbt_source_relation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/add_dbt_source_relation.sql", "original_file_path": "macros/add_dbt_source_relation.sql", "unique_id": "macro.fivetran_utils.add_dbt_source_relation", "macro_sql": "{% macro add_dbt_source_relation() %}\n\n{% if var('union_schemas', none) or var('union_databases', none) %}\n, _dbt_source_relation\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.005018, "supported_languages": null}, "macro.fivetran_utils.add_pass_through_columns": {"name": "add_pass_through_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/add_pass_through_columns.sql", "original_file_path": "macros/add_pass_through_columns.sql", "unique_id": "macro.fivetran_utils.add_pass_through_columns", "macro_sql": "{% macro add_pass_through_columns(base_columns, pass_through_var) %}\n\n  {% if pass_through_var %}\n\n    {% for column in pass_through_var %}\n\n    {% if column is mapping %}\n\n      {% if column.alias %}\n\n        {% do base_columns.append({ \"name\": column.name, \"alias\": column.alias, \"datatype\": column.datatype if column.datatype else dbt.type_string()}) %}\n\n      {% else %}\n\n        {% do base_columns.append({ \"name\": column.name, \"datatype\": column.datatype if column.datatype else dbt.type_string()}) %}\n        \n      {% endif %}\n\n    {% else %}\n\n      {% do base_columns.append({ \"name\": column, \"datatype\": dbt.type_string()}) %}\n\n    {% endif %}\n\n    {% endfor %}\n\n  {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.00617, "supported_languages": null}, "macro.fivetran_utils.union_relations": {"name": "union_relations", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "unique_id": "macro.fivetran_utils.union_relations", "macro_sql": "{%- macro union_relations(relations, aliases=none, column_override=none, include=[], exclude=[], source_column_name=none) -%}\n\n    {%- if exclude and include -%}\n        {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n    {%- endif -%}\n\n    {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n    {%- if not execute %}\n        {{ return('') }}\n    {% endif -%}\n\n    {%- set column_override = column_override if column_override is not none else {} -%}\n    {%- set source_column_name = source_column_name if source_column_name is not none else '_dbt_source_relation' -%}\n\n    {%- set relation_columns = {} -%}\n    {%- set column_superset = {} -%}\n\n    {%- for relation in relations -%}\n\n        {%- do relation_columns.update({relation: []}) -%}\n\n        {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n        {%- set cols = adapter.get_columns_in_relation(relation) -%}\n        {%- for col in cols -%}\n\n        {#- If an exclude list was provided and the column is in the list, do nothing -#}\n        {%- if exclude and col.column in exclude -%}\n\n        {#- If an include list was provided and the column is not in the list, do nothing -#}\n        {%- elif include and col.column not in include -%}\n\n        {#- Otherwise add the column to the column superset -#}\n        {%- else -%}\n\n            {#- update the list of columns in this relation -#}\n            {%- do relation_columns[relation].append(col.column) -%}\n\n            {%- if col.column in column_superset -%}\n\n                {%- set stored = column_superset[col.column] -%}\n                {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n                    {%- do column_superset.update({col.column: col}) -%}\n\n                {%- endif %}\n\n            {%- else -%}\n\n                {%- do column_superset.update({col.column: col}) -%}\n\n            {%- endif -%}\n\n        {%- endif -%}\n\n        {%- endfor -%}\n    {%- endfor -%}\n\n    {%- set ordered_column_names = column_superset.keys() -%}\n\n    {%- for relation in relations %}\n\n        (\n            select\n\n                cast({{ dbt.string_literal(relation) }} as {{ dbt.type_string() }}) as {{ source_column_name }},\n                {% for col_name in ordered_column_names -%}\n\n                    {%- set col = column_superset[col_name] %}\n                    {%- set col_type = column_override.get(col.column, col.data_type) %}\n                    {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n                    cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n                {%- endfor %}\n\n            from {{ aliases[loop.index0] if aliases else relation }}\n        )\n\n        {% if not loop.last -%}\n            union all\n        {% endif -%}\n\n    {%- endfor -%}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt.string_literal", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.010369, "supported_languages": null}, "macro.fivetran_utils.union_tables": {"name": "union_tables", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "unique_id": "macro.fivetran_utils.union_tables", "macro_sql": "{%- macro union_tables(tables, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_table') -%}\n\n    {%- do exceptions.warn(\"Warning: the `union_tables` macro is no longer supported and will be deprecated in a future release of dbt-utils. Use the `union_relations` macro instead\") -%}\n\n    {{ return(dbt_utils.union_relations(tables, column_override, include, exclude, source_column_name)) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_utils.union_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.0107489, "supported_languages": null}, "macro.fivetran_utils.snowflake_seed_data": {"name": "snowflake_seed_data", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/snowflake_seed_data.sql", "original_file_path": "macros/snowflake_seed_data.sql", "unique_id": "macro.fivetran_utils.snowflake_seed_data", "macro_sql": "{% macro snowflake_seed_data(seed_name) %}\n\n{% if target.type == 'snowflake' %}\n{{ return(ref(seed_name ~ '_snowflake')) }}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.0111392, "supported_languages": null}, "macro.fivetran_utils.fill_staging_columns": {"name": "fill_staging_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "unique_id": "macro.fivetran_utils.fill_staging_columns", "macro_sql": "{% macro fill_staging_columns(source_columns, staging_columns) -%}\n\n{%- set source_column_names = source_columns|map(attribute='name')|map('lower')|list -%}\n\n{%- for column in staging_columns %}\n    {% if column.name|lower in source_column_names -%}\n        {{ fivetran_utils.quote_column(column) }} as \n        {%- if 'alias' in column %} {{ column.alias }} {% else %} {{ fivetran_utils.quote_column(column) }} {%- endif -%}\n    {%- else -%}\n        cast(null as {{ column.datatype }})\n        {%- if 'alias' in column %} as {{ column.alias }} {% else %} as {{ fivetran_utils.quote_column(column) }} {% endif -%}\n    {%- endif -%}\n    {%- if not loop.last -%} , {% endif -%}\n{% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.quote_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.012796, "supported_languages": null}, "macro.fivetran_utils.quote_column": {"name": "quote_column", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "unique_id": "macro.fivetran_utils.quote_column", "macro_sql": "{% macro quote_column(column) %}\n    {% if 'quote' in column %}\n        {% if column.quote %}\n            {% if target.type in ('bigquery', 'spark', 'databricks') %}\n            `{{ column.name }}`\n            {% elif target.type == 'snowflake' %}\n            \"{{ column.name | upper }}\"\n            {% else %}\n            \"{{ column.name }}\"\n            {% endif %}\n        {% else %}\n        {{ column.name }}\n        {% endif %}\n    {% else %}\n    {{ column.name }}\n    {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.0133948, "supported_languages": null}, "macro.fivetran_utils.json_extract": {"name": "json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.json_extract", "macro_sql": "{% macro json_extract(string, string_path) -%}\n\n{{ adapter.dispatch('json_extract', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.bigquery__json_extract"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.013978, "supported_languages": null}, "macro.fivetran_utils.default__json_extract": {"name": "default__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.default__json_extract", "macro_sql": "{% macro default__json_extract(string, string_path) %}\n\n  json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} )\n \n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.0141408, "supported_languages": null}, "macro.fivetran_utils.snowflake__json_extract": {"name": "snowflake__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.snowflake__json_extract", "macro_sql": "{% macro snowflake__json_extract(string, string_path) %}\n\n  json_extract_path_text(try_parse_json( {{string}} ), {{ \"'\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.014304, "supported_languages": null}, "macro.fivetran_utils.redshift__json_extract": {"name": "redshift__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.redshift__json_extract", "macro_sql": "{% macro redshift__json_extract(string, string_path) %}\n\n  case when is_valid_json( {{string}} ) then json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} ) else null end\n \n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.0144792, "supported_languages": null}, "macro.fivetran_utils.bigquery__json_extract": {"name": "bigquery__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.bigquery__json_extract", "macro_sql": "{% macro bigquery__json_extract(string, string_path) %}\n\n  json_extract_scalar({{string}}, {{ \"'$.\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.0146382, "supported_languages": null}, "macro.fivetran_utils.postgres__json_extract": {"name": "postgres__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.postgres__json_extract", "macro_sql": "{% macro postgres__json_extract(string, string_path) %}\n\n  {{string}}::json->>{{\"'\" ~ string_path ~ \"'\" }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.0147939, "supported_languages": null}, "macro.fivetran_utils.collect_freshness": {"name": "collect_freshness", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "unique_id": "macro.fivetran_utils.collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n  {{ return(adapter.dispatch('collect_freshness')(source, loaded_at_field, filter))}}\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.015666, "supported_languages": null}, "macro.fivetran_utils.default__collect_freshness": {"name": "default__collect_freshness", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "unique_id": "macro.fivetran_utils.default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n  {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n\n  {%- set enabled_array = [] -%}\n  {% for node in graph.sources.values() %}\n    {% if node.identifier == source.identifier %}\n      {% if (node.meta['is_enabled'] | default(true)) %}\n        {%- do enabled_array.append(1) -%}\n      {% endif %}\n    {% endif %}\n  {% endfor %}\n  {% set is_enabled = (enabled_array != []) %}\n\n    select\n      {% if is_enabled %}\n      max({{ loaded_at_field }})\n      {% else %} \n      {{ current_timestamp() }} {% endif %} as max_loaded_at,\n      {{ current_timestamp() }} as snapshotted_at\n\n    {% if is_enabled %}\n    from {{ source }}\n      {% if filter %}\n      where {{ filter }}\n      {% endif %}\n    {% endif %}\n\n  {% endcall %}\n\n  {% if dbt_version.split('.') | map('int') | list >= [1, 5, 0]  %}\n    {{ return(load_result('collect_freshness')) }}\n  {% else %}\n    {{ return(load_result('collect_freshness').table) }}\n  {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.016951, "supported_languages": null}, "macro.fivetran_utils.timestamp_add": {"name": "timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.timestamp_add", "macro_sql": "{% macro timestamp_add(datepart, interval, from_timestamp) -%}\n\n{{ adapter.dispatch('timestamp_add', 'fivetran_utils') (datepart, interval, from_timestamp) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.bigquery__timestamp_add"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.0176818, "supported_languages": null}, "macro.fivetran_utils.default__timestamp_add": {"name": "default__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.default__timestamp_add", "macro_sql": "{% macro default__timestamp_add(datepart, interval, from_timestamp) %}\n\n    timestampadd(\n        {{ datepart }},\n        {{ interval }},\n        {{ from_timestamp }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.0178502, "supported_languages": null}, "macro.fivetran_utils.bigquery__timestamp_add": {"name": "bigquery__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.bigquery__timestamp_add", "macro_sql": "{% macro bigquery__timestamp_add(datepart, interval, from_timestamp) %}\n\n        timestamp_add({{ from_timestamp }}, interval  {{ interval }} {{ datepart }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.018016, "supported_languages": null}, "macro.fivetran_utils.redshift__timestamp_add": {"name": "redshift__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.redshift__timestamp_add", "macro_sql": "{% macro redshift__timestamp_add(datepart, interval, from_timestamp) %}\n\n        dateadd(\n        {{ datepart }},\n        {{ interval }},\n        {{ from_timestamp }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.018181, "supported_languages": null}, "macro.fivetran_utils.postgres__timestamp_add": {"name": "postgres__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.postgres__timestamp_add", "macro_sql": "{% macro postgres__timestamp_add(datepart, interval, from_timestamp) %}\n\n    {{ from_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.018346, "supported_languages": null}, "macro.fivetran_utils.spark__timestamp_add": {"name": "spark__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.spark__timestamp_add", "macro_sql": "{% macro spark__timestamp_add(datepart, interval, from_timestamp) %}\n\n    {{ dbt.dateadd(datepart, interval, from_timestamp) }}\n        \n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.0185258, "supported_languages": null}, "macro.fivetran_utils.ceiling": {"name": "ceiling", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "unique_id": "macro.fivetran_utils.ceiling", "macro_sql": "{% macro ceiling(num) -%}\n\n{{ adapter.dispatch('ceiling', 'fivetran_utils') (num) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__ceiling"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.018786, "supported_languages": null}, "macro.fivetran_utils.default__ceiling": {"name": "default__ceiling", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "unique_id": "macro.fivetran_utils.default__ceiling", "macro_sql": "{% macro default__ceiling(num) %}\n    ceiling({{ num }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.018893, "supported_languages": null}, "macro.fivetran_utils.snowflake__ceiling": {"name": "snowflake__ceiling", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "unique_id": "macro.fivetran_utils.snowflake__ceiling", "macro_sql": "{% macro snowflake__ceiling(num) %}\n    ceil({{ num }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.019061, "supported_languages": null}, "macro.fivetran_utils.remove_prefix_from_columns": {"name": "remove_prefix_from_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/remove_prefix_from_columns.sql", "original_file_path": "macros/remove_prefix_from_columns.sql", "unique_id": "macro.fivetran_utils.remove_prefix_from_columns", "macro_sql": "{% macro remove_prefix_from_columns(columns, prefix='', exclude=[]) %}\n\n        {%- for col in columns if col.name not in exclude -%}\n        {%- if col.name[:prefix|length]|lower == prefix -%}\n        {{ col.name }} as {{ col.name[prefix|length:] }}\n        {%- else -%}\n        {{ col.name }}\n        {%- endif -%}\n        {%- if not loop.last -%},{%- endif %}\n        {% endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.019729, "supported_languages": null}, "macro.fivetran_utils.union_data": {"name": "union_data", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "unique_id": "macro.fivetran_utils.union_data", "macro_sql": "{%- macro union_data(table_identifier, database_variable, schema_variable, default_database, default_schema, default_variable, union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('union_data', 'fivetran_utils') (\n    table_identifier, \n    database_variable, \n    schema_variable, \n    default_database, \n    default_schema, \n    default_variable,\n    union_schema_variable,\n    union_database_variable\n    ) }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.fivetran_utils.default__union_data"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.023328, "supported_languages": null}, "macro.fivetran_utils.default__union_data": {"name": "default__union_data", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "unique_id": "macro.fivetran_utils.default__union_data", "macro_sql": "{%- macro default__union_data(\n    table_identifier, \n    database_variable, \n    schema_variable, \n    default_database, \n    default_schema, \n    default_variable,\n    union_schema_variable,\n    union_database_variable\n    ) -%}\n\n{%- if var(union_schema_variable, none) -%}\n\n    {%- set relations = [] -%}\n    \n    {%- if var(union_schema_variable) is string -%}\n    {%- set trimmed = var(union_schema_variable)|trim('[')|trim(']') -%}\n    {%- set schemas = trimmed.split(',')|map('trim',\" \")|map('trim','\"')|map('trim',\"'\") -%}\n    {%- else -%}\n    {%- set schemas = var(union_schema_variable) -%}\n    {%- endif -%}\n\n    {%- for schema in var(union_schema_variable) -%}\n    {%- set relation=adapter.get_relation(\n        database=source(schema, table_identifier).database if var('has_defined_sources', false) else var(database_variable, default_database),\n        schema=source(schema, table_identifier).schema if var('has_defined_sources', false) else schema,\n        identifier=source(schema, table_identifier).identifier if var('has_defined_sources', false) else table_identifier\n    ) -%}\n    \n    {%- set relation_exists=relation is not none -%}\n\n    {%- if relation_exists -%}\n        {%- do relations.append(relation) -%}\n    {%- endif -%}\n\n    {%- endfor -%}\n    \n    {%- if relations != [] -%}\n        {{ dbt_utils.union_relations(relations) }}\n    {%- else -%}\n    {% if execute and not var('fivetran__remove_empty_table_warnings', false) -%}\n    {{ exceptions.warn(\"\\n\\nPlease be aware: The \" ~ table_identifier|upper ~ \" table was not found in your \" ~ default_schema|upper ~ \" schema(s). The Fivetran dbt package will create a completely empty \" ~ table_identifier|upper ~ \" staging model as to not break downstream transformations. To turn off these warnings, set the `fivetran__remove_empty_table_warnings` variable to TRUE (see https://github.com/fivetran/dbt_fivetran_utils/tree/releases/v0.4.latest#union_data-source for details).\\n\") }}\n    {% endif -%}\n    select \n        cast(null as {{ dbt.type_string() }}) as _dbt_source_relation\n    limit 0\n    {%- endif -%}\n\n{%- elif var(union_database_variable, none) -%}\n\n    {%- set relations = [] -%}\n\n    {%- for database in var(union_database_variable) -%}\n    {%- set relation=adapter.get_relation(\n        database=source(schema, table_identifier).database if var('has_defined_sources', false) else database,\n        schema=source(schema, table_identifier).schema if var('has_defined_sources', false) else var(schema_variable, default_schema),\n        identifier=source(schema, table_identifier).identifier if var('has_defined_sources', false) else table_identifier\n    ) -%}\n\n    {%- set relation_exists=relation is not none -%}\n\n    {%- if relation_exists -%}\n        {%- do relations.append(relation) -%}\n    {%- endif -%}\n\n    {%- endfor -%}\n\n    {%- if relations != [] -%}\n        {{ dbt_utils.union_relations(relations) }}\n    {%- else -%}\n    {% if execute and not var('fivetran__remove_empty_table_warnings', false) -%}\n    {{ exceptions.warn(\"\\n\\nPlease be aware: The \" ~ table_identifier|upper ~ \" table was not found in your \" ~ default_schema|upper ~ \" schema(s). The Fivetran dbt package will create a completely empty \" ~ table_identifier|upper ~ \" staging model as to not break downstream transformations. To turn off these warnings, set the `fivetran__remove_empty_table_warnings` variable to TRUE (see https://github.com/fivetran/dbt_fivetran_utils/tree/releases/v0.4.latest#union_data-source for details).\\n\") }}\n    {% endif -%}\n    select \n        cast(null as {{ dbt.type_string() }}) as _dbt_source_relation\n    limit 0\n    {%- endif -%}\n\n{%- else -%}\n    {% set exception_schemas = {\"linkedin_company_pages\": \"linkedin_pages\", \"instagram_business_pages\": \"instagram_business\"} %}\n    {% set relation = namespace(value=\"\") %}\n    {% if default_schema in exception_schemas.keys() %}\n        {% for corrected_schema_name in exception_schemas.items() %}   \n            {% if default_schema in corrected_schema_name %}\n                {# In order for this macro to effectively work within upstream integration tests (mainly used by the Fivetran dbt package maintainers), this identifier variable selection is required to use the macro with different identifier names. #}\n                {% set identifier_var = corrected_schema_name[1] + \"_\" + table_identifier + \"_identifier\"  %}\n                {%- set relation.value=adapter.get_relation(\n                    database=source(corrected_schema_name[1], table_identifier).database,\n                    schema=source(corrected_schema_name[1], table_identifier).schema,\n                    identifier=var(identifier_var, table_identifier)\n                ) -%}\n            {% endif %}\n        {% endfor %}\n    {% else %}\n        {# In order for this macro to effectively work within upstream integration tests (mainly used by the Fivetran dbt package maintainers), this identifier variable selection is required to use the macro with different identifier names. #}\n        {% set identifier_var = default_schema + \"_\" + table_identifier + \"_identifier\"  %}\n        {# Unfortunately the Twitter Organic identifiers were misspelled. As such, we will need to account for this in the model. This will be adjusted in the Twitter Organic package, but to ensure backwards compatibility, this needs to be included. #}\n        {% if var(identifier_var, none) is none %} \n            {% set identifier_var = default_schema + \"_\" + table_identifier + \"_identifer\"  %}\n        {% endif %}\n        {%- set relation.value=adapter.get_relation(\n            database=source(default_schema, table_identifier).database,\n            schema=source(default_schema, table_identifier).schema,\n            identifier=var(identifier_var, table_identifier)\n        ) -%}\n    {% endif %}\n{%- set table_exists=relation.value is not none -%}\n\n{%- if table_exists -%}\n    select * \n    from {{ relation.value }}\n{%- else -%}\n    {% if execute and not var('fivetran__remove_empty_table_warnings', false) -%}\n    {{ exceptions.warn(\"\\n\\nPlease be aware: The \" ~ table_identifier|upper ~ \" table was not found in your \" ~ default_schema|upper ~ \" schema(s). The Fivetran dbt package will create a completely empty \" ~ table_identifier|upper ~ \" staging model as to not break downstream transformations. To turn off these warnings, set the `fivetran__remove_empty_table_warnings` variable to TRUE (see https://github.com/fivetran/dbt_fivetran_utils/tree/releases/v0.4.latest#union_data-source for details).\\n\") }}\n    {% endif -%}\n    select \n        cast(null as {{ dbt.type_string() }}) as _dbt_source_relation\n    limit 0\n{%- endif -%}\n{%- endif -%}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_utils.union_relations", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.0284412, "supported_languages": null}, "macro.fivetran_utils.dummy_coalesce_value": {"name": "dummy_coalesce_value", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/dummy_coalesce_value.sql", "original_file_path": "macros/dummy_coalesce_value.sql", "unique_id": "macro.fivetran_utils.dummy_coalesce_value", "macro_sql": "{% macro dummy_coalesce_value(column) %}\n\n{% set coalesce_value = {\n 'STRING': \"'DUMMY_STRING'\",\n 'BOOLEAN': 'null',\n 'INT': 999999999,\n 'FLOAT': 999999999.99,\n 'TIMESTAMP': 'cast(\"2099-12-31\" as timestamp)',\n 'DATE': 'cast(\"2099-12-31\" as date)',\n} %}\n\n{% if column.is_float() %}\n{{ return(coalesce_value['FLOAT']) }}\n\n{% elif column.is_numeric() %}\n{{ return(coalesce_value['INT']) }}\n\n{% elif column.is_string() %}\n{{ return(coalesce_value['STRING']) }}\n\n{% elif column.data_type|lower == 'boolean' %}\n{{ return(coalesce_value['BOOLEAN']) }}\n\n{% elif 'timestamp' in column.data_type|lower %}\n{{ return(coalesce_value['TIMESTAMP']) }}\n\n{% elif 'date' in column.data_type|lower %}\n{{ return(coalesce_value['DATE']) }}\n\n{% elif 'int' in column.data_type|lower %}\n{{ return(coalesce_value['INT']) }}\n\n{% endif %}\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.029981, "supported_languages": null}, "macro.fivetran_utils.wrap_in_quotes": {"name": "wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.wrap_in_quotes", "macro_sql": "{%- macro wrap_in_quotes(object_to_quote) -%}\n\n{{ return(adapter.dispatch('wrap_in_quotes', 'fivetran_utils')(object_to_quote)) }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.fivetran_utils.default__wrap_in_quotes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.030349, "supported_languages": null}, "macro.fivetran_utils.default__wrap_in_quotes": {"name": "default__wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.default__wrap_in_quotes", "macro_sql": "{%- macro default__wrap_in_quotes(object_to_quote)  -%}\n{# bigquery, spark, databricks #}\n    `{{ object_to_quote }}`\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.030474, "supported_languages": null}, "macro.fivetran_utils.snowflake__wrap_in_quotes": {"name": "snowflake__wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.snowflake__wrap_in_quotes", "macro_sql": "{%- macro snowflake__wrap_in_quotes(object_to_quote)  -%}\n    \"{{ object_to_quote | upper }}\"\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.030594, "supported_languages": null}, "macro.fivetran_utils.redshift__wrap_in_quotes": {"name": "redshift__wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.redshift__wrap_in_quotes", "macro_sql": "{%- macro redshift__wrap_in_quotes(object_to_quote)  -%}\n    \"{{ object_to_quote }}\"\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.030699, "supported_languages": null}, "macro.fivetran_utils.postgres__wrap_in_quotes": {"name": "postgres__wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.postgres__wrap_in_quotes", "macro_sql": "{%- macro postgres__wrap_in_quotes(object_to_quote)  -%}\n    \"{{ object_to_quote }}\"\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.030805, "supported_languages": null}, "macro.fivetran_utils.array_agg": {"name": "array_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "unique_id": "macro.fivetran_utils.array_agg", "macro_sql": "{% macro array_agg(field_to_agg) -%}\n\n{{ adapter.dispatch('array_agg', 'fivetran_utils') (field_to_agg) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__array_agg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.031081, "supported_languages": null}, "macro.fivetran_utils.default__array_agg": {"name": "default__array_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "unique_id": "macro.fivetran_utils.default__array_agg", "macro_sql": "{% macro default__array_agg(field_to_agg) %}\n    array_agg({{ field_to_agg }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.031191, "supported_languages": null}, "macro.fivetran_utils.redshift__array_agg": {"name": "redshift__array_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "unique_id": "macro.fivetran_utils.redshift__array_agg", "macro_sql": "{% macro redshift__array_agg(field_to_agg) %}\n    listagg({{ field_to_agg }}, ',')\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.031296, "supported_languages": null}, "macro.fivetran_utils.empty_variable_warning": {"name": "empty_variable_warning", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/empty_variable_warning.sql", "original_file_path": "macros/empty_variable_warning.sql", "unique_id": "macro.fivetran_utils.empty_variable_warning", "macro_sql": "{% macro empty_variable_warning(variable, downstream_model) %}\n\n{% if not var(variable) %}\n{{ log(\n    \"\"\"\n    Warning: You have passed an empty list to the \"\"\" ~ variable ~ \"\"\".\n    As a result, you won't see the history of any columns in the \"\"\" ~ downstream_model ~ \"\"\" model.\n    \"\"\",\n    info=True\n) }}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.031713, "supported_languages": null}, "macro.fivetran_utils.enabled_vars_one_true": {"name": "enabled_vars_one_true", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/enabled_vars_one_true.sql", "original_file_path": "macros/enabled_vars_one_true.sql", "unique_id": "macro.fivetran_utils.enabled_vars_one_true", "macro_sql": "{% macro enabled_vars_one_true(vars) %}\n\n{% for v in vars %}\n    \n    {% if var(v, False) == True %}\n    {{ return(True) }}\n    {% endif %}\n\n{% endfor %}\n\n{{ return(False) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.032126, "supported_languages": null}, "macro.fivetran_log.get_log_columns": {"name": "get_log_columns", "resource_type": "macro", "package_name": "fivetran_log", "path": "macros/get_log_columns.sql", "original_file_path": "macros/get_log_columns.sql", "unique_id": "macro.fivetran_log.get_log_columns", "macro_sql": "{% macro get_log_columns() %}\n\n{% set columns = [\n    {\"name\": \"_fivetran_synced\", \"datatype\": dbt.type_timestamp()},\n    {\"name\": \"connector_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"event\", \"datatype\": dbt.type_string()},\n    {\"name\": \"id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"message_data\", \"datatype\": dbt.type_string()},\n    {\"name\": \"message_event\", \"datatype\": dbt.type_string()},\n    {\"name\": \"sync_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"time_stamp\", \"datatype\": dbt.type_timestamp()},\n    {\"name\": \"transformation_id\", \"datatype\": dbt.type_string()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.03326, "supported_languages": null}, "macro.fivetran_log.does_table_exist": {"name": "does_table_exist", "resource_type": "macro", "package_name": "fivetran_log", "path": "macros/does_table_exist.sql", "original_file_path": "macros/does_table_exist.sql", "unique_id": "macro.fivetran_log.does_table_exist", "macro_sql": "{%- macro does_table_exist(table_name) -%}\n    {%- if execute -%} -- returns true when dbt is in execute mode\n    {%- set ns = namespace(has_table=false) -%} -- declare boolean namespace and default value \n        {%- for node in graph.sources.values() -%} -- grab sources from the dictionary of nodes \n        -- call the database for the matching table\n            {%- if node.name | lower == table_name | lower -%} \n                {%- set source_relation = adapter.get_relation(\n                        database=node.database,\n                        schema=node.schema,\n                        identifier=node.identifier ) -%} \n            {% endif %}\n            {%- if source_relation == None -%} \n                {{ return(False) }} -- return false if relation identified by the database.schema.identifier does not exist for the given table name\n            {% endif %}\n        {%- endfor -%}\n        {{ return(True) }}\n    {%- endif -%} \n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.034241, "supported_languages": null}, "macro.fivetran_log.get_connector_columns": {"name": "get_connector_columns", "resource_type": "macro", "package_name": "fivetran_log", "path": "macros/get_brand_columns.sql", "original_file_path": "macros/get_brand_columns.sql", "unique_id": "macro.fivetran_log.get_connector_columns", "macro_sql": "{% macro get_connector_columns() %}\n\n{% set columns = [\n    {\"name\": \"_fivetran_deleted\", \"datatype\": \"boolean\"},\n    {\"name\": \"_fivetran_synced\", \"datatype\": dbt.type_timestamp()},\n    {\"name\": \"connecting_user_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"connector_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"connector_name\", \"datatype\": dbt.type_string()},\n    {\"name\": \"connector_type\", \"datatype\": dbt.type_string()},\n    {\"name\": \"connector_type_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"destination_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"paused\", \"datatype\": \"boolean\"},\n    {\"name\": \"service_version\", \"datatype\": dbt.type_int()},\n    {\"name\": \"signed_up\", \"datatype\": dbt.type_timestamp()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp", "macro.dbt.type_string", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1699984808.035556, "supported_languages": null}}, "docs": {"doc.dbt.__overview__": {"name": "__overview__", "resource_type": "doc", "package_name": "dbt", "path": "overview.md", "original_file_path": "docs/overview.md", "unique_id": "doc.dbt.__overview__", "block_contents": "### Welcome!\n\nWelcome to the auto-generated documentation for your dbt project!\n\n### Navigation\n\nYou can use the `Project` and `Database` navigation tabs on the left side of the window to explore the models\nin your project.\n\n#### Project Tab\nThe `Project` tab mirrors the directory structure of your dbt project. In this tab, you can see all of the\nmodels defined in your dbt project, as well as models imported from dbt packages.\n\n#### Database Tab\nThe `Database` tab also exposes your models, but in a format that looks more like a database explorer. This view\nshows relations (tables and views) grouped into database schemas. Note that ephemeral models are _not_ shown\nin this interface, as they do not exist in the database.\n\n### Graph Exploration\nYou can click the blue icon on the bottom-right corner of the page to view the lineage graph of your models.\n\nOn model pages, you'll see the immediate parents and children of the model you're exploring. By clicking the `Expand`\nbutton at the top-right of this lineage pane, you'll be able to see all of the models that are used to build,\nor are built from, the model you're exploring.\n\nOnce expanded, you'll be able to use the `--select` and `--exclude` model selection syntax to filter the\nmodels in the graph. For more information on model selection, check out the [dbt docs](https://docs.getdbt.com/docs/model-selection-syntax).\n\nNote that you can also right-click on models to interactively filter and explore the graph.\n\n---\n\n### More information\n\n- [What is dbt](https://docs.getdbt.com/docs/introduction)?\n- Read the [dbt viewpoint](https://docs.getdbt.com/docs/viewpoint)\n- [Installation](https://docs.getdbt.com/docs/installation)\n- Join the [dbt Community](https://www.getdbt.com/community/) for questions and discussion"}}, "exposures": {}, "metrics": {}, "groups": {}, "selectors": {}, "disabled": {}, "parent_map": {"seed.fivetran_log_integration_tests.log": [], "seed.fivetran_log_integration_tests.destination_membership": [], "seed.fivetran_log_integration_tests.credits_used": [], "seed.fivetran_log_integration_tests.destination": [], "seed.fivetran_log_integration_tests.connector": [], "seed.fivetran_log_integration_tests.user": [], "seed.fivetran_log_integration_tests.account": [], "seed.fivetran_log_integration_tests.usage_cost": [], "seed.fivetran_log_integration_tests.incremental_mar": [], "model.fivetran_log.fivetran_platform__schema_changelog": ["model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.stg_fivetran_platform__log"], "model.fivetran_log.fivetran_platform__connector_daily_events": ["model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.stg_fivetran_platform__log", "source.fivetran_log.fivetran_platform.connector"], "model.fivetran_log.fivetran_platform__audit_user_activity": ["model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination", "model.fivetran_log.stg_fivetran_platform__destination_membership", "model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.stg_fivetran_platform__user"], "model.fivetran_log.fivetran_platform__connector_status": ["model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination", "model.fivetran_log.stg_fivetran_platform__log"], "model.fivetran_log.fivetran_platform__usage_mar_destination_history": ["model.fivetran_log.fivetran_platform__mar_table_history", "model.fivetran_log.stg_fivetran_platform__credits_used", "model.fivetran_log.stg_fivetran_platform__usage_cost"], "model.fivetran_log.fivetran_platform__audit_table": ["model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.stg_fivetran_platform__log"], "model.fivetran_log.fivetran_platform__mar_table_history": ["model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination", "model.fivetran_log.stg_fivetran_platform__incremental_mar"], "model.fivetran_log.stg_fivetran_platform__user": ["source.fivetran_log.fivetran_platform.user"], "model.fivetran_log.stg_fivetran_platform__destination_membership": ["source.fivetran_log.fivetran_platform.destination_membership"], "model.fivetran_log.stg_fivetran_platform__credits_used": [], "model.fivetran_log.stg_fivetran_platform__usage_cost": [], "model.fivetran_log.stg_fivetran_platform__destination": ["source.fivetran_log.fivetran_platform.destination"], "model.fivetran_log.stg_fivetran_platform__log": ["model.fivetran_log.stg_fivetran_platform__log_tmp"], "model.fivetran_log.stg_fivetran_platform__incremental_mar": ["source.fivetran_log.fivetran_platform.incremental_mar"], "model.fivetran_log.stg_fivetran_platform__connector": ["model.fivetran_log.stg_fivetran_platform__connector_tmp"], "model.fivetran_log.stg_fivetran_platform__account": ["source.fivetran_log.fivetran_platform.account"], "model.fivetran_log.stg_fivetran_platform__connector_tmp": ["source.fivetran_log.fivetran_platform.connector"], "model.fivetran_log.stg_fivetran_platform__log_tmp": ["source.fivetran_log.fivetran_platform.log"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89": ["model.fivetran_log.fivetran_platform__connector_status"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441": ["model.fivetran_log.fivetran_platform__mar_table_history"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f": ["model.fivetran_log.fivetran_platform__connector_daily_events"], "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7": ["model.fivetran_log.fivetran_platform__audit_table"], "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af": ["model.fivetran_log.fivetran_platform__audit_table"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493": ["model.fivetran_log.fivetran_platform__schema_changelog"], "test.fivetran_log.unique_fivetran_platform__audit_user_activity_log_id.2662c08a2a": ["model.fivetran_log.fivetran_platform__audit_user_activity"], "test.fivetran_log.not_null_fivetran_platform__audit_user_activity_log_id.db973498ba": ["model.fivetran_log.fivetran_platform__audit_user_activity"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a": ["model.fivetran_log.stg_fivetran_platform__connector"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38": ["model.fivetran_log.stg_fivetran_platform__credits_used"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f": ["model.fivetran_log.stg_fivetran_platform__usage_cost"], "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed": ["model.fivetran_log.stg_fivetran_platform__destination"], "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780": ["model.fivetran_log.stg_fivetran_platform__destination"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d": ["model.fivetran_log.stg_fivetran_platform__log"], "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc": ["model.fivetran_log.stg_fivetran_platform__account"], "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e": ["model.fivetran_log.stg_fivetran_platform__account"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a": ["model.fivetran_log.stg_fivetran_platform__destination_membership"], "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9": ["model.fivetran_log.stg_fivetran_platform__user"], "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0": ["model.fivetran_log.stg_fivetran_platform__user"], "source.fivetran_log.fivetran_platform.incremental_mar": [], "source.fivetran_log.fivetran_platform.connector": [], "source.fivetran_log.fivetran_platform.credits_used": [], "source.fivetran_log.fivetran_platform.usage_cost": [], "source.fivetran_log.fivetran_platform.destination": [], "source.fivetran_log.fivetran_platform.log": [], "source.fivetran_log.fivetran_platform.account": [], "source.fivetran_log.fivetran_platform.destination_membership": [], "source.fivetran_log.fivetran_platform.user": []}, "child_map": {"seed.fivetran_log_integration_tests.log": [], "seed.fivetran_log_integration_tests.destination_membership": [], "seed.fivetran_log_integration_tests.credits_used": [], "seed.fivetran_log_integration_tests.destination": [], "seed.fivetran_log_integration_tests.connector": [], "seed.fivetran_log_integration_tests.user": [], "seed.fivetran_log_integration_tests.account": [], "seed.fivetran_log_integration_tests.usage_cost": [], "seed.fivetran_log_integration_tests.incremental_mar": [], "model.fivetran_log.fivetran_platform__schema_changelog": ["test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493"], "model.fivetran_log.fivetran_platform__connector_daily_events": ["test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f"], "model.fivetran_log.fivetran_platform__audit_user_activity": ["test.fivetran_log.not_null_fivetran_platform__audit_user_activity_log_id.db973498ba", "test.fivetran_log.unique_fivetran_platform__audit_user_activity_log_id.2662c08a2a"], "model.fivetran_log.fivetran_platform__connector_status": ["model.fivetran_log.fivetran_platform__audit_table", "model.fivetran_log.fivetran_platform__connector_daily_events", "model.fivetran_log.fivetran_platform__schema_changelog", "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89"], "model.fivetran_log.fivetran_platform__usage_mar_destination_history": ["test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd"], "model.fivetran_log.fivetran_platform__audit_table": ["test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af", "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7"], "model.fivetran_log.fivetran_platform__mar_table_history": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history", "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441"], "model.fivetran_log.stg_fivetran_platform__user": ["model.fivetran_log.fivetran_platform__audit_user_activity", "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0", "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9"], "model.fivetran_log.stg_fivetran_platform__destination_membership": ["model.fivetran_log.fivetran_platform__audit_user_activity", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a"], "model.fivetran_log.stg_fivetran_platform__credits_used": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38"], "model.fivetran_log.stg_fivetran_platform__usage_cost": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f"], "model.fivetran_log.stg_fivetran_platform__destination": ["model.fivetran_log.fivetran_platform__audit_user_activity", "model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.fivetran_platform__mar_table_history", "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780", "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed"], "model.fivetran_log.stg_fivetran_platform__log": ["model.fivetran_log.fivetran_platform__audit_table", "model.fivetran_log.fivetran_platform__audit_user_activity", "model.fivetran_log.fivetran_platform__connector_daily_events", "model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.fivetran_platform__schema_changelog", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d"], "model.fivetran_log.stg_fivetran_platform__incremental_mar": ["model.fivetran_log.fivetran_platform__mar_table_history"], "model.fivetran_log.stg_fivetran_platform__connector": ["model.fivetran_log.fivetran_platform__audit_user_activity", "model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.fivetran_platform__mar_table_history", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a"], "model.fivetran_log.stg_fivetran_platform__account": ["test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e", "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc"], "model.fivetran_log.stg_fivetran_platform__connector_tmp": ["model.fivetran_log.stg_fivetran_platform__connector"], "model.fivetran_log.stg_fivetran_platform__log_tmp": ["model.fivetran_log.stg_fivetran_platform__log"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f": [], "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7": [], "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493": [], "test.fivetran_log.unique_fivetran_platform__audit_user_activity_log_id.2662c08a2a": [], "test.fivetran_log.not_null_fivetran_platform__audit_user_activity_log_id.db973498ba": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f": [], "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed": [], "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d": [], "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc": [], "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a": [], "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9": [], "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0": [], "source.fivetran_log.fivetran_platform.incremental_mar": ["model.fivetran_log.stg_fivetran_platform__incremental_mar"], "source.fivetran_log.fivetran_platform.connector": ["model.fivetran_log.fivetran_platform__connector_daily_events", "model.fivetran_log.stg_fivetran_platform__connector_tmp"], "source.fivetran_log.fivetran_platform.credits_used": [], "source.fivetran_log.fivetran_platform.usage_cost": [], "source.fivetran_log.fivetran_platform.destination": ["model.fivetran_log.stg_fivetran_platform__destination"], "source.fivetran_log.fivetran_platform.log": ["model.fivetran_log.stg_fivetran_platform__log_tmp"], "source.fivetran_log.fivetran_platform.account": ["model.fivetran_log.stg_fivetran_platform__account"], "source.fivetran_log.fivetran_platform.destination_membership": ["model.fivetran_log.stg_fivetran_platform__destination_membership"], "source.fivetran_log.fivetran_platform.user": ["model.fivetran_log.stg_fivetran_platform__user"]}, "group_map": {}, "saved_queries": {}, "semantic_models": {}}
\ No newline at end of file
+{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v11.json", "dbt_version": "1.7.3", "generated_at": "2023-12-12T19:08:28.222381Z", "invocation_id": "c0fa594b-cab7-478a-aeb0-a325788070ef", "env": {}, "project_name": "fivetran_log_integration_tests", "project_id": "601c934d3c286a01c58ed00bc69f8e64", "user_id": "2bfa9082-ea6e-467b-abdc-d0514ab111d9", "send_anonymous_usage_stats": true, "adapter_type": "snowflake"}, "nodes": {"seed.fivetran_log_integration_tests.log": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "log", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "log.csv", "original_file_path": "seeds/log.csv", "unique_id": "seed.fivetran_log_integration_tests.log", "fqn": ["fivetran_log_integration_tests", "log"], "alias": "log", "checksum": {"name": "sha256", "checksum": "3637d563f8916ee1a902edb08e4cd17c35bb975b7b6ca34093b553853e58edcc"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "time_stamp": "timestamp", "transformation_id": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"time_stamp": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}", "transformation_id": "{{ 'string' if target.type in ('bigquery', 'spark', 'databricks') else 'varchar' if target.type != 'sqlserver' else 'varchar(256)' }}"}}, "created_at": 1702408015.7380102, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.log", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.destination_membership": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "destination_membership", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "destination_membership.csv", "original_file_path": "seeds/destination_membership.csv", "unique_id": "seed.fivetran_log_integration_tests.destination_membership", "fqn": ["fivetran_log_integration_tests", "destination_membership"], "alias": "destination_membership", "checksum": {"name": "sha256", "checksum": "ea1c1b6a3929e8d4de990970c8cc497af21e2a5e12c1623be69462c22a3b0e1a"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "activated_at": "timestamp", "joined_at": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"activated_at": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}", "joined_at": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"}}, "created_at": 1702408015.7467039, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.destination_membership", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.credits_used": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "credits_used", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "credits_used.csv", "original_file_path": "seeds/credits_used.csv", "unique_id": "seed.fivetran_log_integration_tests.credits_used", "fqn": ["fivetran_log_integration_tests", "credits_used"], "alias": "credits_used", "checksum": {"name": "sha256", "checksum": "b6954f4070acaf5073fc4c4001c3ab8ebc254e0ddbe2226ba063e0cbc3001d7f"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "credits_consumed": "bigint"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"credits_consumed": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"}}, "created_at": 1702408015.748297, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.credits_used", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.destination": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "destination", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "destination.csv", "original_file_path": "seeds/destination.csv", "unique_id": "seed.fivetran_log_integration_tests.destination", "fqn": ["fivetran_log_integration_tests", "destination"], "alias": "destination", "checksum": {"name": "sha256", "checksum": "0f6955f215269c7d8754298fb9485f3196765564fccf9a138cf02a8ccb160ab3"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "created_at": "timestamp", "id": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"created_at": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}", "id": "{{ 'string' if target.type in ('bigquery', 'spark', 'databricks') else 'varchar' if target.type != 'sqlserver' else 'varchar(256)' }}"}}, "created_at": 1702408015.749771, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.destination", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.connector": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "connector", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "connector.csv", "original_file_path": "seeds/connector.csv", "unique_id": "seed.fivetran_log_integration_tests.connector", "fqn": ["fivetran_log_integration_tests", "connector"], "alias": "connector", "checksum": {"name": "sha256", "checksum": "8b9be1f60c7b2e33da88c97eb66a3241cb6fffad4af3e7e32c355f8f27c0c34c"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "signed_up": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"signed_up": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"}}, "created_at": 1702408015.7512288, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.connector", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.user": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "user", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "user.csv", "original_file_path": "seeds/user.csv", "unique_id": "seed.fivetran_log_integration_tests.user", "fqn": ["fivetran_log_integration_tests", "user"], "alias": "user", "checksum": {"name": "sha256", "checksum": "ce690544aed43600d42695a8fdf5e1fa14c342c04b22cadcbdb0934a0cf92a0e"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "created_at": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"created_at": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"}}, "created_at": 1702408015.752674, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.user", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.account": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "account", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "account.csv", "original_file_path": "seeds/account.csv", "unique_id": "seed.fivetran_log_integration_tests.account", "fqn": ["fivetran_log_integration_tests", "account"], "alias": "account", "checksum": {"name": "sha256", "checksum": "ec33e80835ab8169b97dd17dd2699f84862f798de4c2d0a90c8d261a111d3495"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "created_at": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"created_at": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"}}, "created_at": 1702408015.754123, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.account", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.usage_cost": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "usage_cost", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "usage_cost.csv", "original_file_path": "seeds/usage_cost.csv", "unique_id": "seed.fivetran_log_integration_tests.usage_cost", "fqn": ["fivetran_log_integration_tests", "usage_cost"], "alias": "usage_cost", "checksum": {"name": "sha256", "checksum": "3cbe3dadc6ca6dd2383cd5172fe2688bccf65af0b6bc30a7583c85aa41185a58"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"_fivetran_synced": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"}}, "created_at": 1702408015.755662, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.usage_cost", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.incremental_mar": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "incremental_mar", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "incremental_mar.csv", "original_file_path": "seeds/incremental_mar.csv", "unique_id": "seed.fivetran_log_integration_tests.incremental_mar", "fqn": ["fivetran_log_integration_tests", "incremental_mar"], "alias": "incremental_mar", "checksum": {"name": "sha256", "checksum": "e567d62bbb002d465ce48fea541f7d075cd7ceb5c82f439f4a9d4e715bd13018"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "measured_date": "timestamp", "incremental_rows": "bigint"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"measured_date": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}", "incremental_rows": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"}}, "created_at": 1702408015.757069, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.incremental_mar", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "model.fivetran_log.fivetran_platform__schema_changelog": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__schema_changelog", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__schema_changelog.sql", "original_file_path": "models/fivetran_platform__schema_changelog.sql", "unique_id": "model.fivetran_log.fivetran_platform__schema_changelog", "fqn": ["fivetran_log", "fivetran_platform__schema_changelog"], "alias": "fivetran_platform__schema_changelog", "checksum": {"name": "sha256", "checksum": "cdd229f1dc2246a7a1b6f89528d31a71868318f4d34ff7984fe6cca7cb8f63fd"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table capturing information around each kind of schema change made to a connector. Schema changes include altering and creating tables, changing the schema configuration, and creating schemas. \n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector whose schema was changed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination that the table is being written to.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the schema was changed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_subtype": {"name": "event_subtype", "description": "Type of schema change event. One of 'alter_table', 'create_table', 'change_schema_config', 'create_schema'.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_data": {"name": "message_data", "description": "The details of the event in JSON format.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Name of the table, if a table is being altered or created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "Name of the schema, if a schema or table is being created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.086418, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__schema_changelog", "raw_code": "with schema_changes as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__log') }}\n\n    where event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n),\n\nconnector as (\n\n    select *\n    from {{ ref('fivetran_platform__connector_status') }}\n),\n\nadd_connector_info as (\n\n    select \n        schema_changes.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n\n    from schema_changes join connector \n        on schema_changes.connector_id = connector.connector_id\n),\n\nfinal as (\n\n    select\n        connector_id,\n        connector_name,\n        destination_id,\n        destination_name,\n        created_at,\n        event_subtype,\n        message_data,\n\n        case \n        when event_subtype = 'alter_table' then {{ fivetran_utils.json_parse(string='message_data', string_path=['table']) }} \n        when event_subtype = 'create_table' then {{ fivetran_utils.json_parse(string='message_data', string_path=['name']) }} \n        else null end as table_name,\n\n        case \n        when event_subtype = 'create_schema' or event_subtype = 'create_table' then {{ fivetran_utils.json_parse(string='message_data', string_path=['schema']) }} \n        else null end as schema_name\n    \n    from add_connector_info\n)\n\nselect * from final\n{% if target.type != 'sqlserver' %}\norder by created_at desc, connector_id\n{% endif %}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "fivetran_platform__connector_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_utils.json_parse"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.fivetran_platform__connector_status"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__schema_changelog.sql", "compiled": true, "compiled_code": "with schema_changes as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n\n    where event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n),\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status\n),\n\nadd_connector_info as (\n\n    select \n        schema_changes.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n\n    from schema_changes join connector \n        on schema_changes.connector_id = connector.connector_id\n),\n\nfinal as (\n\n    select\n        connector_id,\n        connector_name,\n        destination_id,\n        destination_name,\n        created_at,\n        event_subtype,\n        message_data,\n\n        case \n        when event_subtype = 'alter_table' then \n\n  parse_json( message_data )['table'] \n        when event_subtype = 'create_table' then \n\n  parse_json( message_data )['name'] \n        else null end as table_name,\n\n        case \n        when event_subtype = 'create_schema' or event_subtype = 'create_table' then \n\n  parse_json( message_data )['schema'] \n        else null end as schema_name\n    \n    from add_connector_info\n)\n\nselect * from final\n\norder by created_at desc, connector_id\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__connector_daily_events": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__connector_daily_events", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__connector_daily_events.sql", "original_file_path": "models/fivetran_platform__connector_daily_events.sql", "unique_id": "model.fivetran_log.fivetran_platform__connector_daily_events", "fqn": ["fivetran_log", "fivetran_platform__connector_daily_events"], "alias": "fivetran_platform__connector_daily_events", "checksum": {"name": "sha256", "checksum": "9a9535f338aef0d59fecd2804044c9a51e376ea6dd7f59e33a8ebcdb1e710375"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of each connector's daily history of the quantity of api calls, schema changes, and records modified, starting at the connector's setup date. \n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination loading data from this connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "date_day": {"name": "date_day", "description": "Date on which the number of api calls for the connector is measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "count_api_calls": {"name": "count_api_calls", "description": "The number of api call events logged for this connector on this day.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "count_record_modifications": {"name": "count_record_modifications", "description": "The sum of all records modified (includes updates, inserts, and deletes).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "count_schema_changes": {"name": "count_schema_changes", "description": "The number of schema change events for this connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.0837162, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_daily_events", "raw_code": "-- depends_on: {{ var('connector') }}\n\nwith connector as (\n    \n    select * \n    from {{ ref('fivetran_platform__connector_status') }}\n),\n\n-- grab api calls, schema changes, and record modifications\nlog_events as (\n\n    select \n        connector_id,\n        cast( {{ dbt.date_trunc('day', 'created_at') }} as date) as date_day,\n        case \n            when event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config') then 'schema_change' \n            else event_subtype end as event_subtype,\n\n        sum(case when event_subtype = 'records_modified' then cast( {{ fivetran_utils.json_parse(string='message_data', string_path=['count']) }} as {{ dbt.type_int()}} )\n        else 1 end) as count_events \n\n    from {{ ref('stg_fivetran_platform__log') }}\n\n    where event_subtype in ('api_call', \n                            'records_modified', \n                            'create_table', 'alter_table', 'create_schema', 'change_schema_config') -- all schema changes\n                            \n        and connector_id is not null\n\n    group by connector_id, cast( {{ dbt.date_trunc('day', 'created_at') }} as date), event_subtype\n),\n\npivot_out_events as (\n\n    select\n        connector_id,\n        date_day,\n        max(case when event_subtype = 'api_call' then count_events else 0 end) as count_api_calls,\n        max(case when event_subtype = 'records_modified' then count_events else 0 end) as count_record_modifications,\n        max(case when event_subtype = 'schema_change' then count_events else 0 end) as count_schema_changes\n\n    from log_events\n    group by connector_id, date_day\n), \n\nconnector_event_counts as (\n\n    select\n        pivot_out_events.date_day,\n        pivot_out_events.count_api_calls,\n        pivot_out_events.count_record_modifications,\n        pivot_out_events.count_schema_changes,\n        connector.connector_name,\n        connector.connector_id,\n        connector.connector_type,\n        connector.destination_name,\n        connector.destination_id,\n        connector.set_up_at\n    from\n    connector left join pivot_out_events \n        on pivot_out_events.connector_id = connector.connector_id\n),\n\nspine as (\n\n    {% if execute %}\n    {% set first_date_query %}\n        select  min( signed_up ) as min_date from {{ var('connector') }}\n    {% endset %}\n    {% set first_date = run_query(first_date_query).columns[0][0]|string %}\n    \n    {% else %} {% set first_date = \"2016-01-01\" %}\n    {% endif %}\n\n    select cast(date_day as date) as date_day\n    from (\n        {{ fivetran_utils.fivetran_date_spine(\n            datepart = \"day\", \n            start_date =  \"cast('\" ~ first_date[0:10] ~ \"' as date)\", \n            end_date = dbt.dateadd(\"week\", 1, dbt.date_trunc('day', dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp())) \n            ) \n        }} \n    ) as date_spine\n),\n\nconnector_event_history as (\n\n    select\n        spine.date_day,\n        connector_event_counts.connector_name,\n        connector_event_counts.connector_id,\n        connector_event_counts.connector_type,\n        connector_event_counts.destination_name,\n        connector_event_counts.destination_id,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_api_calls\n            else 0\n        end) as count_api_calls,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_record_modifications\n            else 0\n        end) as count_record_modifications,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_schema_changes\n            else 0\n        end) as count_schema_changes\n    from\n    spine join connector_event_counts\n        on spine.date_day  >= cast({{ dbt.date_trunc('day', 'cast(connector_event_counts.set_up_at as date)') }} as date)\n\n    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id\n),\n\n-- now rejoin spine to get a complete calendar\njoin_event_history as (\n    \n    select\n        spine.date_day,\n        connector_event_history.connector_name,\n        connector_event_history.connector_id,\n        connector_event_history.connector_type,\n        connector_event_history.destination_name,\n        connector_event_history.destination_id,\n        max(connector_event_history.count_api_calls) as count_api_calls,\n        max(connector_event_history.count_record_modifications) as count_record_modifications,\n        max(connector_event_history.count_schema_changes) as count_schema_changes\n\n    from\n    spine left join connector_event_history\n        on spine.date_day = connector_event_history.date_day\n\n    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id\n),\n\nfinal as (\n\n    select *\n    from join_event_history\n\n    where date_day <= cast({{ dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp() }} as date)\n\n    {% if target.type != 'sqlserver' %} -- sql server cant order CTEs\n    order by date_day desc\n    {% endif %}\n)\n\nselect *\nfrom final", "language": "sql", "refs": [{"name": "fivetran_platform__connector_status", "package": null, "version": null}, {"name": "stg_fivetran_platform__log", "package": null, "version": null}], "sources": [["fivetran_platform", "connector"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.fivetran_utils.json_parse", "macro.dbt.type_int", "macro.dbt.current_timestamp_backcompat", "macro.dbt.dateadd", "macro.fivetran_utils.fivetran_date_spine", "macro.dbt.run_query"], "nodes": ["source.fivetran_log.fivetran_platform.connector", "model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.stg_fivetran_platform__log"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__connector_daily_events.sql", "compiled": true, "compiled_code": "-- depends_on: DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.connector\n\nwith connector as (\n    \n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status\n),\n\n-- grab api calls, schema changes, and record modifications\nlog_events as (\n\n    select \n        connector_id,\n        cast( date_trunc('day', created_at) as date) as date_day,\n        case \n            when event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config') then 'schema_change' \n            else event_subtype end as event_subtype,\n\n        sum(case when event_subtype = 'records_modified' then cast( \n\n  parse_json( message_data )['count'] as integer )\n        else 1 end) as count_events \n\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n\n    where event_subtype in ('api_call', \n                            'records_modified', \n                            'create_table', 'alter_table', 'create_schema', 'change_schema_config') -- all schema changes\n                            \n        and connector_id is not null\n\n    group by connector_id, cast( date_trunc('day', created_at) as date), event_subtype\n),\n\npivot_out_events as (\n\n    select\n        connector_id,\n        date_day,\n        max(case when event_subtype = 'api_call' then count_events else 0 end) as count_api_calls,\n        max(case when event_subtype = 'records_modified' then count_events else 0 end) as count_record_modifications,\n        max(case when event_subtype = 'schema_change' then count_events else 0 end) as count_schema_changes\n\n    from log_events\n    group by connector_id, date_day\n), \n\nconnector_event_counts as (\n\n    select\n        pivot_out_events.date_day,\n        pivot_out_events.count_api_calls,\n        pivot_out_events.count_record_modifications,\n        pivot_out_events.count_schema_changes,\n        connector.connector_name,\n        connector.connector_id,\n        connector.connector_type,\n        connector.destination_name,\n        connector.destination_id,\n        connector.set_up_at\n    from\n    connector left join pivot_out_events \n        on pivot_out_events.connector_id = connector.connector_id\n),\n\nspine as (\n\n    \n    \n    \n    \n    \n\n    select cast(date_day as date) as date_day\n    from (\n        \n\n    \n\n\n\n\n\nwith rawdata as (\n\n    \n\n    \n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    \n    p0.generated_number * power(2, 0)\n     + \n    \n    p1.generated_number * power(2, 1)\n     + \n    \n    p2.generated_number * power(2, 2)\n     + \n    \n    p3.generated_number * power(2, 3)\n     + \n    \n    p4.generated_number * power(2, 4)\n     + \n    \n    p5.generated_number * power(2, 5)\n     + \n    \n    p6.generated_number * power(2, 6)\n     + \n    \n    p7.generated_number * power(2, 7)\n     + \n    \n    p8.generated_number * power(2, 8)\n     + \n    \n    p9.generated_number * power(2, 9)\n     + \n    \n    p10.generated_number * power(2, 10)\n    \n    \n    + 1\n    as generated_number\n\n    from\n\n    \n    p as p0\n     cross join \n    \n    p as p1\n     cross join \n    \n    p as p2\n     cross join \n    \n    p as p3\n     cross join \n    \n    p as p4\n     cross join \n    \n    p as p5\n     cross join \n    \n    p as p6\n     cross join \n    \n    p as p7\n     cross join \n    \n    p as p8\n     cross join \n    \n    p as p9\n     cross join \n    \n    p as p10\n    \n    \n\n    )\n\n    select *\n    from unioned\n    where generated_number <= 1733\n    order by generated_number\n\n\n\n),\n\nall_periods as (\n\n    select (\n        \n\n    dateadd(\n        day,\n        row_number() over (order by 1) - 1,\n        cast('2019-03-22' as date)\n        )\n\n\n    ) as date_day\n    from rawdata\n\n),\n\nfiltered as (\n\n    select *\n    from all_periods\n    where date_day <= \n\n    dateadd(\n        week,\n        1,\n        date_trunc('day', \n  current_timestamp::timestamp\n)\n        )\n\n\n\n)\n\nselect * from filtered\n\n\n        \n \n    ) as date_spine\n),\n\nconnector_event_history as (\n\n    select\n        spine.date_day,\n        connector_event_counts.connector_name,\n        connector_event_counts.connector_id,\n        connector_event_counts.connector_type,\n        connector_event_counts.destination_name,\n        connector_event_counts.destination_id,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_api_calls\n            else 0\n        end) as count_api_calls,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_record_modifications\n            else 0\n        end) as count_record_modifications,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_schema_changes\n            else 0\n        end) as count_schema_changes\n    from\n    spine join connector_event_counts\n        on spine.date_day  >= cast(date_trunc('day', cast(connector_event_counts.set_up_at as date)) as date)\n\n    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id\n),\n\n-- now rejoin spine to get a complete calendar\njoin_event_history as (\n    \n    select\n        spine.date_day,\n        connector_event_history.connector_name,\n        connector_event_history.connector_id,\n        connector_event_history.connector_type,\n        connector_event_history.destination_name,\n        connector_event_history.destination_id,\n        max(connector_event_history.count_api_calls) as count_api_calls,\n        max(connector_event_history.count_record_modifications) as count_record_modifications,\n        max(connector_event_history.count_schema_changes) as count_schema_changes\n\n    from\n    spine left join connector_event_history\n        on spine.date_day = connector_event_history.date_day\n\n    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id\n),\n\nfinal as (\n\n    select *\n    from join_event_history\n\n    where date_day <= cast(\n  current_timestamp::timestamp\n as date)\n\n     -- sql server cant order CTEs\n    order by date_day desc\n    \n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__audit_user_activity": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__audit_user_activity", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__audit_user_activity.sql", "original_file_path": "models/fivetran_platform__audit_user_activity.sql", "unique_id": "model.fivetran_log.fivetran_platform__audit_user_activity", "fqn": ["fivetran_log", "fivetran_platform__audit_user_activity"], "alias": "fivetran_platform__audit_user_activity", "checksum": {"name": "sha256", "checksum": "bb023dcde9b2d6ba20219f1818540bf5539108c0a826c87f6b281b853a34b3cf"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Each record represents a user-triggered action in your Fivetran instance.This model is intended for audit-trail purposes, as it can be very helpful when trying to trace a user action to a [log event](https://fivetran.com/docs/logs#logeventlist) such as a schema change, sync frequency update,  manual update, broken connection, etc.\n", "columns": {"date_day": {"name": "date_day", "description": "Date on which the user action occurred.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "day_name": {"name": "day_name", "description": "Abbreviated weekday name of the date on which this user action occurred (e.g. Mon, Tues, Wed)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "day_of_month": {"name": "day_of_month", "description": "Day of the month on which this user action occurred (e.g. 2022-03-06 --> 6).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "occurred_at": {"name": "occurred_at", "description": "Timestamp of when the event was logged.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "UI-facing name of the destination on which the user action was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` on which the user action was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector that the user acted upon.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "Foreign key referencing the `connector` that the user acted upon.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "Account email of the user who triggered the action.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "Given name of the user who triggered the action.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "Surname of the user who triggered the action.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "Foreign key referencing the `user` who triggered the action.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_role": {"name": "destination_role", "description": "The acting user's permissions for this individual destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_type": {"name": "event_type", "description": "The umbrella event type. Events can be classified as a warning, an error, or just an information log. Typically = 'INFO' for user-triggered actions.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_subtype": {"name": "event_subtype", "description": "The routine involved in the log event, defined [here](https://fivetran.com/docs/logs#logevents).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_data": {"name": "message_data", "description": "The details of the event in JSON format.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "log_id": {"name": "log_id", "description": "Unique ID of the log record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.0883992, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_user_activity", "raw_code": "with logs as (\n\n    select \n        *,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['actor']) }} as actor_email\n    from {{ ref('stg_fivetran_platform__log') }}\n),\n\nuser_logs as (\n\n    select *\n    from logs\n    where actor_email is not null \n        and lower(actor_email) != 'fivetran'\n),\n\nconnector as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__connector') }}\n),\n\ndestination as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__destination') }}\n),\n\n{%- if var('fivetran_platform_using_user', true) %}\nusers as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__user') }}\n),\n\n    {%- if var('fivetran_platform_using_destination_membership', true) %}\n    destination_membership as (\n\n        select *\n        from {{ ref('stg_fivetran_platform__destination_membership') }}\n    ),\n    {% endif -%}\n\n{% endif -%}\n\nfinal as (\n\n    select\n        {{ dbt.date_trunc('day', 'user_logs.created_at') }} as date_day,\n        \n        {% if target.type != 'sqlserver' -%}\n            {{ dbt_date.day_name('user_logs.created_at') }} as day_name,\n            {{ dbt_date.day_of_month('user_logs.created_at') }} as day_of_month,\n        {% else -%} \n            format(cast(user_logs.created_at as date), 'ddd') as day_name,\n            day(user_logs.created_at) as day_of_month,\n        {% endif -%} \n        \n        user_logs.created_at as occurred_at,\n        destination.destination_name,\n        destination.destination_id,\n        connector.connector_name,\n        connector.connector_id,\n        user_logs.actor_email as email,\n{%- if var('fivetran_platform_using_user', true) %}\n        users.first_name,\n        users.last_name,\n        users.user_id,\n    {%- if var('fivetran_platform_using_destination_membership', true) %}\n        destination_membership.destination_role,\n    {% endif -%}\n{% endif -%}\n\n        user_logs.event_type, -- should always be INFO for user-triggered actions but include just in case\n        user_logs.event_subtype,\n        user_logs.message_data,\n        user_logs.log_id\n\n    from user_logs\n    left join connector\n        on user_logs.connector_id = connector.connector_id\n    left join destination\n        on connector.destination_id = destination.destination_id\n\n{%- if var('fivetran_platform_using_user', true) %}\n    left join users \n        on lower(users.email) = lower(user_logs.actor_email)\n\n    {%- if var('fivetran_platform_using_destination_membership', true) %}\n    left join destination_membership\n        on destination.destination_id = destination_membership.destination_id\n        and users.user_id = destination_membership.user_id\n\n    {% endif -%}\n{% endif -%}\n\n)\n\nselect *\nfrom final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "stg_fivetran_platform__connector", "package": null, "version": null}, {"name": "stg_fivetran_platform__destination", "package": null, "version": null}, {"name": "stg_fivetran_platform__user", "package": null, "version": null}, {"name": "stg_fivetran_platform__destination_membership", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_utils.json_parse", "macro.dbt.date_trunc", "macro.dbt_date.day_name", "macro.dbt_date.day_of_month"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination", "model.fivetran_log.stg_fivetran_platform__user", "model.fivetran_log.stg_fivetran_platform__destination_membership"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__audit_user_activity.sql", "compiled": true, "compiled_code": "with logs as (\n\n    select \n        *,\n        \n\n  parse_json( message_data )['actor'] as actor_email\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n),\n\nuser_logs as (\n\n    select *\n    from logs\n    where actor_email is not null \n        and lower(actor_email) != 'fivetran'\n),\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector\n),\n\ndestination as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\n),\nusers as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__user\n),\n    destination_membership as (\n\n        select *\n        from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination_membership\n    ),\n    final as (\n\n    select\n        date_trunc('day', user_logs.created_at) as date_day,\n        \n        dayname(user_logs.created_at) as day_name,\n            date_part('day', user_logs.created_at) as day_of_month,\n        user_logs.created_at as occurred_at,\n        destination.destination_name,\n        destination.destination_id,\n        connector.connector_name,\n        connector.connector_id,\n        user_logs.actor_email as email,\n        users.first_name,\n        users.last_name,\n        users.user_id,\n        destination_membership.destination_role,\n    user_logs.event_type, -- should always be INFO for user-triggered actions but include just in case\n        user_logs.event_subtype,\n        user_logs.message_data,\n        user_logs.log_id\n\n    from user_logs\n    left join connector\n        on user_logs.connector_id = connector.connector_id\n    left join destination\n        on connector.destination_id = destination.destination_id\n    left join users \n        on lower(users.email) = lower(user_logs.actor_email)\n    left join destination_membership\n        on destination.destination_id = destination_membership.destination_id\n        and users.user_id = destination_membership.user_id\n\n    )\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__connector_status": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__connector_status", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__connector_status.sql", "original_file_path": "models/fivetran_platform__connector_status.sql", "unique_id": "model.fivetran_log.fivetran_platform__connector_status", "fqn": ["fivetran_log", "fivetran_platform__connector_status"], "alias": "fivetran_platform__connector_status", "checksum": {"name": "sha256", "checksum": "0f06065d380f8db0d7e71883967d2769783e211b4f20a90ccb6dcbb0bef41190"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of each destination's connector and details surrounding its  connection and data-sync status.\n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination loading data from this connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_health": {"name": "connector_health", "description": "Status of the connector's data flow. Can be `\"broken\"`, `\"incomplete\"`, `\"connected\"`, `\"paused\"`, `\"initial sync in progress\"`, or `\"priority first sync\"`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_successful_sync_completed_at": {"name": "last_successful_sync_completed_at", "description": "Timestamp of when the last sync attempt was completed. This could be either a failure or a successful sync.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_sync_started_at": {"name": "last_sync_started_at", "description": "Timestamp of when the last sync was started. Note that if new data comes in after a sync has  begun, the new data will not be included in this sync.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_sync_completed_at": {"name": "last_sync_completed_at", "description": "Timestamp of when the last sync was completed.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "set_up_at": {"name": "set_up_at", "description": "Timestamp of when the connector was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "number_of_schema_changes_last_month": {"name": "number_of_schema_changes_last_month", "description": "The number of schema changes (creating tables or schemas and altering tables) in the past 30 days.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "errors_since_last_completed_sync": {"name": "errors_since_last_completed_sync", "description": "Aggregated line-separated list of error messages (in JSON format) raised synce the last  sync completion. \n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "warnings_since_last_completed_sync": {"name": "warnings_since_last_completed_sync", "description": "Aggregated line-separated list of warning messages (in JSON format) raised synce the last  sync completion. \n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.079627, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status", "raw_code": "with transformation_removal as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__log') }}\n    where transformation_id is null\n\n),\n\nconnector_log as (\n    select \n        *,\n        sum( case when event_subtype in ('sync_start') then 1 else 0 end) over ( partition by connector_id \n            order by created_at rows unbounded preceding) as sync_batch_id\n    from transformation_removal\n    -- only looking at errors, warnings, and syncs here\n    where event_type = 'SEVERE'\n        or event_type = 'WARNING'\n        or event_subtype like 'sync%'\n        or (event_subtype = 'status' \n            and {{ fivetran_utils.json_parse(string=\"message_data\", string_path=[\"status\"]) }} = 'RESCHEDULED'\n            \n            and {{ fivetran_utils.json_parse(string=\"message_data\", string_path=[\"reason\"]) }} like '%intended behavior%'\n            ) -- for priority-first syncs. these should be captured by event_type = 'WARNING' but let's make sure\n        or (event_subtype = 'status' \n            and {{ fivetran_utils.json_parse(string=\"message_data\", string_path=[\"status\"]) }} = 'SUCCESSFUL'\n        )\n        -- whole reason is \"We have rescheduled the connector to force flush data from the forward sync into your destination. This is intended behavior and means that the connector is working as expected.\"\n),\n\nschema_changes as (\n\n    select\n        connector_id,\n        count(*) as number_of_schema_changes_last_month\n\n    from {{ ref('stg_fivetran_platform__log') }}\n\n    where \n        {{ dbt.datediff('created_at', dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp(), 'day') }} <= 30\n        and event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n\n    group by connector_id\n\n),\n\nconnector as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__connector') }}\n\n),\n\ndestination as (\n\n    select * \n    from {{ ref('stg_fivetran_platform__destination') }}\n),\n\nconnector_metrics as (\n\n    select\n        connector.connector_id,\n        connector.connector_name,\n        connector.connector_type,\n        connector.destination_id,\n        connector.is_paused,\n        connector.set_up_at,\n        max(case when connector_log.event_subtype = 'sync_start' then connector_log.created_at else null end) as last_sync_started_at,\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.created_at else null end) as last_sync_completed_at,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"status\"]) }} ='SUCCESSFUL'\n            then connector_log.created_at else null end) as last_successful_sync_completed_at,\n\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.sync_batch_id else null end) as last_sync_batch_id,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"status\"]) }} ='RESCHEDULED'\n                and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"reason\"]) }} like '%intended behavior%'\n            then connector_log.created_at else null end) as last_priority_first_sync_completed_at,\n                \n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.created_at else null end) as last_error_at,\n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.sync_batch_id else null end) as last_error_batch,\n        max(case when event_type = 'WARNING' then connector_log.created_at else null end) as last_warning_at\n\n    from connector \n    left join connector_log \n        on connector_log.connector_id = connector.connector_id\n    group by connector.connector_id, connector.connector_name, connector.connector_type, connector.destination_id, connector.is_paused, connector.set_up_at\n),\n\nconnector_health_status as (\n\n    select\n        *,\n        case \n            -- connector is paused\n            when is_paused {{ ' = 1' if target.type == 'sqlserver' else '' }} then 'paused'\n\n            -- a sync has never been attempted\n            when last_sync_started_at is null then 'incomplete'\n\n            -- a priority-first sync has occurred, but a normal sync has not\n            when last_priority_first_sync_completed_at is not null and last_sync_completed_at is null then 'priority first sync'\n\n            -- a priority sync has occurred more recently than a normal one (may occurr if the connector has been paused and resumed)\n            when last_priority_first_sync_completed_at > last_sync_completed_at then 'priority first sync'\n\n            -- a sync has been attempted, but not completed, and it's not due to errors. also a priority-first sync hasn't\n            when last_sync_completed_at is null and last_error_at is null then 'initial sync in progress'\n\n            -- the last attempted sync had an error\n            when last_sync_batch_id = last_error_batch then 'broken'\n\n            -- there's never been a successful sync and there have been errors\n            when last_sync_completed_at is null and last_error_at is not null then 'broken'\n\n        else 'connected' end as connector_health\n\n    from connector_metrics\n),\n\n-- Joining with log to grab pertinent error/warning messagees\nconnector_recent_logs as (\n\n    select \n        connector_health_status.connector_id,\n        connector_health_status.connector_name,\n        connector_health_status.connector_type,\n        connector_health_status.destination_id,\n        connector_health_status.connector_health,\n        connector_health_status.last_successful_sync_completed_at,\n        connector_health_status.last_sync_started_at,\n        connector_health_status.last_sync_completed_at,\n        connector_health_status.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n    from connector_health_status \n    left join connector_log \n        on connector_log.connector_id = connector_health_status.connector_id\n        -- limiting relevance to since the last successful sync completion (if there has been one)\n        and connector_log.created_at > coalesce(connector_health_status.last_sync_completed_at, connector_health_status.last_priority_first_sync_completed_at, '2000-01-01') \n        -- only looking at errors and warnings (excluding syncs - both normal and priority first)\n        and connector_log.event_type != 'INFO' \n        -- need to explicitly avoid priority first statuses because they are of event_type WARNING\n        and not (connector_log.event_subtype = 'status' \n            and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"status\"]) }} ='RESCHEDULED'\n            and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"reason\"]) }} like '%intended behavior%')\n\n    group by -- remove duplicates\n        connector_health_status.connector_id,\n        connector_health_status.connector_name,\n        connector_health_status.connector_type,\n        connector_health_status.destination_id,\n        connector_health_status.connector_health,\n        connector_health_status.last_successful_sync_completed_at,\n        connector_health_status.last_sync_started_at,\n        connector_health_status.last_sync_completed_at,\n        connector_health_status.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n),\n\nfinal as (\n\n    select\n        connector_recent_logs.connector_id,\n        connector_recent_logs.connector_name,\n        connector_recent_logs.connector_type,\n        connector_recent_logs.destination_id,\n        destination.destination_name,\n        connector_recent_logs.connector_health,\n        connector_recent_logs.last_successful_sync_completed_at,\n        connector_recent_logs.last_sync_started_at,\n        connector_recent_logs.last_sync_completed_at,\n        connector_recent_logs.set_up_at,\n        coalesce(schema_changes.number_of_schema_changes_last_month, 0) as number_of_schema_changes_last_month\n        \n        {% if var('fivetran_platform_using_sync_alert_messages', true) %}\n        , {{ fivetran_utils.string_agg(\"case when connector_recent_logs.event_type = 'SEVERE' then connector_recent_logs.message_data else null end\", \"'\\\\n'\") }} as errors_since_last_completed_sync\n        , {{ fivetran_utils.string_agg(\"case when connector_recent_logs.event_type = 'WARNING' then connector_recent_logs.message_data else null end\", \"'\\\\n'\") }} as warnings_since_last_completed_sync\n        {% endif %}\n\n    from connector_recent_logs\n    left join schema_changes \n        on connector_recent_logs.connector_id = schema_changes.connector_id \n\n    join destination on destination.destination_id = connector_recent_logs.destination_id\n    group by \n        connector_recent_logs.connector_id, \n        connector_recent_logs.connector_name, \n        connector_recent_logs.connector_type, \n        connector_recent_logs.destination_id, \n        destination.destination_name, \n        connector_recent_logs.connector_health, \n        connector_recent_logs.last_successful_sync_completed_at, \n        connector_recent_logs.last_sync_started_at, \n        connector_recent_logs.last_sync_completed_at, \n        connector_recent_logs.set_up_at, \n        number_of_schema_changes_last_month\n)\n\nselect * from final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "stg_fivetran_platform__connector", "package": null, "version": null}, {"name": "stg_fivetran_platform__destination", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_utils.json_parse", "macro.dbt.current_timestamp_backcompat", "macro.dbt.datediff", "macro.fivetran_utils.string_agg"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__connector_status.sql", "compiled": true, "compiled_code": "with transformation_removal as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n    where transformation_id is null\n\n),\n\nconnector_log as (\n    select \n        *,\n        sum( case when event_subtype in ('sync_start') then 1 else 0 end) over ( partition by connector_id \n            order by created_at rows unbounded preceding) as sync_batch_id\n    from transformation_removal\n    -- only looking at errors, warnings, and syncs here\n    where event_type = 'SEVERE'\n        or event_type = 'WARNING'\n        or event_subtype like 'sync%'\n        or (event_subtype = 'status' \n            and \n\n  parse_json( message_data )['status'] = 'RESCHEDULED'\n            \n            and \n\n  parse_json( message_data )['reason'] like '%intended behavior%'\n            ) -- for priority-first syncs. these should be captured by event_type = 'WARNING' but let's make sure\n        or (event_subtype = 'status' \n            and \n\n  parse_json( message_data )['status'] = 'SUCCESSFUL'\n        )\n        -- whole reason is \"We have rescheduled the connector to force flush data from the forward sync into your destination. This is intended behavior and means that the connector is working as expected.\"\n),\n\nschema_changes as (\n\n    select\n        connector_id,\n        count(*) as number_of_schema_changes_last_month\n\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n\n    where \n        datediff(\n        day,\n        created_at,\n        \n  current_timestamp::timestamp\n\n        ) <= 30\n        and event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n\n    group by connector_id\n\n),\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector\n\n),\n\ndestination as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\n),\n\nconnector_metrics as (\n\n    select\n        connector.connector_id,\n        connector.connector_name,\n        connector.connector_type,\n        connector.destination_id,\n        connector.is_paused,\n        connector.set_up_at,\n        max(case when connector_log.event_subtype = 'sync_start' then connector_log.created_at else null end) as last_sync_started_at,\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.created_at else null end) as last_sync_completed_at,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and \n\n  parse_json( connector_log.message_data )['status'] ='SUCCESSFUL'\n            then connector_log.created_at else null end) as last_successful_sync_completed_at,\n\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.sync_batch_id else null end) as last_sync_batch_id,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and \n\n  parse_json( connector_log.message_data )['status'] ='RESCHEDULED'\n                and \n\n  parse_json( connector_log.message_data )['reason'] like '%intended behavior%'\n            then connector_log.created_at else null end) as last_priority_first_sync_completed_at,\n                \n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.created_at else null end) as last_error_at,\n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.sync_batch_id else null end) as last_error_batch,\n        max(case when event_type = 'WARNING' then connector_log.created_at else null end) as last_warning_at\n\n    from connector \n    left join connector_log \n        on connector_log.connector_id = connector.connector_id\n    group by connector.connector_id, connector.connector_name, connector.connector_type, connector.destination_id, connector.is_paused, connector.set_up_at\n),\n\nconnector_health_status as (\n\n    select\n        *,\n        case \n            -- connector is paused\n            when is_paused  then 'paused'\n\n            -- a sync has never been attempted\n            when last_sync_started_at is null then 'incomplete'\n\n            -- a priority-first sync has occurred, but a normal sync has not\n            when last_priority_first_sync_completed_at is not null and last_sync_completed_at is null then 'priority first sync'\n\n            -- a priority sync has occurred more recently than a normal one (may occurr if the connector has been paused and resumed)\n            when last_priority_first_sync_completed_at > last_sync_completed_at then 'priority first sync'\n\n            -- a sync has been attempted, but not completed, and it's not due to errors. also a priority-first sync hasn't\n            when last_sync_completed_at is null and last_error_at is null then 'initial sync in progress'\n\n            -- the last attempted sync had an error\n            when last_sync_batch_id = last_error_batch then 'broken'\n\n            -- there's never been a successful sync and there have been errors\n            when last_sync_completed_at is null and last_error_at is not null then 'broken'\n\n        else 'connected' end as connector_health\n\n    from connector_metrics\n),\n\n-- Joining with log to grab pertinent error/warning messagees\nconnector_recent_logs as (\n\n    select \n        connector_health_status.connector_id,\n        connector_health_status.connector_name,\n        connector_health_status.connector_type,\n        connector_health_status.destination_id,\n        connector_health_status.connector_health,\n        connector_health_status.last_successful_sync_completed_at,\n        connector_health_status.last_sync_started_at,\n        connector_health_status.last_sync_completed_at,\n        connector_health_status.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n    from connector_health_status \n    left join connector_log \n        on connector_log.connector_id = connector_health_status.connector_id\n        -- limiting relevance to since the last successful sync completion (if there has been one)\n        and connector_log.created_at > coalesce(connector_health_status.last_sync_completed_at, connector_health_status.last_priority_first_sync_completed_at, '2000-01-01') \n        -- only looking at errors and warnings (excluding syncs - both normal and priority first)\n        and connector_log.event_type != 'INFO' \n        -- need to explicitly avoid priority first statuses because they are of event_type WARNING\n        and not (connector_log.event_subtype = 'status' \n            and \n\n  parse_json( connector_log.message_data )['status'] ='RESCHEDULED'\n            and \n\n  parse_json( connector_log.message_data )['reason'] like '%intended behavior%')\n\n    group by -- remove duplicates\n        connector_health_status.connector_id,\n        connector_health_status.connector_name,\n        connector_health_status.connector_type,\n        connector_health_status.destination_id,\n        connector_health_status.connector_health,\n        connector_health_status.last_successful_sync_completed_at,\n        connector_health_status.last_sync_started_at,\n        connector_health_status.last_sync_completed_at,\n        connector_health_status.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n),\n\nfinal as (\n\n    select\n        connector_recent_logs.connector_id,\n        connector_recent_logs.connector_name,\n        connector_recent_logs.connector_type,\n        connector_recent_logs.destination_id,\n        destination.destination_name,\n        connector_recent_logs.connector_health,\n        connector_recent_logs.last_successful_sync_completed_at,\n        connector_recent_logs.last_sync_started_at,\n        connector_recent_logs.last_sync_completed_at,\n        connector_recent_logs.set_up_at,\n        coalesce(schema_changes.number_of_schema_changes_last_month, 0) as number_of_schema_changes_last_month\n        \n        \n        , \n    listagg(case when connector_recent_logs.event_type = 'SEVERE' then connector_recent_logs.message_data else null end, '\\n')\n\n as errors_since_last_completed_sync\n        , \n    listagg(case when connector_recent_logs.event_type = 'WARNING' then connector_recent_logs.message_data else null end, '\\n')\n\n as warnings_since_last_completed_sync\n        \n\n    from connector_recent_logs\n    left join schema_changes \n        on connector_recent_logs.connector_id = schema_changes.connector_id \n\n    join destination on destination.destination_id = connector_recent_logs.destination_id\n    group by \n        connector_recent_logs.connector_id, \n        connector_recent_logs.connector_name, \n        connector_recent_logs.connector_type, \n        connector_recent_logs.destination_id, \n        destination.destination_name, \n        connector_recent_logs.connector_health, \n        connector_recent_logs.last_successful_sync_completed_at, \n        connector_recent_logs.last_sync_started_at, \n        connector_recent_logs.last_sync_completed_at, \n        connector_recent_logs.set_up_at, \n        number_of_schema_changes_last_month\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__usage_mar_destination_history": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__usage_mar_destination_history", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__usage_mar_destination_history.sql", "original_file_path": "models/fivetran_platform__usage_mar_destination_history.sql", "unique_id": "model.fivetran_log.fivetran_platform__usage_mar_destination_history", "fqn": ["fivetran_log", "fivetran_platform__usage_mar_destination_history"], "alias": "fivetran_platform__usage_mar_destination_history", "checksum": {"name": "sha256", "checksum": "c8bd713eb09e0098db781c6a9493100015de0460ad7f1256205b6a63d5a210d6"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of each destination's usage and active volume, per month. Includes the  usage per million MAR and MAR per usage. Usage either refers to a dollar or credit amount, depending on customer's pricing model. Read more about the relationship between usage and MAR [here](https://www.fivetran.com/legal/service-consumption-table).\n", "columns": {"measured_month": {"name": "measured_month", "description": "The month (yyyy-mm-01) of the usage/MAR measurement.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse housing the active rows.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination as it appears in the UI.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "free_monthly_active_rows": {"name": "free_monthly_active_rows", "description": "The number of free active rows measured in the destination for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_monthly_active_rows": {"name": "paid_monthly_active_rows", "description": "The number of paid active rows measured in the destination for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_monthly_active_rows": {"name": "total_monthly_active_rows", "description": "The total number of active rows measured in the destination for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "credits_spent_per_million_mar": {"name": "credits_spent_per_million_mar", "description": "The ratio of credits spent that month per every million active rows synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mar_per_credit_spent": {"name": "mar_per_credit_spent", "description": "The ratio of the month's active volume to credits spent.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "amount_spent_per_million_mar": {"name": "amount_spent_per_million_mar", "description": "The ratio of amount spent that month per every million active rows synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mar_per_amount_spent": {"name": "mar_per_amount_spent", "description": "The ratio of the month's active volume to amount spent.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "credits_spent": {"name": "credits_spent", "description": "The number of credits used by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dollars_spent": {"name": "dollars_spent", "description": "The dollar amount used by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.082718, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__usage_mar_destination_history", "raw_code": "with table_mar as (\n    \n    select *\n    from {{ ref('fivetran_platform__mar_table_history') }}\n),\n\ncredits_used as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__credits_used') }}\n),\n\nuseage_cost as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__usage_cost') }}\n),\n\ndestination_mar as (\n\n    select \n        cast(measured_month as date) as measured_month,\n        destination_id,\n        destination_name,\n        sum(free_monthly_active_rows) as free_monthly_active_rows,\n        sum(paid_monthly_active_rows) as paid_monthly_active_rows,\n        sum(total_monthly_active_rows) as total_monthly_active_rows\n    from table_mar\n    group by measured_month, destination_id, destination_name\n),\n\nusage as (\n\n    select \n        coalesce(credits_used.destination_id, useage_cost.destination_id) as destination_id,\n        credits_used.credits_spent,\n        useage_cost.dollars_spent,\n        cast(concat(coalesce(credits_used.measured_month,useage_cost.measured_month), '-01') as date) as measured_month -- match date format to join with MAR table\n    from credits_used\n    full outer join useage_cost\n        on useage_cost.measured_month = credits_used.measured_month\n        and useage_cost.destination_id = credits_used.destination_id\n),\n\njoin_usage_mar as (\n\n    select \n        destination_mar.measured_month,\n        destination_mar.destination_id,\n        destination_mar.destination_name,\n        usage.credits_spent,\n        usage.dollars_spent,\n        destination_mar.free_monthly_active_rows,\n        destination_mar.paid_monthly_active_rows,\n        destination_mar.total_monthly_active_rows,\n\n        -- credit and usage mar calculations\n        round( cast(nullif(usage.credits_spent,0) * 1000000.0 as {{ dbt.type_numeric() }}) / cast(nullif(destination_mar.total_monthly_active_rows,0) as {{ dbt.type_numeric() }}), 2) as credits_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as {{ dbt.type_numeric() }}) / cast(nullif(usage.credits_spent,0) as {{ dbt.type_numeric() }}), 0) as mar_per_credit_spent,\n        round( cast(nullif(usage.dollars_spent,0) * 1000000.0 as {{ dbt.type_numeric() }}) / cast(nullif(destination_mar.total_monthly_active_rows,0) as {{ dbt.type_numeric() }}), 2) as amount_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as {{ dbt.type_numeric() }}) / cast(nullif(usage.dollars_spent,0) as {{ dbt.type_numeric() }}), 0) as mar_per_amount_spent\n    from destination_mar \n    left join usage \n        on destination_mar.measured_month = cast(usage.measured_month as date)\n        and destination_mar.destination_id = usage.destination_id\n)\n\nselect * \nfrom join_usage_mar\n{% if target.type != 'sqlserver' %} -- sql server doesn't support ordering CTEs\norder by measured_month desc\n{% endif %}", "language": "sql", "refs": [{"name": "fivetran_platform__mar_table_history", "package": null, "version": null}, {"name": "stg_fivetran_platform__credits_used", "package": null, "version": null}, {"name": "stg_fivetran_platform__usage_cost", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_numeric"], "nodes": ["model.fivetran_log.fivetran_platform__mar_table_history", "model.fivetran_log.stg_fivetran_platform__credits_used", "model.fivetran_log.stg_fivetran_platform__usage_cost"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__usage_mar_destination_history.sql", "compiled": true, "compiled_code": "with table_mar as (\n    \n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__mar_table_history\n),\n\ncredits_used as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__credits_used\n),\n\nuseage_cost as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__usage_cost\n),\n\ndestination_mar as (\n\n    select \n        cast(measured_month as date) as measured_month,\n        destination_id,\n        destination_name,\n        sum(free_monthly_active_rows) as free_monthly_active_rows,\n        sum(paid_monthly_active_rows) as paid_monthly_active_rows,\n        sum(total_monthly_active_rows) as total_monthly_active_rows\n    from table_mar\n    group by measured_month, destination_id, destination_name\n),\n\nusage as (\n\n    select \n        coalesce(credits_used.destination_id, useage_cost.destination_id) as destination_id,\n        credits_used.credits_spent,\n        useage_cost.dollars_spent,\n        cast(concat(coalesce(credits_used.measured_month,useage_cost.measured_month), '-01') as date) as measured_month -- match date format to join with MAR table\n    from credits_used\n    full outer join useage_cost\n        on useage_cost.measured_month = credits_used.measured_month\n        and useage_cost.destination_id = credits_used.destination_id\n),\n\njoin_usage_mar as (\n\n    select \n        destination_mar.measured_month,\n        destination_mar.destination_id,\n        destination_mar.destination_name,\n        usage.credits_spent,\n        usage.dollars_spent,\n        destination_mar.free_monthly_active_rows,\n        destination_mar.paid_monthly_active_rows,\n        destination_mar.total_monthly_active_rows,\n\n        -- credit and usage mar calculations\n        round( cast(nullif(usage.credits_spent,0) * 1000000.0 as numeric(28,6)) / cast(nullif(destination_mar.total_monthly_active_rows,0) as numeric(28,6)), 2) as credits_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as numeric(28,6)) / cast(nullif(usage.credits_spent,0) as numeric(28,6)), 0) as mar_per_credit_spent,\n        round( cast(nullif(usage.dollars_spent,0) * 1000000.0 as numeric(28,6)) / cast(nullif(destination_mar.total_monthly_active_rows,0) as numeric(28,6)), 2) as amount_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as numeric(28,6)) / cast(nullif(usage.dollars_spent,0) as numeric(28,6)), 0) as mar_per_amount_spent\n    from destination_mar \n    left join usage \n        on destination_mar.measured_month = cast(usage.measured_month as date)\n        and destination_mar.destination_id = usage.destination_id\n)\n\nselect * \nfrom join_usage_mar\n -- sql server doesn't support ordering CTEs\norder by measured_month desc\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__audit_table": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__audit_table", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__audit_table.sql", "original_file_path": "models/fivetran_platform__audit_table.sql", "unique_id": "model.fivetran_log.fivetran_platform__audit_table", "fqn": ["fivetran_log", "fivetran_platform__audit_table"], "alias": "fivetran_platform__audit_table", "checksum": {"name": "sha256", "checksum": "6c8c30a02dc78a01d8e32e13a90d0b2f8a4eec8e0b5b35e8364beb2888a3a830"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "incremental", "incremental_strategy": "delete+insert", "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": "unique_table_sync_key", "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "partition_by": ["sync_start_day"], "file_format": "parquet"}, "tags": [], "description": "Table replacing the deprecated `fivetran_audit` table. For each table written to in a sync, captures timestamps and row quantities around table syncs. Each record represents a table being written to in a connector sync. Note: the quantities here will not match the deprecated `fivetran_audit` table completely, as `fivetran_audit` reported on pre-duplicated data loads.\n", "columns": {"unique_table_sync_key": {"name": "unique_table_sync_key", "description": "Primary key of this table, hashed on `schema_name`, `connector_id`, `destination_id`, `table_name`, and `unique_table_sync_key`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "Name of the schema. In cases when the schema is not provided the connector_name is used.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Name of the table being written to.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination that the table is being written to.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "write_to_table_start": {"name": "write_to_table_start", "description": "Timestamp of when Fivetran began to write to this table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "write_to_table_end": {"name": "write_to_table_end", "description": "Timestamp of when Fivetran finished writing to this table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_start": {"name": "sync_start", "description": "Timestamp of when this connector-level sync began.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_end": {"name": "sync_end", "description": "Timestamp of when this connector-level sync finished, if successful.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sum_rows_replaced_or_inserted": {"name": "sum_rows_replaced_or_inserted", "description": "Sum of the rows replaced or inserted into this table during a sync.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sum_rows_updated": {"name": "sum_rows_updated", "description": "Sum of the rows updated in this table during a sync.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sum_rows_deleted": {"name": "sum_rows_deleted", "description": "Sum of the rows deleted from this table during a sync.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_start_day": {"name": "sync_start_day", "description": "The `sync_start` field truncated to the `day`. This field is used for partitioning in Databricks while using the `insert_overwrite` incremental method.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "incremental", "schema": "fivetran_platform", "unique_key": "unique_table_sync_key", "partition_by": ["sync_start_day"], "incremental_strategy": "delete+insert", "file_format": "parquet"}, "created_at": 1702408016.08557, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_table", "raw_code": "{{ config(\n    materialized='incremental',\n    unique_key='unique_table_sync_key',\n    partition_by={\n        'field': 'sync_start',\n        'data_type': 'timestamp',\n        'granularity': 'day'\n    } if target.type == 'bigquery' else ['sync_start_day'],\n    incremental_strategy='insert_overwrite' if target.type in ('bigquery', 'spark', 'databricks') else 'delete+insert',\n    file_format='parquet'\n) }}\n\nwith sync_log as (\n    \n    select \n        *,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['table']) }} as table_name\n    from {{ ref('stg_fivetran_platform__log') }}\n    where event_subtype in ('sync_start', 'sync_end', 'write_to_table_start', 'write_to_table_end', 'records_modified')\n\n    {% if is_incremental() %}\n\n    -- Capture the latest timestamp in a call statement instead of a subquery for optimizing BQ costs on incremental runs\n    {%- call statement('max_sync_start', fetch_result=True) -%}\n        select cast(max(sync_start) as date) from {{ this }}\n    {%- endcall -%}\n\n    -- load the result from the above query into a new variable\n    {%- set query_result = load_result('max_sync_start') -%}\n\n    -- the query_result is stored as a dataframe. Therefore, we want to now store it as a singular value.\n    {%- set max_sync_start = query_result['data'][0][0] -%}\n\n    -- compare the new batch of data to the latest sync already stored in this model\n    and cast(created_at as date) > '{{ max_sync_start }}'\n\n    {% endif %}\n),\n\n\nconnector as (\n\n    select *\n    from {{ ref('fivetran_platform__connector_status') }}\n),\n\nadd_connector_info as (\n\n    select \n        sync_log.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n    from sync_log \n    left join connector\n        on connector.connector_id = sync_log.connector_id\n),\n\nsync_timestamps as (\n\n    select\n        connector_id,\n        connector_name,\n        table_name,\n        event_subtype,\n        destination_id,\n        destination_name,\n        created_at as write_to_table_start,\n        min(case when event_subtype = 'write_to_table_end' then created_at else null end) \n            over (partition by connector_id, table_name order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as write_to_table_end,\n\n        max(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between UNBOUNDED PRECEDING and CURRENT ROW) as sync_start,\n\n        min(case when event_subtype = 'sync_end' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as sync_end, -- coalesce with next_sync_start\n\n        min(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as next_sync_start\n    from add_connector_info\n),\n\n-- this will be the base for every record in the final CTE\nlimit_to_table_starts as (\n\n    select *\n    from sync_timestamps \n    where event_subtype = 'write_to_table_start'\n),\n\nrecords_modified_log as (\n\n    select \n        connector_id,\n        created_at,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['table']) }} as table_name,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['schema']) }} as schema_name,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['operationType']) }} as operation_type,\n        cast ({{ fivetran_utils.json_parse(string='message_data', string_path=['count']) }} as {{ dbt.type_int() }}) as row_count\n    from sync_log \n    where event_subtype = 'records_modified'\n\n),\n\nsum_records_modified as (\n\n    select\n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name) as schema_name,\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end as sync_end,\n        sum(case when records_modified_log.operation_type = 'REPLACED_OR_INSERTED' then records_modified_log.row_count else 0 end) as sum_rows_replaced_or_inserted,\n        sum(case when records_modified_log.operation_type = 'UPDATED' then records_modified_log.row_count else 0 end) as sum_rows_updated,\n        sum(case when records_modified_log.operation_type = 'DELETED' then records_modified_log.row_count else 0 end) as sum_rows_deleted\n    from limit_to_table_starts\n    left join records_modified_log on \n        limit_to_table_starts.connector_id = records_modified_log.connector_id\n        and limit_to_table_starts.table_name = records_modified_log.table_name\n\n        -- confine it to one sync\n        and records_modified_log.created_at > limit_to_table_starts.sync_start \n        and records_modified_log.created_at < coalesce(limit_to_table_starts.sync_end, limit_to_table_starts.next_sync_start) \n\n    group by \n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name),\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end\n),\n\nfinal as (\n\n    select \n        *,\n        {{ dbt_utils.generate_surrogate_key(['schema_name','connector_id', 'destination_id', 'table_name', 'write_to_table_start']) }} as unique_table_sync_key, -- for incremental materialization \n        {{ dbt.date_trunc('day', 'sync_start') }} as sync_start_day -- for partitioning in databricks\n    from sum_records_modified\n)\n\nselect *\nfrom final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "fivetran_platform__connector_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_utils.json_parse", "macro.dbt.is_incremental", "macro.dbt.type_int", "macro.dbt_utils.generate_surrogate_key", "macro.dbt.date_trunc", "macro.dbt.statement"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.fivetran_platform__connector_status"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__audit_table.sql", "compiled": true, "compiled_code": "\n\nwith sync_log as (\n    \n    select \n        *,\n        \n\n  parse_json( message_data )['table'] as table_name\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n    where event_subtype in ('sync_start', 'sync_end', 'write_to_table_start', 'write_to_table_end', 'records_modified')\n\n    \n\n    -- Capture the latest timestamp in a call statement instead of a subquery for optimizing BQ costs on incremental runs-- load the result from the above query into a new variable-- the query_result is stored as a dataframe. Therefore, we want to now store it as a singular value.-- compare the new batch of data to the latest sync already stored in this model\n    and cast(created_at as date) > '2021-12-10'\n\n    \n),\n\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status\n),\n\nadd_connector_info as (\n\n    select \n        sync_log.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n    from sync_log \n    left join connector\n        on connector.connector_id = sync_log.connector_id\n),\n\nsync_timestamps as (\n\n    select\n        connector_id,\n        connector_name,\n        table_name,\n        event_subtype,\n        destination_id,\n        destination_name,\n        created_at as write_to_table_start,\n        min(case when event_subtype = 'write_to_table_end' then created_at else null end) \n            over (partition by connector_id, table_name order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as write_to_table_end,\n\n        max(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between UNBOUNDED PRECEDING and CURRENT ROW) as sync_start,\n\n        min(case when event_subtype = 'sync_end' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as sync_end, -- coalesce with next_sync_start\n\n        min(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as next_sync_start\n    from add_connector_info\n),\n\n-- this will be the base for every record in the final CTE\nlimit_to_table_starts as (\n\n    select *\n    from sync_timestamps \n    where event_subtype = 'write_to_table_start'\n),\n\nrecords_modified_log as (\n\n    select \n        connector_id,\n        created_at,\n        \n\n  parse_json( message_data )['table'] as table_name,\n        \n\n  parse_json( message_data )['schema'] as schema_name,\n        \n\n  parse_json( message_data )['operationType'] as operation_type,\n        cast (\n\n  parse_json( message_data )['count'] as integer) as row_count\n    from sync_log \n    where event_subtype = 'records_modified'\n\n),\n\nsum_records_modified as (\n\n    select\n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name) as schema_name,\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end as sync_end,\n        sum(case when records_modified_log.operation_type = 'REPLACED_OR_INSERTED' then records_modified_log.row_count else 0 end) as sum_rows_replaced_or_inserted,\n        sum(case when records_modified_log.operation_type = 'UPDATED' then records_modified_log.row_count else 0 end) as sum_rows_updated,\n        sum(case when records_modified_log.operation_type = 'DELETED' then records_modified_log.row_count else 0 end) as sum_rows_deleted\n    from limit_to_table_starts\n    left join records_modified_log on \n        limit_to_table_starts.connector_id = records_modified_log.connector_id\n        and limit_to_table_starts.table_name = records_modified_log.table_name\n\n        -- confine it to one sync\n        and records_modified_log.created_at > limit_to_table_starts.sync_start \n        and records_modified_log.created_at < coalesce(limit_to_table_starts.sync_end, limit_to_table_starts.next_sync_start) \n\n    group by \n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name),\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end\n),\n\nfinal as (\n\n    select \n        *,\n        md5(cast(coalesce(cast(schema_name as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(connector_id as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(destination_id as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(table_name as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(write_to_table_start as TEXT), '_dbt_utils_surrogate_key_null_') as TEXT)) as unique_table_sync_key, -- for incremental materialization \n        date_trunc('day', sync_start) as sync_start_day -- for partitioning in databricks\n    from sum_records_modified\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__mar_table_history": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__mar_table_history", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__mar_table_history.sql", "original_file_path": "models/fivetran_platform__mar_table_history.sql", "unique_id": "model.fivetran_log.fivetran_platform__mar_table_history", "fqn": ["fivetran_log", "fivetran_platform__mar_table_history"], "alias": "fivetran_platform__mar_table_history", "checksum": {"name": "sha256", "checksum": "19952f83e6fb1e0c1841adb3fd61e7a556c06f118c09d79bce00a90d40c76fb4"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of each table's monthly active rows (MAR) for all connectors, destinations, and schemas, per month. Read more about how monthly active rows are defined and calculated  [here](https://fivetran.com/docs/getting-started/consumption-based-pricing).\n", "columns": {"connector_name": {"name": "connector_name", "description": "Name of the connector loading this table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "System-generated uniqu ID of the connector loading this table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "Name of the schema in which the table lives.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Name of the table whose MAR was measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm-01) of the measurement.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_measured_at": {"name": "last_measured_at", "description": "Timestamp of when the last MAR measurement for the month was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "free_monthly_active_rows": {"name": "free_monthly_active_rows", "description": "The number of free active rows measured in the table for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_monthly_active_rows": {"name": "paid_monthly_active_rows", "description": "The number of paid active rows measured in the table for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_monthly_active_rows": {"name": "total_monthly_active_rows", "description": "The total number of active rows measured in the table for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination as it appears in the UI.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.0813289, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__mar_table_history", "raw_code": "with incremental_mar as (\n\n    select\n        *,\n        {{ dbt.date_trunc('month', 'measured_date') }} as measured_month\n\n    from {{ ref('stg_fivetran_platform__incremental_mar') }}\n),\n\nconnector as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__connector') }}\n),\n\ndestination as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__destination') }}\n),\n\nordered_mar as (\n\n    select\n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        max(measured_date) as last_measured_at,\n        sum(incremental_rows) as incremental_rows,\n        sum(coalesce(case when lower(free_type) = 'paid'\n            then incremental_rows\n        end, 0)) as paid_monthly_active_rows,\n        sum(coalesce(case when lower(free_type) != 'paid'\n            then incremental_rows\n        end, 0)) as free_monthly_active_rows\n\n    from incremental_mar\n    group by connector_name, schema_name, table_name, destination_id, measured_month\n),\n\nlatest_mar as (\n    select \n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        cast(last_measured_at as date) as last_measured_at,\n        free_monthly_active_rows,\n        paid_monthly_active_rows,\n        (free_monthly_active_rows + paid_monthly_active_rows) as total_monthly_active_rows\n\n    from ordered_mar\n),\n\nmar_join as (\n\n    select\n        latest_mar.*,\n        connector.connector_type,\n        connector.connector_id,\n        destination.destination_name\n\n    from latest_mar\n    join connector\n        on latest_mar.connector_name = connector.connector_name\n        and latest_mar.destination_id = connector.destination_id\n    join destination on latest_mar.destination_id = destination.destination_id\n)\n\nselect * from mar_join\n{% if target.type != 'sqlserver' %} -- can't order CTEs in sqlserver\norder by measured_month desc, destination_id, connector_name\n{% endif %}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__incremental_mar", "package": null, "version": null}, {"name": "stg_fivetran_platform__connector", "package": null, "version": null}, {"name": "stg_fivetran_platform__destination", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.date_trunc"], "nodes": ["model.fivetran_log.stg_fivetran_platform__incremental_mar", "model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__mar_table_history.sql", "compiled": true, "compiled_code": "with incremental_mar as (\n\n    select\n        *,\n        date_trunc('month', measured_date) as measured_month\n\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__incremental_mar\n),\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector\n),\n\ndestination as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\n),\n\nordered_mar as (\n\n    select\n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        max(measured_date) as last_measured_at,\n        sum(incremental_rows) as incremental_rows,\n        sum(coalesce(case when lower(free_type) = 'paid'\n            then incremental_rows\n        end, 0)) as paid_monthly_active_rows,\n        sum(coalesce(case when lower(free_type) != 'paid'\n            then incremental_rows\n        end, 0)) as free_monthly_active_rows\n\n    from incremental_mar\n    group by connector_name, schema_name, table_name, destination_id, measured_month\n),\n\nlatest_mar as (\n    select \n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        cast(last_measured_at as date) as last_measured_at,\n        free_monthly_active_rows,\n        paid_monthly_active_rows,\n        (free_monthly_active_rows + paid_monthly_active_rows) as total_monthly_active_rows\n\n    from ordered_mar\n),\n\nmar_join as (\n\n    select\n        latest_mar.*,\n        connector.connector_type,\n        connector.connector_id,\n        destination.destination_name\n\n    from latest_mar\n    join connector\n        on latest_mar.connector_name = connector.connector_name\n        and latest_mar.destination_id = connector.destination_id\n    join destination on latest_mar.destination_id = destination.destination_id\n)\n\nselect * from mar_join\n -- can't order CTEs in sqlserver\norder by measured_month desc, destination_id, connector_name\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__user": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__user", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__user.sql", "original_file_path": "models/staging/stg_fivetran_platform__user.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__user", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__user"], "alias": "stg_fivetran_platform__user", "checksum": {"name": "sha256", "checksum": "a061bd0449c3600b417d561bac0464e00be250488cdd3d266e3693aec4cee7b3"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of users given access to this Fivetran account.", "columns": {"user_id": {"name": "user_id", "description": "Unique ID of the user's account", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the user was created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "Email associated with the user.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "has_disabled_email_notifications": {"name": "has_disabled_email_notifications", "description": "Boolean of whether they have disabled all email notifications.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "User's last name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "User's first name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "phone": {"name": "phone", "description": "Phone number associated with user.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "is_verified": {"name": "is_verified", "description": "Boolean that indicates whether the user has verified their email address in the account creation process.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform", "enabled": true}, "created_at": 1702408016.2057998, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__user", "raw_code": "{{ config(enabled=var('fivetran_platform_using_user', True)) }}\n\nwith base as (\n\n    select * \n    from {{ var('user') }}\n),\n\nfields as (\n\n    select\n        id as user_id,\n        cast(created_at as {{ dbt.type_timestamp() }}) as created_at,\n        email,\n        email_disabled as has_disabled_email_notifications,\n        family_name as last_name,\n        given_name as first_name,\n        phone,\n        verified as is_verified\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "user"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.user"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__user.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.user\n),\n\nfields as (\n\n    select\n        id as user_id,\n        cast(created_at as timestamp) as created_at,\n        email,\n        email_disabled as has_disabled_email_notifications,\n        family_name as last_name,\n        given_name as first_name,\n        phone,\n        verified as is_verified\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__destination_membership": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__destination_membership", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__destination_membership.sql", "original_file_path": "models/staging/stg_fivetran_platform__destination_membership.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__destination_membership", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__destination_membership"], "alias": "stg_fivetran_platform__destination_membership", "checksum": {"name": "sha256", "checksum": "da8ba27410a264f15f17cd9fd774299fb5fc88fa2f07f898ead71aed3f7f91e8"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of the users given access to this destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the ID of the `destination` that the user is  amember of.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "Foreign key referencing the ID of the `user` belonging to the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "activated_at": {"name": "activated_at", "description": "Timestamp of when the user was activated in the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "joined_at": {"name": "joined_at", "description": "Timestamp when the user was added to the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_role": {"name": "destination_role", "description": "The user's permissions for this individual destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform", "enabled": true}, "created_at": 1702408016.2050781, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination_membership", "raw_code": "{{ config(enabled=var('fivetran_platform_using_destination_membership', True)) }}\n\nwith base as (\n    \n    select * from {{ var('destination_membership') }}\n),\n\nfields as (\n\n    select\n        destination_id,\n        user_id,\n        cast(activated_at as {{ dbt.type_timestamp() }}) as activated_at,\n        cast(joined_at as {{ dbt.type_timestamp() }}) as joined_at,\n        role as destination_role\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "destination_membership"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.destination_membership"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__destination_membership.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n    \n    select * from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.destination_membership\n),\n\nfields as (\n\n    select\n        destination_id,\n        user_id,\n        cast(activated_at as timestamp) as activated_at,\n        cast(joined_at as timestamp) as joined_at,\n        role as destination_role\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__credits_used": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__credits_used", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__credits_used.sql", "original_file_path": "models/staging/stg_fivetran_platform__credits_used.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__credits_used", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__credits_used"], "alias": "stg_fivetran_platform__credits_used", "checksum": {"name": "sha256", "checksum": "a3cbd320d43b57e49856ef3d120ba91addccaa9280d74645ff168c94af2cdc7d"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of the credits used by the customer per month for each destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that was used.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm) of the usage activity.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "credits_spent": {"name": "credits_spent", "description": "The total credits used by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.203042, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__credits_used", "raw_code": "{% if var('fivetran_platform__credits_pricing', does_table_exist('credits_used')) %}\n\nwith base as (\n\n    select * \n    from {{ var('credits_used') }}\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        credits_consumed as credits_spent\n    from base\n)\n\nselect * \nfrom fields\n\n{% else %}\n\nselect\n    cast(null as {{ dbt.type_string() }}) as destination_id,\n    cast(null as {{ dbt.type_string() }}) as measured_month,\n    cast(null as {{ dbt.type_int() }}) as credits_spent\n\n{% endif %}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_log.does_table_exist", "macro.dbt.type_string", "macro.dbt.type_int"], "nodes": []}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__credits_used.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.credits_used\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        credits_consumed as credits_spent\n    from base\n)\n\nselect * \nfrom fields\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__usage_cost": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__usage_cost", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__usage_cost.sql", "original_file_path": "models/staging/stg_fivetran_platform__usage_cost.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__usage_cost", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__usage_cost"], "alias": "stg_fivetran_platform__usage_cost", "checksum": {"name": "sha256", "checksum": "740b47d6acccb2dd3708fe6bdd5c1bde9c127cc3eefa8bee2ddd8cec30b9d1c8"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of the amount spent by the customer per month for each destination. Amount is represented in USD.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that was used.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm) of the usage activity.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dollars_spent": {"name": "dollars_spent", "description": "The total amount spent by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.203359, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__usage_cost", "raw_code": "{% if var('fivetran_platform__usage_pricing', does_table_exist('usage_cost')) %}\nwith base as (\n\n    select * \n    from {{ var('usage_cost') }}\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        amount as dollars_spent\n    from base\n)\n\nselect * \nfrom fields\n\n{% else %}\n\nselect\n    cast(null as {{ dbt.type_string() }}) as destination_id,\n    cast(null as {{ dbt.type_string() }}) as measured_month,\n    cast(null as {{ dbt.type_int() }}) as dollars_spent\n\n{% endif %}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_log.does_table_exist", "macro.dbt.type_string", "macro.dbt.type_int"], "nodes": []}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__usage_cost.sql", "compiled": true, "compiled_code": "\nwith base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.usage_cost\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        amount as dollars_spent\n    from base\n)\n\nselect * \nfrom fields\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__destination": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__destination", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__destination.sql", "original_file_path": "models/staging/stg_fivetran_platform__destination.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__destination", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__destination"], "alias": "stg_fivetran_platform__destination", "checksum": {"name": "sha256", "checksum": "59e204b797ea6e878de36084e5d3bede69c4f652a31ba542528434ae07ea29c8"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of the destinations that have data loaded into them. For each declared source, there will be just one record.", "columns": {"destination_id": {"name": "destination_id", "description": "Unique ID of the destination warehouse", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "account_id": {"name": "account_id", "description": "Foreign key referencing the fivetran `account` associated with the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the destination was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination warehouse.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "region": {"name": "region", "description": "Geographical region of the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.203732, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination", "raw_code": "with base as (\n\n    select * \n    from {{ var('destination') }}\n),\n\nfields as (\n\n    select\n        id as destination_id,\n        account_id,\n        cast(created_at as {{ dbt.type_timestamp() }}) as created_at,\n        name as destination_name,\n        region\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "destination"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.destination"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__destination.sql", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.destination\n),\n\nfields as (\n\n    select\n        id as destination_id,\n        account_id,\n        cast(created_at as timestamp) as created_at,\n        name as destination_name,\n        region\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__log": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__log", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__log.sql", "original_file_path": "models/staging/stg_fivetran_platform__log.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__log", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__log"], "alias": "stg_fivetran_platform__log", "checksum": {"name": "sha256", "checksum": "3d7152127b8635b875e7bba19eeca061435b6c0550540fed56cd174a4b3dbd24"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of logged events related to data syncs. More info on error logs  [here](https://fivetran.com/docs/logs/fivetran-log#errorlogs)\n", "columns": {"log_id": {"name": "log_id", "description": "Unique ID of the log record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_id": {"name": "sync_id", "description": "Identifies which sync the event is associated with.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the event was logged.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "The name of the `connector` that the logged event pertains to.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_type": {"name": "event_type", "description": "The umbrella event type. Events can be classified as a warning, an error, or just an information log.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_data": {"name": "message_data", "description": "The details of the event in JSON format.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_subtype": {"name": "event_subtype", "description": "The routine involved in the log, defined [here](https://fivetran.com/docs/logs#logevents).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "transformation_id": {"name": "transformation_id", "description": "Foreign key referencing the `transformation` if the event refers to a transformation run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.2042081, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log", "raw_code": "with base as (\n\n    select * \n    from {{ ref('stg_fivetran_platform__log_tmp') }}\n),\n\nfields as (\n    select\n        {{\n            fivetran_utils.fill_staging_columns(\n                source_columns=adapter.get_columns_in_relation(ref('stg_fivetran_platform__log_tmp')),\n                staging_columns=get_log_columns()\n            )\n        }}\n    from base\n),\n\nfinal as (\n\n    select\n        id as log_id, \n        sync_id,\n        cast(time_stamp as {{ dbt.type_timestamp() }}) as created_at,\n        connector_id, -- Note: the connector_id column used to erroneously equal the connector_name, NOT its id.\n        case when transformation_id is not null and event is null then 'TRANSFORMATION'\n        else event end as event_type, \n        message_data,\n        case \n        when transformation_id is not null and message_data like '%has succeeded%' then 'transformation run success'\n        when transformation_id is not null and message_data like '%has failed%' then 'transformation run failed'\n        else message_event end as event_subtype,\n        transformation_id\n    from fields\n)\n\nselect * \nfrom final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log_tmp", "package": null, "version": null}, {"name": "stg_fivetran_platform__log_tmp", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_log.get_log_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt.type_timestamp"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log_tmp"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__log.sql", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log_tmp\n),\n\nfields as (\n    select\n        \n    \n    \n    _fivetran_synced\n    \n as \n    \n    _fivetran_synced\n    \n, \n    \n    \n    connector_id\n    \n as \n    \n    connector_id\n    \n, \n    \n    \n    event\n    \n as \n    \n    event\n    \n, \n    \n    \n    id\n    \n as \n    \n    id\n    \n, \n    \n    \n    message_data\n    \n as \n    \n    message_data\n    \n, \n    \n    \n    message_event\n    \n as \n    \n    message_event\n    \n, \n    \n    \n    sync_id\n    \n as \n    \n    sync_id\n    \n, \n    \n    \n    time_stamp\n    \n as \n    \n    time_stamp\n    \n, \n    \n    \n    transformation_id\n    \n as \n    \n    transformation_id\n    \n\n\n\n    from base\n),\n\nfinal as (\n\n    select\n        id as log_id, \n        sync_id,\n        cast(time_stamp as timestamp) as created_at,\n        connector_id, -- Note: the connector_id column used to erroneously equal the connector_name, NOT its id.\n        case when transformation_id is not null and event is null then 'TRANSFORMATION'\n        else event end as event_type, \n        message_data,\n        case \n        when transformation_id is not null and message_data like '%has succeeded%' then 'transformation run success'\n        when transformation_id is not null and message_data like '%has failed%' then 'transformation run failed'\n        else message_event end as event_subtype,\n        transformation_id\n    from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__incremental_mar": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__incremental_mar", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__incremental_mar.sql", "original_file_path": "models/staging/stg_fivetran_platform__incremental_mar.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__incremental_mar", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__incremental_mar"], "alias": "stg_fivetran_platform__incremental_mar", "checksum": {"name": "sha256", "checksum": "e9d206751314e30b94366c9d94ed110146767669605db72745ff1807226304f0"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of **monthly active row (MAR)** measurements made by table per date.  Each measurement is calculated cumulatively for the month and includes all types of mar (paid, free, etc.)\n", "columns": {"connector_name": {"name": "connector_name", "description": "The *name* of the connector being measured. Note - this is erroneously named and will be fixed soon by Fivetran.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` whose table is being measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "free_type": {"name": "free_type", "description": "If it is free MAR, the value indicates the type of free MAR. For paid MAR, the value is `PAID`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_date": {"name": "measured_date", "description": "Timestamp of when the MAR measurement was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "incremental_rows": {"name": "incremental_rows", "description": "The number of new distinct primary keys on the current day synced for the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_type": {"name": "sync_type", "description": "This defines whether the sync for which MAR calculated is HISTORICAL or INCREMENTAL. Currently, the available value is UNKNOWN.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "The name of the connector's schema that houses the measured table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "The name of the table whose MAR was measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Timestamp of when the record was last updated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.2021298, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__incremental_mar", "raw_code": "with base as (\n\n    select * \n    from {{ var('incremental_mar') }}\n),\n\nfields as (\n\n    select\n        connector_id as connector_name,\n        destination_id,\n        free_type,\n        cast(measured_date as {{ dbt.type_timestamp() }}) as measured_date,\n        schema_name,\n        sync_type,\n        table_name,\n        updated_at,\n        _fivetran_synced,\n        incremental_rows\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "incremental_mar"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.incremental_mar"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__incremental_mar.sql", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.incremental_mar\n),\n\nfields as (\n\n    select\n        connector_id as connector_name,\n        destination_id,\n        free_type,\n        cast(measured_date as timestamp) as measured_date,\n        schema_name,\n        sync_type,\n        table_name,\n        updated_at,\n        _fivetran_synced,\n        incremental_rows\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__connector": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__connector", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__connector.sql", "original_file_path": "models/staging/stg_fivetran_platform__connector.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__connector", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__connector"], "alias": "stg_fivetran_platform__connector", "checksum": {"name": "sha256", "checksum": "26bc8050ae36226bbee0e978acbd6e5bdaccbb2d73f66d609bcd82f199c4b6ef"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of all connectors loading data into warehouses. Note that deleted connectors  are not removed, but can be identified by having an older _fivetran_synced field relative  to other connectors.\n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated destination-unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connecting_user_id": {"name": "connecting_user_id", "description": "Foreign key referencing the `user` who set up the connection.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Individual name of the connector. Note that this could be different from the `incremental_mar.schema_name`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "is_paused": {"name": "is_paused", "description": "Boolean that is true if the connector's sync is currently paused.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "set_up_at": {"name": "set_up_at", "description": "Timestamp of when the connection was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.2027159, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector", "raw_code": "with base as (\n\n    select * \n    from {{ ref('stg_fivetran_platform__connector_tmp') }}\n),\n\nfields as (\n    select\n        {{\n            fivetran_utils.fill_staging_columns(\n                source_columns=adapter.get_columns_in_relation(ref('stg_fivetran_platform__connector_tmp')),\n                staging_columns=get_connector_columns()\n            )\n        }}\n        ,row_number() over ( partition by connector_name, destination_id order by _fivetran_synced desc ) as nth_last_record\n    from base\n),\n\nfinal as (\n\n    select \n        connector_id,\n        connector_name,\n        coalesce(connector_type_id, connector_type) as connector_type,\n        destination_id,\n        connecting_user_id,\n        paused as is_paused,\n        signed_up as set_up_at\n    from fields\n\n    -- Only look at the most recent one\n    where nth_last_record = 1\n)\n\nselect * \nfrom final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__connector_tmp", "package": null, "version": null}, {"name": "stg_fivetran_platform__connector_tmp", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_log.get_connector_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.fivetran_log.stg_fivetran_platform__connector_tmp"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__connector.sql", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector_tmp\n),\n\nfields as (\n    select\n        \n    cast(null as boolean) as \n    \n    _fivetran_deleted\n    \n , \n    \n    \n    _fivetran_synced\n    \n as \n    \n    _fivetran_synced\n    \n, \n    \n    \n    connecting_user_id\n    \n as \n    \n    connecting_user_id\n    \n, \n    \n    \n    connector_id\n    \n as \n    \n    connector_id\n    \n, \n    \n    \n    connector_name\n    \n as \n    \n    connector_name\n    \n, \n    \n    \n    connector_type\n    \n as \n    \n    connector_type\n    \n, \n    cast(null as TEXT) as \n    \n    connector_type_id\n    \n , \n    \n    \n    destination_id\n    \n as \n    \n    destination_id\n    \n, \n    \n    \n    paused\n    \n as \n    \n    paused\n    \n, \n    cast(null as integer) as \n    \n    service_version\n    \n , \n    \n    \n    signed_up\n    \n as \n    \n    signed_up\n    \n\n\n\n        ,row_number() over ( partition by connector_name, destination_id order by _fivetran_synced desc ) as nth_last_record\n    from base\n),\n\nfinal as (\n\n    select \n        connector_id,\n        connector_name,\n        coalesce(connector_type_id, connector_type) as connector_type,\n        destination_id,\n        connecting_user_id,\n        paused as is_paused,\n        signed_up as set_up_at\n    from fields\n\n    -- Only look at the most recent one\n    where nth_last_record = 1\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__account": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__account", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__account.sql", "original_file_path": "models/staging/stg_fivetran_platform__account.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__account", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__account"], "alias": "stg_fivetran_platform__account", "checksum": {"name": "sha256", "checksum": "877d7ad3b526b29b2806da63bbb80eceaab46ac8b530a132361bb0c2ab74a20a"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of information on this Fivetran account.", "columns": {"account_id": {"name": "account_id", "description": "Unique ID of the account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "country": {"name": "country", "description": "Country of the account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the account was created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "account_name": {"name": "account_name", "description": "Name of the Fivetran account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of the Fivetran account (ie trial, frozen).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.20473, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__account", "raw_code": "with base as (\n    \n    select * \n    from {{ var('account') }}\n),\n\nfields as (\n\n    select\n        id as account_id,\n        country,\n        cast(created_at as {{ dbt.type_timestamp() }}) as created_at,\n        name as account_name,\n        status\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "account"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.account"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__account.sql", "compiled": true, "compiled_code": "with base as (\n    \n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.account\n),\n\nfields as (\n\n    select\n        id as account_id,\n        country,\n        cast(created_at as timestamp) as created_at,\n        name as account_name,\n        status\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__connector_tmp": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__connector_tmp", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/tmp/stg_fivetran_platform__connector_tmp.sql", "original_file_path": "models/staging/tmp/stg_fivetran_platform__connector_tmp.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__connector_tmp", "fqn": ["fivetran_log", "staging", "tmp", "stg_fivetran_platform__connector_tmp"], "alias": "stg_fivetran_platform__connector_tmp", "checksum": {"name": "sha256", "checksum": "37733092912c2e3514778a0a8826e3c673dc46b5202e6319f1f193da6e453a9e"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "fivetran_platform"}, "created_at": 1702408016.031316, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector_tmp", "raw_code": "select *\nfrom {{ var('connector') }}", "language": "sql", "refs": [], "sources": [["fivetran_platform", "connector"]], "metrics": [], "depends_on": {"macros": [], "nodes": ["source.fivetran_log.fivetran_platform.connector"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/tmp/stg_fivetran_platform__connector_tmp.sql", "compiled": true, "compiled_code": "select *\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.connector", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__log_tmp": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__log_tmp", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/tmp/stg_fivetran_platform__log_tmp.sql", "original_file_path": "models/staging/tmp/stg_fivetran_platform__log_tmp.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__log_tmp", "fqn": ["fivetran_log", "staging", "tmp", "stg_fivetran_platform__log_tmp"], "alias": "stg_fivetran_platform__log_tmp", "checksum": {"name": "sha256", "checksum": "9e05b5b47bbe8eb4004c8113700379a9432e90318d78d548db6f933fd549ed1b"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "fivetran_platform"}, "created_at": 1702408016.037715, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log_tmp", "raw_code": "select *\nfrom {{ var('log') }}", "language": "sql", "refs": [], "sources": [["fivetran_platform", "log"]], "metrics": [], "depends_on": {"macros": [], "nodes": ["source.fivetran_log.fivetran_platform.log"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/tmp/stg_fivetran_platform__log_tmp.sql", "compiled": true, "compiled_code": "select *\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.log", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_id", "destination_id"], "model": "{{ get_where_subquery(ref('fivetran_platform__connector_status')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id"], "alias": "dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43"}, "created_at": 1702408016.1323252, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__connector_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__connector_status"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status\n    group by connector_id, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__connector_status", "attached_node": "model.fivetran_log.fivetran_platform__connector_status"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_id", "destination_id", "schema_name", "table_name", "measured_month"], "model": "{{ get_where_subquery(ref('fivetran_platform__mar_table_history')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month"], "alias": "dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8"}, "created_at": 1702408016.1396532, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__mar_table_history", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__mar_table_history"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, schema_name, table_name, measured_month\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__mar_table_history\n    group by connector_id, destination_id, schema_name, table_name, measured_month\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__mar_table_history", "attached_node": "model.fivetran_log.fivetran_platform__mar_table_history"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["destination_id", "measured_month"], "model": "{{ get_where_subquery(ref('fivetran_platform__usage_mar_destination_history')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month"], "alias": "dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b"}, "created_at": 1702408016.142329, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__usage_mar_destination_history", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        destination_id, measured_month\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__usage_mar_destination_history\n    group by destination_id, measured_month\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__usage_mar_destination_history", "attached_node": "model.fivetran_log.fivetran_platform__usage_mar_destination_history"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_id", "destination_id", "date_day"], "model": "{{ get_where_subquery(ref('fivetran_platform__connector_daily_events')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day"], "alias": "dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1"}, "created_at": 1702408016.1448169, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__connector_daily_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__connector_daily_events"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, date_day\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_daily_events\n    group by connector_id, destination_id, date_day\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__connector_daily_events", "attached_node": "model.fivetran_log.fivetran_platform__connector_daily_events"}, "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "unique_table_sync_key", "model": "{{ get_where_subquery(ref('fivetran_platform__audit_table')) }}"}, "namespace": null}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "unique_fivetran_platform__audit_table_unique_table_sync_key", "resource_type": "test", "package_name": "fivetran_log", "path": "unique_fivetran_platform__audit_table_unique_table_sync_key.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7", "fqn": ["fivetran_log", "unique_fivetran_platform__audit_table_unique_table_sync_key"], "alias": "unique_fivetran_platform__audit_table_unique_table_sync_key", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702408016.147464, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "fivetran_platform__audit_table", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__audit_table"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/unique_fivetran_platform__audit_table_unique_table_sync_key.sql", "compiled": true, "compiled_code": "\n    \n    \n\nselect\n    unique_table_sync_key as unique_field,\n    count(*) as n_records\n\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_table\nwhere unique_table_sync_key is not null\ngroup by unique_table_sync_key\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "unique_table_sync_key", "file_key_name": "models.fivetran_platform__audit_table", "attached_node": "model.fivetran_log.fivetran_platform__audit_table"}, "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "unique_table_sync_key", "model": "{{ get_where_subquery(ref('fivetran_platform__audit_table')) }}"}, "namespace": null}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "not_null_fivetran_platform__audit_table_unique_table_sync_key", "resource_type": "test", "package_name": "fivetran_log", "path": "not_null_fivetran_platform__audit_table_unique_table_sync_key.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af", "fqn": ["fivetran_log", "not_null_fivetran_platform__audit_table_unique_table_sync_key"], "alias": "not_null_fivetran_platform__audit_table_unique_table_sync_key", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702408016.148594, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "fivetran_platform__audit_table", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__audit_table"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/not_null_fivetran_platform__audit_table_unique_table_sync_key.sql", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect unique_table_sync_key\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_table\nwhere unique_table_sync_key is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "unique_table_sync_key", "file_key_name": "models.fivetran_platform__audit_table", "attached_node": "model.fivetran_log.fivetran_platform__audit_table"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_id", "destination_id", "message_data", "created_at"], "model": "{{ get_where_subquery(ref('fivetran_platform__schema_changelog')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at"], "alias": "dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd"}, "created_at": 1702408016.1497269, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__schema_changelog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__schema_changelog"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, message_data, created_at\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__schema_changelog\n    group by connector_id, destination_id, message_data, created_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__schema_changelog", "attached_node": "model.fivetran_log.fivetran_platform__schema_changelog"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at.be572689a3": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["log_id", "occurred_at"], "model": "{{ get_where_subquery(ref('fivetran_platform__audit_user_activity')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_fec574df3883d2c29de1d09d9c7c0b8f.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at.be572689a3", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at"], "alias": "dbt_utils_unique_combination_o_fec574df3883d2c29de1d09d9c7c0b8f", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_fec574df3883d2c29de1d09d9c7c0b8f", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_fec574df3883d2c29de1d09d9c7c0b8f"}, "created_at": 1702408016.152384, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_fec574df3883d2c29de1d09d9c7c0b8f\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__audit_user_activity", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__audit_user_activity"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_fec574df3883d2c29de1d09d9c7c0b8f.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        log_id, occurred_at\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_user_activity\n    group by log_id, occurred_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__audit_user_activity", "attached_node": "model.fivetran_log.fivetran_platform__audit_user_activity"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_name", "destination_id"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__connector')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id"], "alias": "dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62"}, "created_at": 1702408016.206317, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__connector", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__connector"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_name, destination_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector\n    group by connector_name, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__connector", "attached_node": "model.fivetran_log.stg_fivetran_platform__connector"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["measured_month", "destination_id"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__credits_used')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id"], "alias": "dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68"}, "created_at": 1702408016.2090151, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__credits_used", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__credits_used"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        measured_month, destination_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__credits_used\n    group by measured_month, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__credits_used", "attached_node": "model.fivetran_log.stg_fivetran_platform__credits_used"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["measured_month", "destination_id"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__usage_cost')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id"], "alias": "dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945"}, "created_at": 1702408016.211615, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__usage_cost", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__usage_cost"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        measured_month, destination_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__usage_cost\n    group by measured_month, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__usage_cost", "attached_node": "model.fivetran_log.stg_fivetran_platform__usage_cost"}, "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "destination_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__destination')) }}"}, "namespace": null}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "unique_stg_fivetran_platform__destination_destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "unique_stg_fivetran_platform__destination_destination_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed", "fqn": ["fivetran_log", "staging", "unique_stg_fivetran_platform__destination_destination_id"], "alias": "unique_stg_fivetran_platform__destination_destination_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702408016.2142348, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__destination", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__destination"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/unique_stg_fivetran_platform__destination_destination_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\nselect\n    destination_id as unique_field,\n    count(*) as n_records\n\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\nwhere destination_id is not null\ngroup by destination_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "destination_id", "file_key_name": "models.stg_fivetran_platform__destination", "attached_node": "model.fivetran_log.stg_fivetran_platform__destination"}, "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "destination_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__destination')) }}"}, "namespace": null}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "not_null_stg_fivetran_platform__destination_destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "not_null_stg_fivetran_platform__destination_destination_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780", "fqn": ["fivetran_log", "staging", "not_null_stg_fivetran_platform__destination_destination_id"], "alias": "not_null_stg_fivetran_platform__destination_destination_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702408016.215345, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__destination", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__destination"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/not_null_stg_fivetran_platform__destination_destination_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect destination_id\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\nwhere destination_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "destination_id", "file_key_name": "models.stg_fivetran_platform__destination", "attached_node": "model.fivetran_log.stg_fivetran_platform__destination"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["log_id", "created_at"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__log')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at"], "alias": "dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5"}, "created_at": 1702408016.216467, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        log_id, created_at\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n    group by log_id, created_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__log", "attached_node": "model.fivetran_log.stg_fivetran_platform__log"}, "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "account_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__account')) }}"}, "namespace": null}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "unique_stg_fivetran_platform__account_account_id", "resource_type": "test", "package_name": "fivetran_log", "path": "unique_stg_fivetran_platform__account_account_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc", "fqn": ["fivetran_log", "staging", "unique_stg_fivetran_platform__account_account_id"], "alias": "unique_stg_fivetran_platform__account_account_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702408016.219504, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__account", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__account"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/unique_stg_fivetran_platform__account_account_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\nselect\n    account_id as unique_field,\n    count(*) as n_records\n\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__account\nwhere account_id is not null\ngroup by account_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "account_id", "file_key_name": "models.stg_fivetran_platform__account", "attached_node": "model.fivetran_log.stg_fivetran_platform__account"}, "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "account_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__account')) }}"}, "namespace": null}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "not_null_stg_fivetran_platform__account_account_id", "resource_type": "test", "package_name": "fivetran_log", "path": "not_null_stg_fivetran_platform__account_account_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e", "fqn": ["fivetran_log", "staging", "not_null_stg_fivetran_platform__account_account_id"], "alias": "not_null_stg_fivetran_platform__account_account_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702408016.2206101, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__account", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__account"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/not_null_stg_fivetran_platform__account_account_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect account_id\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__account\nwhere account_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "account_id", "file_key_name": "models.stg_fivetran_platform__account", "attached_node": "model.fivetran_log.stg_fivetran_platform__account"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["destination_id", "user_id"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__destination_membership')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id"], "alias": "dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede"}, "created_at": 1702408016.2217338, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__destination_membership", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__destination_membership"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        destination_id, user_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination_membership\n    group by destination_id, user_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__destination_membership", "attached_node": "model.fivetran_log.stg_fivetran_platform__destination_membership"}, "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "user_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__user')) }}"}, "namespace": null}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "unique_stg_fivetran_platform__user_user_id", "resource_type": "test", "package_name": "fivetran_log", "path": "unique_stg_fivetran_platform__user_user_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9", "fqn": ["fivetran_log", "staging", "unique_stg_fivetran_platform__user_user_id"], "alias": "unique_stg_fivetran_platform__user_user_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702408016.22436, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__user", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__user"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/unique_stg_fivetran_platform__user_user_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\nselect\n    user_id as unique_field,\n    count(*) as n_records\n\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__user\nwhere user_id is not null\ngroup by user_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "user_id", "file_key_name": "models.stg_fivetran_platform__user", "attached_node": "model.fivetran_log.stg_fivetran_platform__user"}, "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "user_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__user')) }}"}, "namespace": null}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "not_null_stg_fivetran_platform__user_user_id", "resource_type": "test", "package_name": "fivetran_log", "path": "not_null_stg_fivetran_platform__user_user_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0", "fqn": ["fivetran_log", "staging", "not_null_stg_fivetran_platform__user_user_id"], "alias": "not_null_stg_fivetran_platform__user_user_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702408016.2255008, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__user", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__user"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/not_null_stg_fivetran_platform__user_user_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect user_id\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__user\nwhere user_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "user_id", "file_key_name": "models.stg_fivetran_platform__user", "attached_node": "model.fivetran_log.stg_fivetran_platform__user"}}, "sources": {"source.fivetran_log.fivetran_platform.incremental_mar": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "incremental_mar", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.incremental_mar", "fqn": ["fivetran_log", "staging", "fivetran_platform", "incremental_mar"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "incremental_mar", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 96, "period": "hour"}, "filter": null}, "external": null, "description": "Table of **monthly active row (MAR)** measurements made by table per date.  Each measurement is calculated cumulatively for the month and includes all types of mar (paid, free, etc.)\n", "columns": {"connector_id": {"name": "connector_id", "description": "The *name* of the connector being measured. Note - this is erroneously named and will be fixed soon by Fivetran.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` whose table is being measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "free_type": {"name": "free_type", "description": "If it is free MAR, the value indicates the type of free MAR. For paid MAR, the value is `PAID`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_date": {"name": "measured_date", "description": "Timestamp of when the MAR measurement was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "incremental_rows": {"name": "incremental_rows", "description": "The number of new distinct primary keys on the current day synced for the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_type": {"name": "sync_type", "description": "This defines whether the sync for which MAR calculated is HISTORICAL or INCREMENTAL. Currently, the available value is UNKNOWN.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "The name of the connector's schema that houses the measured table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "The name of the table whose MAR was measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Timestamp of when the record was last updated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.incremental_mar", "created_at": 1702408016.227144}, "source.fivetran_log.fivetran_platform.connector": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "connector", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.connector", "fqn": ["fivetran_log", "staging", "fivetran_platform", "connector"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "connector", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of all connectors loading data into warehouses. Note that deleted connectors  are not removed, but can be identified by having an older _fivetran_synced field relative  to other connectors.\n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connecting_user_id": {"name": "connecting_user_id", "description": "Foreign key referencing the `user` who set up the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Individual name of the connector. Note that this could be different from the `incremental_mar.schema_name`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paused": {"name": "paused", "description": "Boolean that is true if the connector's sync is currently paused.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "signed_up": {"name": "signed_up", "description": "Timestamp of when the connection was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.connector", "created_at": 1702408016.2272599}, "source.fivetran_log.fivetran_platform.credits_used": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "credits_used", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.credits_used", "fqn": ["fivetran_log", "staging", "fivetran_platform", "credits_used"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "credits_used", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of the credits used by the customer per month within each destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the credits were used on", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm) in which the credits were consumed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "credits_consumed": {"name": "credits_consumed", "description": "The number of credits used by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.credits_used", "created_at": 1702408016.2273479}, "source.fivetran_log.fivetran_platform.usage_cost": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "usage_cost", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.usage_cost", "fqn": ["fivetran_log", "staging", "fivetran_platform", "usage_cost"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "usage_cost", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of the credits used by the customer per month within each destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the credits were used on", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm) in which the credits were consumed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "amount": {"name": "amount", "description": "The dollar amount associated with the cost of your connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.usage_cost", "created_at": 1702408016.2274308}, "source.fivetran_log.fivetran_platform.destination": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "destination", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.destination", "fqn": ["fivetran_log", "staging", "fivetran_platform", "destination"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "destination", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of the destinations that have data loaded into them. For each declared source, there will be just one record.", "columns": {"id": {"name": "id", "description": "Unique ID of the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "account_id": {"name": "account_id", "description": "Foreign key referencing the fivetran `account` associated with the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the destination was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "Name of the destination warehouse.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "region": {"name": "region", "description": "Geographical region of the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.destination", "created_at": 1702408016.227516}, "source.fivetran_log.fivetran_platform.log": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "log", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.log", "fqn": ["fivetran_log", "staging", "fivetran_platform", "log"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "log", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 96, "period": "hour"}, "filter": null}, "external": null, "description": "Table of logged events related to data syncs. More info on error logs [here](https://fivetran.com/docs/logs/fivetran-log#errorlogs).", "columns": {"id": {"name": "id", "description": "Contains either `connector_name` (for app/api logs), `transformation_id` (for transformation logs),  or the value `\"system\"` (for system generated logs).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "time_stamp": {"name": "time_stamp", "description": "Timestamp of when the event was logged.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "The *name* of the connector being logged. Note - this is erroneously named and will be fixed soon by Fivetran.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event": {"name": "event", "description": "The umbrella event type. Events can be classified as a warning, an error, or just an information log.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_data": {"name": "message_data", "description": "The details of the event in JSON format.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_event": {"name": "message_event", "description": "The routine involved in the log, defined [here](https://fivetran.com/docs/logs#logevents).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "transformation_id": {"name": "transformation_id", "description": "Foreign key referencing the `transformation` if the event refers to a transformation run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_id": {"name": "sync_id", "description": "Identifies which sync the event is associated with.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.log", "created_at": 1702408016.227607}, "source.fivetran_log.fivetran_platform.account": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "account", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.account", "fqn": ["fivetran_log", "staging", "fivetran_platform", "account"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "account", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of information on this Fivetran account.", "columns": {"id": {"name": "id", "description": "Unique ID of the account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "country": {"name": "country", "description": "Country of the account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the account was created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "Name of the Fivetran account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of the Fivetran account (ie trial, frozen).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.account", "created_at": 1702408016.227691}, "source.fivetran_log.fivetran_platform.destination_membership": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "destination_membership", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.destination_membership", "fqn": ["fivetran_log", "staging", "fivetran_platform", "destination_membership"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "destination_membership", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of the users given access to this destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the ID of the `destination` that the user is a member of.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "Foreign key referencing the ID of the `user` who has access to the destination", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "activated_at": {"name": "activated_at", "description": "Timestamp of when the user was activated in the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "joined_at": {"name": "joined_at", "description": "Timestamp of when the user was added to the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "role": {"name": "role", "description": "The user's permissions for this individual destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {"enabled": true}, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.destination_membership", "created_at": 1702408016.2277818}, "source.fivetran_log.fivetran_platform.user": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "user", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.user", "fqn": ["fivetran_log", "staging", "fivetran_platform", "user"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "user", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of users given access to this Fivetran account.", "columns": {"id": {"name": "id", "description": "Unique ID of the user's account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the user was created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "Email associated with the user.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "email_disabled": {"name": "email_disabled", "description": "Boolean of whether they have disabled all email notifications.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "family_name": {"name": "family_name", "description": "User's last name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "given_name": {"name": "given_name", "description": "User's first name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "phone": {"name": "phone", "description": "Phone number associated with user.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "verified": {"name": "verified", "description": "Boolean that indicates whether the user has verified their email address in the account creation process.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {"enabled": true}, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.user", "created_at": 1702408016.2278779}}, "macros": {"macro.dbt_snowflake.snowflake__get_catalog": {"name": "snowflake__get_catalog", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog", "macro_sql": "{% macro snowflake__get_catalog(information_schema, schemas) -%}\n\n    {% set query %}\n        with tables as (\n            {{ snowflake__get_catalog_tables_sql(information_schema) }}\n            {{ snowflake__get_catalog_schemas_where_clause_sql(schemas) }}\n        ),\n        columns as (\n            {{ snowflake__get_catalog_columns_sql(information_schema) }}\n            {{ snowflake__get_catalog_schemas_where_clause_sql(schemas) }}\n        )\n        {{ snowflake__get_catalog_results_sql() }}\n    {%- endset -%}\n\n    {{ return(run_query(query)) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog_tables_sql", "macro.dbt_snowflake.snowflake__get_catalog_schemas_where_clause_sql", "macro.dbt_snowflake.snowflake__get_catalog_columns_sql", "macro.dbt_snowflake.snowflake__get_catalog_results_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.886265, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_relations": {"name": "snowflake__get_catalog_relations", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_relations", "macro_sql": "{% macro snowflake__get_catalog_relations(information_schema, relations) -%}\n\n    {% set query %}\n        with tables as (\n            {{ snowflake__get_catalog_tables_sql(information_schema) }}\n            {{ snowflake__get_catalog_relations_where_clause_sql(relations) }}\n        ),\n        columns as (\n            {{ snowflake__get_catalog_columns_sql(information_schema) }}\n            {{ snowflake__get_catalog_relations_where_clause_sql(relations) }}\n        )\n        {{ snowflake__get_catalog_results_sql() }}\n    {%- endset -%}\n\n    {{ return(run_query(query)) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog_tables_sql", "macro.dbt_snowflake.snowflake__get_catalog_relations_where_clause_sql", "macro.dbt_snowflake.snowflake__get_catalog_columns_sql", "macro.dbt_snowflake.snowflake__get_catalog_results_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.886687, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_tables_sql": {"name": "snowflake__get_catalog_tables_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_tables_sql", "macro_sql": "{% macro snowflake__get_catalog_tables_sql(information_schema) -%}\n    select\n        table_catalog as \"table_database\",\n        table_schema as \"table_schema\",\n        table_name as \"table_name\",\n        coalesce(table_type, 'DYNAMIC TABLE') as \"table_type\",\n        comment as \"table_comment\",\n\n        -- note: this is the _role_ that owns the table\n        table_owner as \"table_owner\",\n\n        'Clustering Key' as \"stats:clustering_key:label\",\n        clustering_key as \"stats:clustering_key:value\",\n        'The key used to cluster this table' as \"stats:clustering_key:description\",\n        (clustering_key is not null) as \"stats:clustering_key:include\",\n\n        'Row Count' as \"stats:row_count:label\",\n        row_count as \"stats:row_count:value\",\n        'An approximate count of rows in this table' as \"stats:row_count:description\",\n        (row_count is not null) as \"stats:row_count:include\",\n\n        'Approximate Size' as \"stats:bytes:label\",\n        bytes as \"stats:bytes:value\",\n        'Approximate size of the table as reported by Snowflake' as \"stats:bytes:description\",\n        (bytes is not null) as \"stats:bytes:include\",\n\n        'Last Modified' as \"stats:last_modified:label\",\n        to_varchar(convert_timezone('UTC', last_altered), 'yyyy-mm-dd HH24:MI'||'UTC') as \"stats:last_modified:value\",\n        'The timestamp for last update/change' as \"stats:last_modified:description\",\n        (last_altered is not null and table_type='BASE TABLE') as \"stats:last_modified:include\"\n    from {{ information_schema }}.tables\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.88689, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_columns_sql": {"name": "snowflake__get_catalog_columns_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_columns_sql", "macro_sql": "{% macro snowflake__get_catalog_columns_sql(information_schema) -%}\n    select\n        table_catalog as \"table_database\",\n        table_schema as \"table_schema\",\n        table_name as \"table_name\",\n\n        column_name as \"column_name\",\n        ordinal_position as \"column_index\",\n        data_type as \"column_type\",\n        comment as \"column_comment\"\n    from {{ information_schema }}.columns\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.8870149, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_results_sql": {"name": "snowflake__get_catalog_results_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_results_sql", "macro_sql": "{% macro snowflake__get_catalog_results_sql() -%}\n    select *\n    from tables\n    join columns using (\"table_database\", \"table_schema\", \"table_name\")\n    order by \"column_index\"\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.887102, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_schemas_where_clause_sql": {"name": "snowflake__get_catalog_schemas_where_clause_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_schemas_where_clause_sql", "macro_sql": "{% macro snowflake__get_catalog_schemas_where_clause_sql(schemas) -%}\n    where ({%- for schema in schemas -%}\n        upper(\"table_schema\") = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n    {%- endfor -%})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.8873658, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_relations_where_clause_sql": {"name": "snowflake__get_catalog_relations_where_clause_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_relations_where_clause_sql", "macro_sql": "{% macro snowflake__get_catalog_relations_where_clause_sql(relations) -%}\n    where (\n        {%- for relation in relations -%}\n            {% if relation.schema and relation.identifier %}\n                (\n                    upper(\"table_schema\") = upper('{{ relation.schema }}')\n                    and upper(\"table_name\") = upper('{{ relation.identifier }}')\n                )\n            {% elif relation.schema %}\n                (\n                    upper(\"table_schema\") = upper('{{ relation.schema }}')\n                )\n            {% else %}\n                {% do exceptions.raise_compiler_error(\n                    '`get_catalog_relations` requires a list of relations, each with a schema'\n                ) %}\n            {% endif %}\n\n            {%- if not loop.last %} or {% endif -%}\n        {%- endfor -%}\n    )\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.887891, "supported_languages": null}, "macro.dbt_snowflake.get_column_comment_sql": {"name": "get_column_comment_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.get_column_comment_sql", "macro_sql": "{% macro get_column_comment_sql(column_name, column_dict) -%}\n  {% if (column_name|upper in column_dict) -%}\n    {% set matched_column = column_name|upper -%}\n  {% elif (column_name|lower in column_dict) -%}\n    {% set matched_column = column_name|lower -%}\n  {% elif (column_name in column_dict) -%}\n    {% set matched_column = column_name -%}\n  {% else -%}\n    {% set matched_column = None -%}\n  {% endif -%}\n  {% if matched_column -%}\n    {{ adapter.quote(column_name) }} COMMENT $${{ column_dict[matched_column]['description'] | replace('$', '[$]') }}$$\n  {%- else -%}\n    {{ adapter.quote(column_name) }} COMMENT $$$$\n  {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.898263, "supported_languages": null}, "macro.dbt_snowflake.get_persist_docs_column_list": {"name": "get_persist_docs_column_list", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.get_persist_docs_column_list", "macro_sql": "{% macro get_persist_docs_column_list(model_columns, query_columns) %}\n(\n  {% for column_name in query_columns %}\n    {{ get_column_comment_sql(column_name, model_columns) }}\n    {{- \", \" if not loop.last else \"\" }}\n  {% endfor %}\n)\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.get_column_comment_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.898577, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_columns_in_relation": {"name": "snowflake__get_columns_in_relation", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_columns_in_relation", "macro_sql": "{% macro snowflake__get_columns_in_relation(relation) -%}\n  {%- set sql -%}\n    describe table {{ relation }}\n  {%- endset -%}\n  {%- set result = run_query(sql) -%}\n\n  {% set maximum = 10000 %}\n  {% if (result | length) >= maximum %}\n    {% set msg %}\n      Too many columns in relation {{ relation }}! dbt can only get\n      information about relations with fewer than {{ maximum }} columns.\n    {% endset %}\n    {% do exceptions.raise_compiler_error(msg) %}\n  {% endif %}\n\n  {% set columns = [] %}\n  {% for row in result %}\n    {% do columns.append(api.Column.from_description(row['name'], row['type'])) %}\n  {% endfor %}\n  {% do return(columns) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.8993979, "supported_languages": null}, "macro.dbt_snowflake.snowflake__list_schemas": {"name": "snowflake__list_schemas", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__list_schemas", "macro_sql": "{% macro snowflake__list_schemas(database) -%}\n  {# 10k limit from here: https://docs.snowflake.net/manuals/sql-reference/sql/show-schemas.html#usage-notes #}\n  {% set maximum = 10000 %}\n  {% set sql -%}\n    show terse schemas in database {{ database }}\n    limit {{ maximum }}\n  {%- endset %}\n  {% set result = run_query(sql) %}\n  {% if (result | length) >= maximum %}\n    {% set msg %}\n      Too many schemas in database {{ database }}! dbt can only get\n      information about databases with fewer than {{ maximum }} schemas.\n    {% endset %}\n    {% do exceptions.raise_compiler_error(msg) %}\n  {% endif %}\n  {{ return(result) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.899991, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_paginated_relations_array": {"name": "snowflake__get_paginated_relations_array", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_paginated_relations_array", "macro_sql": "{% macro snowflake__get_paginated_relations_array(max_iter, max_results_per_iter, max_total_results, schema_relation, watermark) %}\n\n  {% set paginated_relations = [] %}\n\n  {% for _ in range(0, max_iter) %}\n\n      {%- set paginated_sql -%}\n         show terse objects in {{ schema_relation }} limit {{ max_results_per_iter }} from '{{ watermark.table_name }}'\n      {%- endset -%}\n\n      {%- set paginated_result = run_query(paginated_sql) %}\n      {%- set paginated_n = (paginated_result | length) -%}\n\n      {#\n        terminating condition: if there are 0 records in the result we reached\n        the end exactly on the previous iteration\n      #}\n      {%- if paginated_n == 0 -%}\n        {%- break -%}\n      {%- endif -%}\n\n      {#\n        terminating condition: At some point the user needs to be reasonable with how\n        many objects are contained in their schemas. Since there was already\n        one iteration before attempting pagination, loop.index == max_iter means\n        the limit has been surpassed.\n      #}\n\n      {%- if loop.index == max_iter -%}\n        {%- set msg -%}\n           dbt will list a maximum of {{ max_total_results }} objects in schema {{ schema_relation }}.\n           Your schema exceeds this limit. Please contact support@getdbt.com for troubleshooting tips,\n           or review and reduce the number of objects contained.\n        {%- endset -%}\n\n        {% do exceptions.raise_compiler_error(msg) %}\n      {%- endif -%}\n\n      {%- do paginated_relations.append(paginated_result) -%}\n      {% set watermark.table_name = paginated_result.columns[1].values()[-1] %}\n\n      {#\n        terminating condition: paginated_n < max_results_per_iter means we reached the end\n      #}\n      {%- if paginated_n < max_results_per_iter -%}\n         {%- break -%}\n      {%- endif -%}\n    {%- endfor -%}\n\n  {{ return(paginated_relations) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.901149, "supported_languages": null}, "macro.dbt_snowflake.snowflake__list_relations_without_caching": {"name": "snowflake__list_relations_without_caching", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__list_relations_without_caching", "macro_sql": "{% macro snowflake__list_relations_without_caching(schema_relation, max_iter=10, max_results_per_iter=10000) %}\n\n  {%- set max_total_results = max_results_per_iter * max_iter -%}\n\n  {%- set sql -%}\n    show terse objects in {{ schema_relation }} limit {{ max_results_per_iter }}\n  {%- endset -%}\n\n  {%- set result = run_query(sql) -%}\n\n  {%- set n = (result | length) -%}\n  {%- set watermark = namespace(table_name=result.columns[1].values()[-1]) -%}\n  {%- set paginated = namespace(result=[]) -%}\n\n  {% if n >= max_results_per_iter %}\n\n    {% set paginated.result = snowflake__get_paginated_relations_array(\n         max_iter,\n         max_results_per_iter,\n         max_total_results,\n         schema_relation,\n         watermark\n       )\n    %}\n\n  {% endif %}\n\n  {%- set all_results_array = [result] + paginated.result -%}\n  {%- set result = result.merge(all_results_array) -%}\n  {%- do return(result) -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt_snowflake.snowflake__get_paginated_relations_array"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.902099, "supported_languages": null}, "macro.dbt_snowflake.snowflake__check_schema_exists": {"name": "snowflake__check_schema_exists", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__check_schema_exists", "macro_sql": "{% macro snowflake__check_schema_exists(information_schema, schema) -%}\n  {% call statement('check_schema_exists', fetch_result=True) -%}\n        select count(*)\n        from {{ information_schema }}.schemata\n        where upper(schema_name) = upper('{{ schema }}')\n            and upper(catalog_name) = upper('{{ information_schema.database }}')\n  {%- endcall %}\n  {{ return(load_result('check_schema_exists').table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.902443, "supported_languages": null}, "macro.dbt_snowflake.snowflake__alter_column_type": {"name": "snowflake__alter_column_type", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__alter_column_type", "macro_sql": "{% macro snowflake__alter_column_type(relation, column_name, new_column_type) -%}\n  {% call statement('alter_column_type') %}\n    alter table {{ relation }} alter {{ adapter.quote(column_name) }} set data type {{ new_column_type }};\n  {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.902702, "supported_languages": null}, "macro.dbt_snowflake.snowflake__alter_relation_comment": {"name": "snowflake__alter_relation_comment", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__alter_relation_comment", "macro_sql": "{% macro snowflake__alter_relation_comment(relation, relation_comment) -%}\n    {%- if relation.is_dynamic_table -%}\n        {%- set relation_type = 'dynamic table' -%}\n    {%- else -%}\n        {%- set relation_type = relation.type -%}\n    {%- endif -%}\n    comment on {{ relation_type }} {{ relation }} IS $${{ relation_comment | replace('$', '[$]') }}$$;\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9030468, "supported_languages": null}, "macro.dbt_snowflake.snowflake__alter_column_comment": {"name": "snowflake__alter_column_comment", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__alter_column_comment", "macro_sql": "{% macro snowflake__alter_column_comment(relation, column_dict) -%}\n    {% set existing_columns = adapter.get_columns_in_relation(relation) | map(attribute=\"name\") | list %}\n    {% if relation.is_dynamic_table -%}\n        {% set relation_type = \"table\" %}\n    {% else -%}\n        {% set relation_type = relation.type %}\n    {% endif %}\n    alter {{ relation_type }} {{ relation }} alter\n    {% for column_name in existing_columns if (column_name in existing_columns) or (column_name|lower in existing_columns) %}\n        {{ get_column_comment_sql(column_name, column_dict) }} {{- ',' if not loop.last else ';' }}\n    {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.get_column_comment_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.903733, "supported_languages": null}, "macro.dbt_snowflake.get_current_query_tag": {"name": "get_current_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.get_current_query_tag", "macro_sql": "{% macro get_current_query_tag() -%}\n  {{ return(run_query(\"show parameters like 'query_tag' in session\").rows[0]['value']) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9039261, "supported_languages": null}, "macro.dbt_snowflake.set_query_tag": {"name": "set_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.set_query_tag", "macro_sql": "{% macro set_query_tag() -%}\n    {{ return(adapter.dispatch('set_query_tag', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__set_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.904093, "supported_languages": null}, "macro.dbt_snowflake.snowflake__set_query_tag": {"name": "snowflake__set_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__set_query_tag", "macro_sql": "{% macro snowflake__set_query_tag() -%}\n  {% set new_query_tag = config.get('query_tag') %}\n  {% if new_query_tag %}\n    {% set original_query_tag = get_current_query_tag() %}\n    {{ log(\"Setting query_tag to '\" ~ new_query_tag ~ \"'. Will reset to '\" ~ original_query_tag ~ \"' after materialization.\") }}\n    {% do run_query(\"alter session set query_tag = '{}'\".format(new_query_tag)) %}\n    {{ return(original_query_tag)}}\n  {% endif %}\n  {{ return(none)}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.get_current_query_tag", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9045792, "supported_languages": null}, "macro.dbt_snowflake.unset_query_tag": {"name": "unset_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.unset_query_tag", "macro_sql": "{% macro unset_query_tag(original_query_tag) -%}\n    {{ return(adapter.dispatch('unset_query_tag', 'dbt')(original_query_tag)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.904769, "supported_languages": null}, "macro.dbt_snowflake.snowflake__unset_query_tag": {"name": "snowflake__unset_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__unset_query_tag", "macro_sql": "{% macro snowflake__unset_query_tag(original_query_tag) -%}\n  {% set new_query_tag = config.get('query_tag') %}\n  {% if new_query_tag %}\n    {% if original_query_tag %}\n      {{ log(\"Resetting query_tag to '\" ~ original_query_tag ~ \"'.\") }}\n      {% do run_query(\"alter session set query_tag = '{}'\".format(original_query_tag)) %}\n    {% else %}\n      {{ log(\"No original query_tag, unsetting parameter.\") }}\n      {% do run_query(\"alter session unset query_tag\") %}\n    {% endif %}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9052632, "supported_languages": null}, "macro.dbt_snowflake.snowflake__alter_relation_add_remove_columns": {"name": "snowflake__alter_relation_add_remove_columns", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__alter_relation_add_remove_columns", "macro_sql": "{% macro snowflake__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n\n    {% if relation.is_dynamic_table -%}\n        {% set relation_type = \"dynamic table\" %}\n    {% else -%}\n        {% set relation_type = relation.type %}\n    {% endif %}\n\n    {% if add_columns %}\n\n    {% set sql -%}\n       alter {{ relation_type }} {{ relation }} add column\n          {% for column in add_columns %}\n            {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n          {% endfor %}\n    {%- endset -%}\n\n    {% do run_query(sql) %}\n\n    {% endif %}\n\n    {% if remove_columns %}\n\n    {% set sql -%}\n        alter {{ relation_type }} {{ relation }} drop column\n            {% for column in remove_columns %}\n                {{ column.name }}{{ ',' if not loop.last }}\n            {% endfor %}\n    {%- endset -%}\n\n    {% do run_query(sql) %}\n\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9061718, "supported_languages": null}, "macro.dbt_snowflake.snowflake_dml_explicit_transaction": {"name": "snowflake_dml_explicit_transaction", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake_dml_explicit_transaction", "macro_sql": "{% macro snowflake_dml_explicit_transaction(dml) %}\n  {#\n    Use this macro to wrap all INSERT, MERGE, UPDATE, DELETE, and TRUNCATE\n    statements before passing them into run_query(), or calling in the 'main' statement\n    of a materialization\n  #}\n  {% set dml_transaction -%}\n    begin;\n    {{ dml }};\n    commit;\n  {%- endset %}\n\n  {% do return(dml_transaction) %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.906393, "supported_languages": null}, "macro.dbt_snowflake.snowflake__truncate_relation": {"name": "snowflake__truncate_relation", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__truncate_relation", "macro_sql": "{% macro snowflake__truncate_relation(relation) -%}\n  {% set truncate_dml %}\n    truncate table {{ relation }}\n  {% endset %}\n  {% call statement('truncate_relation') -%}\n    {{ snowflake_dml_explicit_transaction(truncate_dml) }}\n  {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.906645, "supported_languages": null}, "macro.dbt_snowflake.snowflake__copy_grants": {"name": "snowflake__copy_grants", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/apply_grants.sql", "original_file_path": "macros/apply_grants.sql", "unique_id": "macro.dbt_snowflake.snowflake__copy_grants", "macro_sql": "{% macro snowflake__copy_grants() %}\n    {% set copy_grants = config.get('copy_grants', False) %}\n    {{ return(copy_grants) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.90694, "supported_languages": null}, "macro.dbt_snowflake.snowflake__support_multiple_grantees_per_dcl_statement": {"name": "snowflake__support_multiple_grantees_per_dcl_statement", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/apply_grants.sql", "original_file_path": "macros/apply_grants.sql", "unique_id": "macro.dbt_snowflake.snowflake__support_multiple_grantees_per_dcl_statement", "macro_sql": "\n\n{%- macro snowflake__support_multiple_grantees_per_dcl_statement() -%}\n    {{ return(False) }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.907058, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_relation_last_modified": {"name": "snowflake__get_relation_last_modified", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/metadata.sql", "original_file_path": "macros/metadata.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_relation_last_modified", "macro_sql": "{% macro snowflake__get_relation_last_modified(information_schema, relations) -%}\n\n  {%- call statement('last_modified', fetch_result=True) -%}\n        select table_schema as schema,\n               table_name as identifier,\n               last_altered as last_modified,\n               {{ current_timestamp() }} as snapshotted_at\n        from {{ information_schema }}.tables\n        where (\n          {%- for relation in relations -%}\n            (upper(table_schema) = upper('{{ relation.schema }}') and\n             upper(table_name) = upper('{{ relation.identifier }}')){%- if not loop.last %} or {% endif -%}\n          {%- endfor -%}\n        )\n  {%- endcall -%}\n\n  {{ return(load_result('last_modified')) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.907756, "supported_languages": null}, "macro.dbt_snowflake.materialization_test_snowflake": {"name": "materialization_test_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/test.sql", "original_file_path": "macros/materializations/test.sql", "unique_id": "macro.dbt_snowflake.materialization_test_snowflake", "macro_sql": "{%- materialization test, adapter='snowflake' -%}\n\n    {% set original_query_tag = set_query_tag() %}\n    {% set relations = materialization_test_default() %}\n    {% do unset_query_tag(original_query_tag) %}\n    {{ return(relations) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.materialization_test_default", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.908118, "supported_languages": ["sql"]}, "macro.dbt_snowflake.snowflake__get_merge_sql": {"name": "snowflake__get_merge_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_merge_sql", "macro_sql": "{% macro snowflake__get_merge_sql(target, source_sql, unique_key, dest_columns, incremental_predicates) -%}\n\n    {#\n       Workaround for Snowflake not being happy with a merge on a constant-false predicate.\n       When no unique_key is provided, this macro will do a regular insert. If a unique_key\n       is provided, then this macro will do a proper merge instead.\n    #}\n\n    {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute='name')) -%}\n    {%- set sql_header = config.get('sql_header', none) -%}\n\n    {%- set dml -%}\n    {%- if unique_key is none -%}\n\n        {{ sql_header if sql_header is not none }}\n\n        insert into {{ target }} ({{ dest_cols_csv }})\n        (\n            select {{ dest_cols_csv }}\n            from {{ source_sql }}\n        )\n\n    {%- else -%}\n\n        {{ default__get_merge_sql(target, source_sql, unique_key, dest_columns, incremental_predicates) }}\n\n    {%- endif -%}\n    {%- endset -%}\n\n    {% do return(snowflake_dml_explicit_transaction(dml)) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv", "macro.dbt.default__get_merge_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.909515, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_delete_insert_merge_sql": {"name": "snowflake__get_delete_insert_merge_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_delete_insert_merge_sql", "macro_sql": "{% macro snowflake__get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) %}\n    {% set dml = default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) %}\n    {% do return(snowflake_dml_explicit_transaction(dml)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_delete_insert_merge_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.909835, "supported_languages": null}, "macro.dbt_snowflake.snowflake__snapshot_merge_sql": {"name": "snowflake__snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "unique_id": "macro.dbt_snowflake.snowflake__snapshot_merge_sql", "macro_sql": "{% macro snowflake__snapshot_merge_sql(target, source, insert_cols) %}\n    {% set dml = default__snapshot_merge_sql(target, source, insert_cols) %}\n    {% do return(snowflake_dml_explicit_transaction(dml)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__snapshot_merge_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9101079, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_incremental_append_sql": {"name": "snowflake__get_incremental_append_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_incremental_append_sql", "macro_sql": "{% macro snowflake__get_incremental_append_sql(get_incremental_append_sql) %}\n    {% set dml = default__get_incremental_append_sql(get_incremental_append_sql) %}\n    {% do return(snowflake_dml_explicit_transaction(dml)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_append_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.91032, "supported_languages": null}, "macro.dbt_snowflake.snowflake__load_csv_rows": {"name": "snowflake__load_csv_rows", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "unique_id": "macro.dbt_snowflake.snowflake__load_csv_rows", "macro_sql": "{% macro snowflake__load_csv_rows(model, agate_table) %}\n    {% set batch_size = get_batch_size() %}\n    {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n    {% set bindings = [] %}\n\n    {% set statements = [] %}\n\n    {% for chunk in agate_table.rows | batch(batch_size) %}\n        {% set bindings = [] %}\n\n        {% for row in chunk %}\n            {% do bindings.extend(row) %}\n        {% endfor %}\n\n        {% set sql %}\n            insert into {{ this.render() }} ({{ cols_sql }}) values\n            {% for row in chunk -%}\n                ({%- for column in agate_table.column_names -%}\n                    %s\n                    {%- if not loop.last%},{%- endif %}\n                {%- endfor -%})\n                {%- if not loop.last%},{%- endif %}\n            {%- endfor %}\n        {% endset %}\n\n        {% do adapter.add_query('BEGIN', auto_begin=False) %}\n        {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n        {% do adapter.add_query('COMMIT', auto_begin=False) %}\n\n        {% if loop.index0 == 0 %}\n            {% do statements.append(sql) %}\n        {% endif %}\n    {% endfor %}\n\n    {# Return SQL so we can render it out into the compiled files #}\n    {{ return(statements[0]) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.912678, "supported_languages": null}, "macro.dbt_snowflake.materialization_seed_snowflake": {"name": "materialization_seed_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "unique_id": "macro.dbt_snowflake.materialization_seed_snowflake", "macro_sql": "{% materialization seed, adapter='snowflake' %}\n    {% set original_query_tag = set_query_tag() %}\n\n    {% set relations = materialization_seed_default() %}\n\n    {% do unset_query_tag(original_query_tag) %}\n\n    {{ return(relations) }}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.materialization_seed_default", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.912988, "supported_languages": ["sql"]}, "macro.dbt_snowflake.materialization_view_snowflake": {"name": "materialization_view_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "unique_id": "macro.dbt_snowflake.materialization_view_snowflake", "macro_sql": "{% materialization view, adapter='snowflake' -%}\n\n    {% set original_query_tag = set_query_tag() %}\n    {% set to_return = snowflake__create_or_replace_view() %}\n\n    {% set target_relation = this.incorporate(type='view') %}\n\n    {% do persist_docs(target_relation, model, for_columns=false) %}\n\n    {% do unset_query_tag(original_query_tag) %}\n\n    {% do return(to_return) %}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt_snowflake.snowflake__create_or_replace_view", "macro.dbt.persist_docs", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9135401, "supported_languages": ["sql"]}, "macro.dbt_snowflake.materialization_table_snowflake": {"name": "materialization_table_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_snowflake.materialization_table_snowflake", "macro_sql": "{% materialization table, adapter='snowflake', supported_languages=['sql', 'python']%}\n\n  {% set original_query_tag = set_query_tag() %}\n\n  {%- set identifier = model['alias'] -%}\n  {%- set language = model['language'] -%}\n\n  {% set grant_config = config.get('grants') %}\n\n  {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n  {%- set target_relation = api.Relation.create(identifier=identifier,\n                                                schema=schema,\n                                                database=database, type='table') -%}\n\n  {{ run_hooks(pre_hooks) }}\n\n  {#-- Drop the relation if it was a view to \"convert\" it in a table. This may lead to\n    -- downtime, but it should be a relatively infrequent occurrence  #}\n  {% if old_relation is not none and not old_relation.is_table %}\n    {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n    {{ drop_relation_if_exists(old_relation) }}\n  {% endif %}\n\n  {% call statement('main', language=language) -%}\n      {{ create_table_as(False, target_relation, compiled_code, language) }}\n  {%- endcall %}\n\n  {{ run_hooks(post_hooks) }}\n\n  {% set should_revoke = should_revoke(old_relation, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {% do unset_query_tag(original_query_tag) %}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.915818, "supported_languages": ["sql", "python"]}, "macro.dbt_snowflake.py_write_table": {"name": "py_write_table", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_snowflake.py_write_table", "macro_sql": "{% macro py_write_table(compiled_code, target_relation, temporary=False, table_type=none) %}\n{#- The following logic is only for backwards-compatiblity with deprecated `temporary` parameter -#}\n{% if table_type is not none %}\n    {#- Just use the table_type as-is -#}\n{% elif temporary -%}\n    {#- Case 1 when the deprecated `temporary` parameter is used without the replacement `table_type` parameter -#}\n    {%- set table_type = \"temporary\" -%}\n{% else %}\n    {#- Case 2 when the deprecated `temporary` parameter is used without the replacement `table_type` parameter -#}\n    {#- Snowflake treats \"\" as meaning \"permanent\" -#}\n    {%- set table_type = \"\" -%}\n{%- endif %}\n{{ compiled_code }}\ndef materialize(session, df, target_relation):\n    # make sure pandas exists\n    import importlib.util\n    package_name = 'pandas'\n    if importlib.util.find_spec(package_name):\n        import pandas\n        if isinstance(df, pandas.core.frame.DataFrame):\n          session.use_database(target_relation.database)\n          session.use_schema(target_relation.schema)\n          # session.write_pandas does not have overwrite function\n          df = session.createDataFrame(df)\n    {% set target_relation_name = resolve_model_name(target_relation) %}\n    df.write.mode(\"overwrite\").save_as_table('{{ target_relation_name }}', table_type='{{table_type}}')\n\ndef main(session):\n    dbt = dbtObj(session.table)\n    df = model(dbt, session)\n    materialize(session, df, dbt.this)\n    return \"OK\"\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.916328, "supported_languages": null}, "macro.dbt_snowflake.py_script_comment": {"name": "py_script_comment", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_snowflake.py_script_comment", "macro_sql": "{% macro py_script_comment()%}\n# To run this in snowsight, you need to select entry point to be main\n# And you may have to modify the return type to text to get the result back\n# def main(session):\n#     dbt = dbtObj(session.table)\n#     df = model(dbt, session)\n#     return df.collect()\n\n# to run this in local notebook, you need to create a session following examples https://github.com/Snowflake-Labs/sfguide-getting-started-snowpark-python\n# then you can do the following to run model\n# dbt = dbtObj(session.table)\n# df = model(dbt, session)\n{%endmacro%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.916436, "supported_languages": null}, "macro.dbt_snowflake.dbt_snowflake_get_tmp_relation_type": {"name": "dbt_snowflake_get_tmp_relation_type", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_snowflake.dbt_snowflake_get_tmp_relation_type", "macro_sql": "{% macro dbt_snowflake_get_tmp_relation_type(strategy, unique_key, language) %}\n{%- set tmp_relation_type = config.get('tmp_relation_type') -%}\n  /* {#\n       High-level principles:\n       If we are running multiple statements (DELETE + INSERT),\n       and we want to guarantee identical inputs to both statements,\n       then we must first save the model query results as a temporary table\n       (which presumably comes with a performance cost).\n       If we are running a single statement (MERGE or INSERT alone),\n       we _may_ save the model query definition as a view instead,\n       for (presumably) faster overall incremental processing.\n\n       Low-level specifics:\n       If an invalid option is specified, then we will raise an\n       excpetion with corresponding message.\n\n       Languages other than SQL (like Python) will use a temporary table.\n       With the default strategy of merge, the user may choose between a temporary\n       table and view (defaulting to view).\n\n       The append strategy can use a view because it will run a single INSERT statement.\n\n       When unique_key is none, the delete+insert strategy can use a view beacuse a\n       single INSERT statement is run with no DELETES as part of the statement.\n       Otherwise, play it safe by using a temporary table.\n  #} */\n\n  {% if language == \"python\" and tmp_relation_type is not none %}\n    {% do exceptions.raise_compiler_error(\n      \"Python models currently only support 'table' for tmp_relation_type but \"\n       ~ tmp_relation_type ~ \" was specified.\"\n    ) %}\n  {% endif %}\n\n  {% if strategy == \"delete+insert\" and tmp_relation_type is not none and tmp_relation_type != \"table\" and unique_key is not none %}\n    {% do exceptions.raise_compiler_error(\n      \"In order to maintain consistent results when `unique_key` is not none,\n      the `delete+insert` strategy only supports `table` for `tmp_relation_type` but \"\n      ~ tmp_relation_type ~ \" was specified.\"\n      )\n  %}\n  {% endif %}\n\n  {% if language != \"sql\" %}\n    {{ return(\"table\") }}\n  {% elif tmp_relation_type == \"table\" %}\n    {{ return(\"table\") }}\n  {% elif tmp_relation_type == \"view\" %}\n    {{ return(\"view\") }}\n  {% elif strategy in (\"default\", \"merge\", \"append\") %}\n    {{ return(\"view\") }}\n  {% elif strategy == \"delete+insert\" and unique_key is none %}\n    {{ return(\"view\") }}\n  {% else %}\n    {{ return(\"table\") }}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.918999, "supported_languages": null}, "macro.dbt_snowflake.materialization_incremental_snowflake": {"name": "materialization_incremental_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_snowflake.materialization_incremental_snowflake", "macro_sql": "{% materialization incremental, adapter='snowflake', supported_languages=['sql', 'python'] -%}\n\n  {% set original_query_tag = set_query_tag() %}\n\n  {#-- Set vars --#}\n  {%- set full_refresh_mode = (should_full_refresh()) -%}\n  {%- set language = model['language'] -%}\n  {% set target_relation = this %}\n  {% set existing_relation = load_relation(this) %}\n\n  {#-- The temp relation will be a view (faster) or temp table, depending on upsert/merge strategy --#}\n  {%- set unique_key = config.get('unique_key') -%}\n  {% set incremental_strategy = config.get('incremental_strategy') or 'default' %}\n  {% set tmp_relation_type = dbt_snowflake_get_tmp_relation_type(incremental_strategy, unique_key, language) %}\n  {% set tmp_relation = make_temp_relation(this).incorporate(type=tmp_relation_type) %}\n\n  {% set grant_config = config.get('grants') %}\n\n  {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %}\n\n  {{ run_hooks(pre_hooks) }}\n\n  {% if existing_relation is none %}\n    {%- call statement('main', language=language) -%}\n      {{ create_table_as(False, target_relation, compiled_code, language) }}\n    {%- endcall -%}\n\n  {% elif existing_relation.is_view %}\n    {#-- Can't overwrite a view with a table - we must drop --#}\n    {{ log(\"Dropping relation \" ~ target_relation ~ \" because it is a view and this model is a table.\") }}\n    {% do adapter.drop_relation(existing_relation) %}\n    {%- call statement('main', language=language) -%}\n      {{ create_table_as(False, target_relation, compiled_code, language) }}\n    {%- endcall -%}\n  {% elif full_refresh_mode %}\n    {%- call statement('main', language=language) -%}\n      {{ create_table_as(False, target_relation, compiled_code, language) }}\n    {%- endcall -%}\n\n  {% else %}\n    {#-- Create the temp relation, either as a view or as a temp table --#}\n    {% if tmp_relation_type == 'view' %}\n        {%- call statement('create_tmp_relation') -%}\n          {{ snowflake__create_view_as_with_temp_flag(tmp_relation, compiled_code, True) }}\n        {%- endcall -%}\n    {% else %}\n        {%- call statement('create_tmp_relation', language=language) -%}\n          {{ create_table_as(True, tmp_relation, compiled_code, language) }}\n        {%- endcall -%}\n    {% endif %}\n\n    {% do adapter.expand_target_column_types(\n           from_relation=tmp_relation,\n           to_relation=target_relation) %}\n    {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n    {% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}\n    {% if not dest_columns %}\n      {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n    {% endif %}\n\n    {#-- Get the incremental_strategy, the macro to use for the strategy, and build the sql --#}\n    {% set incremental_predicates = config.get('predicates', none) or config.get('incremental_predicates', none) %}\n    {% set strategy_sql_macro_func = adapter.get_incremental_strategy_macro(context, incremental_strategy) %}\n    {% set strategy_arg_dict = ({'target_relation': target_relation, 'temp_relation': tmp_relation, 'unique_key': unique_key, 'dest_columns': dest_columns, 'incremental_predicates': incremental_predicates }) %}\n\n    {%- call statement('main') -%}\n      {{ strategy_sql_macro_func(strategy_arg_dict) }}\n    {%- endcall -%}\n  {% endif %}\n\n  {% do drop_relation_if_exists(tmp_relation) %}\n\n  {{ run_hooks(post_hooks) }}\n\n  {% set target_relation = target_relation.incorporate(type='table') %}\n\n  {% set should_revoke =\n   should_revoke(existing_relation.is_table, full_refresh_mode) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {% do unset_query_tag(original_query_tag) %}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.should_full_refresh", "macro.dbt.load_relation", "macro.dbt_snowflake.dbt_snowflake_get_tmp_relation_type", "macro.dbt.make_temp_relation", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt_snowflake.snowflake__create_view_as_with_temp_flag", "macro.dbt.process_schema_changes", "macro.dbt.drop_relation_if_exists", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.958792, "supported_languages": ["sql", "python"]}, "macro.dbt_snowflake.snowflake__get_incremental_default_sql": {"name": "snowflake__get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_incremental_default_sql", "macro_sql": "{% macro snowflake__get_incremental_default_sql(arg_dict) %}\n  {{ return(get_incremental_merge_sql(arg_dict)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_incremental_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9590049, "supported_languages": null}, "macro.dbt_snowflake.materialization_snapshot_snowflake": {"name": "materialization_snapshot_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "unique_id": "macro.dbt_snowflake.materialization_snapshot_snowflake", "macro_sql": "{% materialization snapshot, adapter='snowflake' %}\n    {% set original_query_tag = set_query_tag() %}\n    {% set relations = materialization_snapshot_default() %}\n\n    {% do unset_query_tag(original_query_tag) %}\n\n    {{ return(relations) }}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.materialization_snapshot_default", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.959401, "supported_languages": ["sql"]}, "macro.dbt_snowflake.materialization_dynamic_table_snowflake": {"name": "materialization_dynamic_table_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.materialization_dynamic_table_snowflake", "macro_sql": "{% materialization dynamic_table, adapter='snowflake' %}\n\n    {% set query_tag = set_query_tag() %}\n\n    {% set existing_relation = load_cached_relation(this) %}\n    {% set target_relation = this.incorporate(type=this.DynamicTable) %}\n\n    {{ run_hooks(pre_hooks) }}\n\n    {% set build_sql = dynamic_table_get_build_sql(existing_relation, target_relation) %}\n\n    {% if build_sql == '' %}\n        {{ dynamic_table_execute_no_op(target_relation) }}\n    {% else %}\n        {{ dynamic_table_execute_build_sql(build_sql, existing_relation, target_relation) }}\n    {% endif %}\n\n    {{ run_hooks(post_hooks) }}\n\n    {% do unset_query_tag(query_tag) %}\n\n    {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.load_cached_relation", "macro.dbt.run_hooks", "macro.dbt_snowflake.dynamic_table_get_build_sql", "macro.dbt_snowflake.dynamic_table_execute_no_op", "macro.dbt_snowflake.dynamic_table_execute_build_sql", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.96301, "supported_languages": ["sql"]}, "macro.dbt_snowflake.dynamic_table_get_build_sql": {"name": "dynamic_table_get_build_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.dynamic_table_get_build_sql", "macro_sql": "{% macro dynamic_table_get_build_sql(existing_relation, target_relation) %}\n\n    {% set full_refresh_mode = should_full_refresh() %}\n\n    -- determine the scenario we're in: create, full_refresh, alter, refresh data\n    {% if existing_relation is none %}\n        {% set build_sql = get_create_sql(target_relation, sql) %}\n    {% elif full_refresh_mode or not existing_relation.is_dynamic_table %}\n        {% set build_sql = get_replace_sql(existing_relation, target_relation, sql) %}\n    {% else %}\n\n        -- get config options\n        {% set on_configuration_change = config.get('on_configuration_change') %}\n        {% set configuration_changes = snowflake__get_dynamic_table_configuration_changes(existing_relation, config) %}\n\n        {% if configuration_changes is none %}\n            {% set build_sql = '' %}\n            {{ exceptions.warn(\"No configuration changes were identified on: `\" ~ target_relation ~ \"`. Continuing.\") }}\n\n        {% elif on_configuration_change == 'apply' %}\n            {% set build_sql = snowflake__get_alter_dynamic_table_as_sql(existing_relation, configuration_changes, target_relation, sql) %}\n        {% elif on_configuration_change == 'continue' %}\n            {% set build_sql = '' %}\n            {{ exceptions.warn(\"Configuration changes were identified and `on_configuration_change` was set to `continue` for `\" ~ target_relation ~ \"`\") }}\n        {% elif on_configuration_change == 'fail' %}\n            {{ exceptions.raise_fail_fast_error(\"Configuration changes were identified and `on_configuration_change` was set to `fail` for `\" ~ target_relation ~ \"`\") }}\n\n        {% else %}\n            -- this only happens if the user provides a value other than `apply`, 'continue', 'fail'\n            {{ exceptions.raise_compiler_error(\"Unexpected configuration scenario: `\" ~ on_configuration_change ~ \"`\") }}\n\n        {% endif %}\n\n    {% endif %}\n\n    {% do return(build_sql) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.get_create_sql", "macro.dbt.get_replace_sql", "macro.dbt_snowflake.snowflake__get_dynamic_table_configuration_changes", "macro.dbt_snowflake.snowflake__get_alter_dynamic_table_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9643772, "supported_languages": null}, "macro.dbt_snowflake.dynamic_table_execute_no_op": {"name": "dynamic_table_execute_no_op", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.dynamic_table_execute_no_op", "macro_sql": "{% macro dynamic_table_execute_no_op(relation) %}\n    {% do store_raw_result(\n        name=\"main\",\n        message=\"skip \" ~ relation,\n        code=\"skip\",\n        rows_affected=\"-1\"\n    ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9646258, "supported_languages": null}, "macro.dbt_snowflake.dynamic_table_execute_build_sql": {"name": "dynamic_table_execute_build_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.dynamic_table_execute_build_sql", "macro_sql": "{% macro dynamic_table_execute_build_sql(build_sql, existing_relation, target_relation) %}\n\n    {% set grant_config = config.get('grants') %}\n\n    {% call statement(name=\"main\") %}\n        {{ build_sql }}\n    {% endcall %}\n\n    {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n    {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n    {% do persist_docs(target_relation, model) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.96513, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_dynamic_table_configuration_changes": {"name": "snowflake__get_dynamic_table_configuration_changes", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_dynamic_table_configuration_changes", "macro_sql": "{% macro snowflake__get_dynamic_table_configuration_changes(existing_relation, new_config) -%}\n    {% set _existing_dynamic_table = snowflake__describe_dynamic_table(existing_relation) %}\n    {% set _configuration_changes = existing_relation.dynamic_table_config_changeset(_existing_dynamic_table, new_config) %}\n    {% do return(_configuration_changes) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__describe_dynamic_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9654138, "supported_languages": null}, "macro.dbt_snowflake.snowflake__can_clone_table": {"name": "snowflake__can_clone_table", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/clone.sql", "original_file_path": "macros/materializations/clone.sql", "unique_id": "macro.dbt_snowflake.snowflake__can_clone_table", "macro_sql": "{% macro snowflake__can_clone_table() %}\n    {{ return(True) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.965667, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_or_replace_clone": {"name": "snowflake__create_or_replace_clone", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/clone.sql", "original_file_path": "macros/materializations/clone.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_or_replace_clone", "macro_sql": "{% macro snowflake__create_or_replace_clone(this_relation, defer_relation) %}\n    create or replace\n      {{ \"transient\" if config.get(\"transient\", true) }}\n      table {{ this_relation }}\n      clone {{ defer_relation }}\n      {{ \"copy grants\" if config.get(\"copy_grants\", false) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.965965, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_drop_sql": {"name": "snowflake__get_drop_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_drop_sql", "macro_sql": "{% macro snowflake__get_drop_sql(relation) %}\n\n    {% if relation.is_dynamic_table %}\n        {{ snowflake__get_drop_dynamic_table_sql(relation) }}\n\n    {% else %}\n        {{ default__get_drop_sql(relation) }}\n\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_drop_dynamic_table_sql", "macro.dbt.default__get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.966285, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_replace_sql": {"name": "snowflake__get_replace_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/replace.sql", "original_file_path": "macros/relations/replace.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_replace_sql", "macro_sql": "{% macro snowflake__get_replace_sql(existing_relation, target_relation, sql) %}\n\n    {% if existing_relation.is_dynamic_table and target_relation.is_dynamic_table %}\n        {{ snowflake__get_replace_dynamic_table_sql(target_relation, sql) }}\n\n    {% else %}\n        {{ default__get_replace_sql(existing_relation, target_relation, sql) }}\n\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_replace_dynamic_table_sql", "macro.dbt.default__get_replace_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9666939, "supported_languages": null}, "macro.dbt_snowflake.snowflake__rename_relation": {"name": "snowflake__rename_relation", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt_snowflake.snowflake__rename_relation", "macro_sql": "{% macro snowflake__rename_relation(from_relation, to_relation) -%}\n  {% call statement('rename_relation') -%}\n    alter table {{ from_relation }} rename to {{ to_relation }}\n  {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.96695, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_create_sql": {"name": "snowflake__get_create_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/create.sql", "original_file_path": "macros/relations/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_create_sql", "macro_sql": "{% macro snowflake__get_create_sql(relation, sql) %}\n\n    {% if relation.is_dynamic_table %}\n        {{ snowflake__get_create_dynamic_table_as_sql(relation, sql) }}\n\n    {% else %}\n        {{ default__get_create_sql(relation, sql) }}\n\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_create_dynamic_table_as_sql", "macro.dbt.default__get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9673011, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_drop_table_sql": {"name": "snowflake__get_drop_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_drop_table_sql", "macro_sql": "{% macro snowflake__get_drop_table_sql(relation) %}\n    drop table if exists {{ relation }} cascade\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.96744, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_replace_table_sql": {"name": "snowflake__get_replace_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_replace_table_sql", "macro_sql": "{% macro snowflake__get_replace_table_sql(relation, sql) %}\n    {{ snowflake__create_table_as(False, relation, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.967633, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_rename_table_sql": {"name": "snowflake__get_rename_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_rename_table_sql", "macro_sql": "{%- macro snowflake__get_rename_table_sql(relation, new_name) -%}\n    alter table {{ relation }} rename to {{ new_name }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.967808, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_table_as": {"name": "snowflake__create_table_as", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_table_as", "macro_sql": "{% macro snowflake__create_table_as(temporary, relation, compiled_code, language='sql') -%}\n  {%- set transient = config.get('transient', default=true) -%}\n\n  {% if temporary -%}\n    {%- set table_type = \"temporary\" -%}\n  {%- elif transient -%}\n    {%- set table_type = \"transient\" -%}\n  {%- else -%}\n    {%- set table_type = \"\" -%}\n  {%- endif %}\n\n  {%- if language == 'sql' -%}\n    {%- set cluster_by_keys = config.get('cluster_by', default=none) -%}\n    {%- set enable_automatic_clustering = config.get('automatic_clustering', default=false) -%}\n    {%- set copy_grants = config.get('copy_grants', default=false) -%}\n\n    {%- if cluster_by_keys is not none and cluster_by_keys is string -%}\n      {%- set cluster_by_keys = [cluster_by_keys] -%}\n    {%- endif -%}\n    {%- if cluster_by_keys is not none -%}\n      {%- set cluster_by_string = cluster_by_keys|join(\", \")-%}\n    {% else %}\n      {%- set cluster_by_string = none -%}\n    {%- endif -%}\n    {%- set sql_header = config.get('sql_header', none) -%}\n\n    {{ sql_header if sql_header is not none }}\n\n        create or replace {{ table_type }} table {{ relation }}\n        {%- set contract_config = config.get('contract') -%}\n        {%- if contract_config.enforced -%}\n          {{ get_assert_columns_equivalent(sql) }}\n          {{ get_table_columns_and_constraints() }}\n          {% set compiled_code = get_select_subquery(compiled_code) %}\n        {% endif %}\n        {% if copy_grants and not temporary -%} copy grants {%- endif %} as\n        (\n          {%- if cluster_by_string is not none -%}\n            select * from (\n              {{ compiled_code }}\n              ) order by ({{ cluster_by_string }})\n          {%- else -%}\n            {{ compiled_code }}\n          {%- endif %}\n        );\n      {% if cluster_by_string is not none and not temporary -%}\n        alter table {{relation}} cluster by ({{cluster_by_string}});\n      {%- endif -%}\n      {% if enable_automatic_clustering and cluster_by_string is not none and not temporary  -%}\n        alter table {{relation}} resume recluster;\n      {%- endif -%}\n\n  {%- elif language == 'python' -%}\n    {{ py_write_table(compiled_code=compiled_code, target_relation=relation, table_type=table_type) }}\n  {%- else -%}\n      {% do exceptions.raise_compiler_error(\"snowflake__create_table_as macro didn't get supported language, it got %s\" % language) %}\n  {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent", "macro.dbt.get_table_columns_and_constraints", "macro.dbt.get_select_subquery", "macro.dbt_snowflake.py_write_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.971835, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_drop_view_sql": {"name": "snowflake__get_drop_view_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_drop_view_sql", "macro_sql": "{% macro snowflake__get_drop_view_sql(relation) %}\n    drop view if exists {{ relation }} cascade\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.971993, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_replace_view_sql": {"name": "snowflake__get_replace_view_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_replace_view_sql", "macro_sql": "{% macro snowflake__get_replace_view_sql(relation, sql) %}\n    {{ snowflake__create_view_as(relation, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.972179, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_rename_view_sql": {"name": "snowflake__get_rename_view_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_rename_view_sql", "macro_sql": "{%- macro snowflake__get_rename_view_sql(relation, new_name) -%}\n    alter view {{ relation }} rename to {{ new_name }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.972351, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_view_as_with_temp_flag": {"name": "snowflake__create_view_as_with_temp_flag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_view_as_with_temp_flag", "macro_sql": "{% macro snowflake__create_view_as_with_temp_flag(relation, sql, is_temporary=False) -%}\n  {%- set secure = config.get('secure', default=false) -%}\n  {%- set copy_grants = config.get('copy_grants', default=false) -%}\n  {%- set sql_header = config.get('sql_header', none) -%}\n\n  {{ sql_header if sql_header is not none }}\n  create or replace {% if secure -%}\n    secure\n  {%- endif %} {% if is_temporary -%}\n    temporary\n  {%- endif %} view {{ relation }}\n  {% if config.persist_column_docs() -%}\n    {% set model_columns = model.columns %}\n    {% set query_columns = get_columns_in_query(sql) %}\n    {{ get_persist_docs_column_list(model_columns, query_columns) }}\n\n  {%- endif %}\n  {%- set contract_config = config.get('contract') -%}\n  {%- if contract_config.enforced -%}\n    {{ get_assert_columns_equivalent(sql) }}\n  {%- endif %}\n  {% if copy_grants -%} copy grants {%- endif %} as (\n    {{ sql }}\n  );\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_columns_in_query", "macro.dbt_snowflake.get_persist_docs_column_list", "macro.dbt.get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.974127, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_view_as": {"name": "snowflake__create_view_as", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_view_as", "macro_sql": "{% macro snowflake__create_view_as(relation, sql) -%}\n  {{ snowflake__create_view_as_with_temp_flag(relation, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_view_as_with_temp_flag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.974282, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_or_replace_view": {"name": "snowflake__create_or_replace_view", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_or_replace_view", "macro_sql": "{% macro snowflake__create_or_replace_view() %}\n  {%- set identifier = model['alias'] -%}\n\n  {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n  {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n  {%- set target_relation = api.Relation.create(\n      identifier=identifier, schema=schema, database=database,\n      type='view') -%}\n  {% set grant_config = config.get('grants') %}\n\n  {{ run_hooks(pre_hooks) }}\n\n  -- If there's a table with the same name and we weren't told to full refresh,\n  -- that's an error. If we were told to full refresh, drop it. This behavior differs\n  -- for Snowflake and BigQuery, so multiple dispatch is used.\n  {%- if old_relation is not none and not old_relation.is_view -%}\n    {{ handle_existing_table(should_full_refresh(), old_relation) }}\n  {%- endif -%}\n\n  -- build model\n  {% call statement('main') -%}\n    {{ get_create_view_as_sql(target_relation, sql) }}\n  {%- endcall %}\n\n  {% set should_revoke = should_revoke(exists_as_view, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {{ run_hooks(post_hooks) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9754329, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_drop_dynamic_table_sql": {"name": "snowflake__get_drop_dynamic_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/drop.sql", "original_file_path": "macros/relations/dynamic_table/drop.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_drop_dynamic_table_sql", "macro_sql": "{% macro snowflake__get_drop_dynamic_table_sql(relation) %}\n    drop dynamic table if exists {{ relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.975583, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_replace_dynamic_table_sql": {"name": "snowflake__get_replace_dynamic_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/replace.sql", "original_file_path": "macros/relations/dynamic_table/replace.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_replace_dynamic_table_sql", "macro_sql": "{% macro snowflake__get_replace_dynamic_table_sql(relation, sql) %}\n\n    create or replace dynamic table {{ relation }}\n        target_lag = '{{ config.get(\"target_lag\") }}'\n        warehouse = {{ config.get(\"snowflake_warehouse\") }}\n        as (\n            {{ sql }}\n        )\n    ;\n    {{ snowflake__refresh_dynamic_table(relation) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__refresh_dynamic_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.975978, "supported_languages": null}, "macro.dbt_snowflake.snowflake__describe_dynamic_table": {"name": "snowflake__describe_dynamic_table", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/describe.sql", "original_file_path": "macros/relations/dynamic_table/describe.sql", "unique_id": "macro.dbt_snowflake.snowflake__describe_dynamic_table", "macro_sql": "{% macro snowflake__describe_dynamic_table(relation) %}\n    {%- set _dynamic_table_sql -%}\n        show dynamic tables\n            like '{{ relation.identifier }}'\n            in schema {{ relation.database }}.{{ relation.schema }}\n        ;\n        select\n            \"name\",\n            \"schema_name\",\n            \"database_name\",\n            \"text\",\n            \"target_lag\",\n            \"warehouse\"\n        from table(result_scan(last_query_id()))\n    {%- endset %}\n    {% set _dynamic_table = run_query(_dynamic_table_sql) %}\n\n    {% do return({'dynamic_table': _dynamic_table}) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.976545, "supported_languages": null}, "macro.dbt_snowflake.snowflake__refresh_dynamic_table": {"name": "snowflake__refresh_dynamic_table", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/refresh.sql", "original_file_path": "macros/relations/dynamic_table/refresh.sql", "unique_id": "macro.dbt_snowflake.snowflake__refresh_dynamic_table", "macro_sql": "{% macro snowflake__refresh_dynamic_table(relation) -%}\n    {{- log('Applying REFRESH to: ' ~ relation) -}}\n\n    alter dynamic table {{ relation }} refresh\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9767601, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_alter_dynamic_table_as_sql": {"name": "snowflake__get_alter_dynamic_table_as_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/alter.sql", "original_file_path": "macros/relations/dynamic_table/alter.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_alter_dynamic_table_as_sql", "macro_sql": "{% macro snowflake__get_alter_dynamic_table_as_sql(\n    existing_relation,\n    configuration_changes,\n    target_relation,\n    sql\n) -%}\n    {{- log('Applying ALTER to: ' ~ existing_relation) -}}\n\n    {% if configuration_changes.requires_full_refresh %}\n        {{- get_replace_sql(existing_relation, target_relation, sql) -}}\n\n    {% else %}\n\n        {%- set target_lag = configuration_changes.target_lag -%}\n        {%- if target_lag -%}{{- log('Applying UPDATE TARGET_LAG to: ' ~ existing_relation) -}}{%- endif -%}\n        {%- set snowflake_warehouse = configuration_changes.snowflake_warehouse -%}\n        {%- if snowflake_warehouse -%}{{- log('Applying UPDATE WAREHOUSE to: ' ~ existing_relation) -}}{%- endif -%}\n\n        alter dynamic table {{ existing_relation }} set\n            {% if target_lag %}target_lag = '{{ target_lag.context }}'{% endif %}\n            {% if snowflake_warehouse %}warehouse = {{ snowflake_warehouse.context }}{% endif %}\n\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_replace_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.977841, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_create_dynamic_table_as_sql": {"name": "snowflake__get_create_dynamic_table_as_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/create.sql", "original_file_path": "macros/relations/dynamic_table/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_create_dynamic_table_as_sql", "macro_sql": "{% macro snowflake__get_create_dynamic_table_as_sql(relation, sql) -%}\n\n    create dynamic table {{ relation }}\n        target_lag = '{{ config.get(\"target_lag\") }}'\n        warehouse = {{ config.get(\"snowflake_warehouse\") }}\n        as (\n            {{ sql }}\n        )\n    ;\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9781818, "supported_languages": null}, "macro.dbt_snowflake.snowflake__current_timestamp": {"name": "snowflake__current_timestamp", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__current_timestamp", "macro_sql": "{% macro snowflake__current_timestamp() -%}\n  convert_timezone('UTC', current_timestamp())\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9784682, "supported_languages": null}, "macro.dbt_snowflake.snowflake__snapshot_string_as_time": {"name": "snowflake__snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__snapshot_string_as_time", "macro_sql": "{% macro snowflake__snapshot_string_as_time(timestamp) -%}\n  {%- set result = \"to_timestamp_ntz('\" ~ timestamp ~ \"')\" -%}\n  {{ return(result) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9786491, "supported_languages": null}, "macro.dbt_snowflake.snowflake__snapshot_get_time": {"name": "snowflake__snapshot_get_time", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__snapshot_get_time", "macro_sql": "{% macro snowflake__snapshot_get_time() -%}\n  to_timestamp_ntz({{ current_timestamp() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.97876, "supported_languages": null}, "macro.dbt_snowflake.snowflake__current_timestamp_backcompat": {"name": "snowflake__current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__current_timestamp_backcompat", "macro_sql": "{% macro snowflake__current_timestamp_backcompat() %}\n  current_timestamp::{{ type_timestamp() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.978868, "supported_languages": null}, "macro.dbt_snowflake.snowflake__current_timestamp_in_utc_backcompat": {"name": "snowflake__current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__current_timestamp_in_utc_backcompat", "macro_sql": "{% macro snowflake__current_timestamp_in_utc_backcompat() %}\n  convert_timezone('UTC', {{ snowflake__current_timestamp_backcompat() }})::{{ type_timestamp() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__current_timestamp_backcompat", "macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.979011, "supported_languages": null}, "macro.dbt_snowflake.snowflake__escape_single_quotes": {"name": "snowflake__escape_single_quotes", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt_snowflake.snowflake__escape_single_quotes", "macro_sql": "{% macro snowflake__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\", \"\\\\'\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.979202, "supported_languages": null}, "macro.dbt_snowflake.snowflake__right": {"name": "snowflake__right", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt_snowflake.snowflake__right", "macro_sql": "{% macro snowflake__right(string_text, length_expression) %}\n\n    case when {{ length_expression }} = 0\n        then ''\n    else\n        right(\n            {{ string_text }},\n            {{ length_expression }}\n        )\n    end\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.979448, "supported_languages": null}, "macro.dbt_snowflake.snowflake__safe_cast": {"name": "snowflake__safe_cast", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt_snowflake.snowflake__safe_cast", "macro_sql": "{% macro snowflake__safe_cast(field, type) %}\n    try_cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9796212, "supported_languages": null}, "macro.dbt_snowflake.snowflake__bool_or": {"name": "snowflake__bool_or", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt_snowflake.snowflake__bool_or", "macro_sql": "{% macro snowflake__bool_or(expression) -%}\n\n    boolor_agg({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9798179, "supported_languages": null}, "macro.dbt_snowflake.snowflake__array_construct": {"name": "snowflake__array_construct", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt_snowflake.snowflake__array_construct", "macro_sql": "{% macro snowflake__array_construct(inputs, data_type) -%}\n    array_construct( {{ inputs|join(' , ') }} )\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.98, "supported_languages": null}, "macro.dbt.run_hooks": {"name": "run_hooks", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.run_hooks", "macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n  {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction)  %}\n    {% if not inside_transaction and loop.first %}\n      {% call statement(auto_begin=inside_transaction) %}\n        commit;\n      {% endcall %}\n    {% endif %}\n    {% set rendered = render(hook.get('sql')) | trim %}\n    {% if (rendered | length) > 0 %}\n      {% call statement(auto_begin=inside_transaction) %}\n        {{ rendered }}\n      {% endcall %}\n    {% endif %}\n  {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.981099, "supported_languages": null}, "macro.dbt.make_hook_config": {"name": "make_hook_config", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.make_hook_config", "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n    {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9813042, "supported_languages": null}, "macro.dbt.before_begin": {"name": "before_begin", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.before_begin", "macro_sql": "{% macro before_begin(sql) %}\n    {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9814541, "supported_languages": null}, "macro.dbt.in_transaction": {"name": "in_transaction", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.in_transaction", "macro_sql": "{% macro in_transaction(sql) %}\n    {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.981596, "supported_languages": null}, "macro.dbt.after_commit": {"name": "after_commit", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.after_commit", "macro_sql": "{% macro after_commit(sql) %}\n    {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.98174, "supported_languages": null}, "macro.dbt.set_sql_header": {"name": "set_sql_header", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.set_sql_header", "macro_sql": "{% macro set_sql_header(config) -%}\n  {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.982111, "supported_languages": null}, "macro.dbt.should_full_refresh": {"name": "should_full_refresh", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.should_full_refresh", "macro_sql": "{% macro should_full_refresh() %}\n  {% set config_full_refresh = config.get('full_refresh') %}\n  {% if config_full_refresh is none %}\n    {% set config_full_refresh = flags.FULL_REFRESH %}\n  {% endif %}\n  {% do return(config_full_refresh) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.982419, "supported_languages": null}, "macro.dbt.should_store_failures": {"name": "should_store_failures", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.should_store_failures", "macro_sql": "{% macro should_store_failures() %}\n  {% set config_store_failures = config.get('store_failures') %}\n  {% if config_store_failures is none %}\n    {% set config_store_failures = flags.STORE_FAILURES %}\n  {% endif %}\n  {% do return(config_store_failures) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9827268, "supported_languages": null}, "macro.dbt.snapshot_merge_sql": {"name": "snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "unique_id": "macro.dbt.snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n  {{ adapter.dispatch('snapshot_merge_sql', 'dbt')(target, source, insert_cols) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__snapshot_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.983171, "supported_languages": null}, "macro.dbt.default__snapshot_merge_sql": {"name": "default__snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "unique_id": "macro.dbt.default__snapshot_merge_sql", "macro_sql": "{% macro default__snapshot_merge_sql(target, source, insert_cols) -%}\n    {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n    merge into {{ target }} as DBT_INTERNAL_DEST\n    using {{ source }} as DBT_INTERNAL_SOURCE\n    on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id\n\n    when matched\n     and DBT_INTERNAL_DEST.dbt_valid_to is null\n     and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n        then update\n        set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n\n    when not matched\n     and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'\n        then insert ({{ insert_cols_csv }})\n        values ({{ insert_cols_csv }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9834502, "supported_languages": null}, "macro.dbt.strategy_dispatch": {"name": "strategy_dispatch", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.strategy_dispatch", "macro_sql": "{% macro strategy_dispatch(name) -%}\n{% set original_name = name %}\n  {% if '.' in name %}\n    {% set package_name, name = name.split(\".\", 1) %}\n  {% else %}\n    {% set package_name = none %}\n  {% endif %}\n\n  {% if package_name is none %}\n    {% set package_context = context %}\n  {% elif package_name in context %}\n    {% set package_context = context[package_name] %}\n  {% else %}\n    {% set error_msg %}\n        Could not find package '{{package_name}}', called with '{{original_name}}'\n    {% endset %}\n    {{ exceptions.raise_compiler_error(error_msg | trim) }}\n  {% endif %}\n\n  {%- set search_name = 'snapshot_' ~ name ~ '_strategy' -%}\n\n  {% if search_name not in package_context %}\n    {% set error_msg %}\n        The specified strategy macro '{{name}}' was not found in package '{{ package_name }}'\n    {% endset %}\n    {{ exceptions.raise_compiler_error(error_msg | trim) }}\n  {% endif %}\n  {{ return(package_context[search_name]) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9870012, "supported_languages": null}, "macro.dbt.snapshot_hash_arguments": {"name": "snapshot_hash_arguments", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n  {{ adapter.dispatch('snapshot_hash_arguments', 'dbt')(args) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.987173, "supported_languages": null}, "macro.dbt.default__snapshot_hash_arguments": {"name": "default__snapshot_hash_arguments", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.default__snapshot_hash_arguments", "macro_sql": "{% macro default__snapshot_hash_arguments(args) -%}\n    md5({%- for arg in args -%}\n        coalesce(cast({{ arg }} as varchar ), '')\n        {% if not loop.last %} || '|' || {% endif %}\n    {%- endfor -%})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.987395, "supported_languages": null}, "macro.dbt.snapshot_timestamp_strategy": {"name": "snapshot_timestamp_strategy", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_timestamp_strategy", "macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n    {% set primary_key = config['unique_key'] %}\n    {% set updated_at = config['updated_at'] %}\n    {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n\n    {#/*\n        The snapshot relation might not have an {{ updated_at }} value if the\n        snapshot strategy is changed from `check` to `timestamp`. We\n        should use a dbt-created column for the comparison in the snapshot\n        table instead of assuming that the user-supplied {{ updated_at }}\n        will be present in the historical data.\n\n        See https://github.com/dbt-labs/dbt-core/issues/2350\n    */ #}\n    {% set row_changed_expr -%}\n        ({{ snapshotted_rel }}.dbt_valid_from < {{ current_rel }}.{{ updated_at }})\n    {%- endset %}\n\n    {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n    {% do return({\n        \"unique_key\": primary_key,\n        \"updated_at\": updated_at,\n        \"row_changed\": row_changed_expr,\n        \"scd_id\": scd_id_expr,\n        \"invalidate_hard_deletes\": invalidate_hard_deletes\n    }) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.988191, "supported_languages": null}, "macro.dbt.snapshot_string_as_time": {"name": "snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n    {{ adapter.dispatch('snapshot_string_as_time', 'dbt')(timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__snapshot_string_as_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.988362, "supported_languages": null}, "macro.dbt.default__snapshot_string_as_time": {"name": "default__snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.default__snapshot_string_as_time", "macro_sql": "{% macro default__snapshot_string_as_time(timestamp) %}\n    {% do exceptions.raise_not_implemented(\n        'snapshot_string_as_time macro not implemented for adapter '+adapter.type()\n    ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.988538, "supported_languages": null}, "macro.dbt.snapshot_check_all_get_existing_columns": {"name": "snapshot_check_all_get_existing_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists, check_cols_config) -%}\n    {%- if not target_exists -%}\n        {#-- no table yet -> return whatever the query does --#}\n        {{ return((false, query_columns)) }}\n    {%- endif -%}\n\n    {#-- handle any schema changes --#}\n    {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=node.alias) -%}\n\n    {% if check_cols_config == 'all' %}\n        {%- set query_columns = get_columns_in_query(node['compiled_code']) -%}\n\n    {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n        {#-- query for proper casing/quoting, to support comparison below --#}\n        {%- set select_check_cols_from_target -%}\n            {#-- N.B. The whitespace below is necessary to avoid edge case issue with comments --#}\n            {#-- See: https://github.com/dbt-labs/dbt-core/issues/6781 --#}\n            select {{ check_cols_config | join(', ') }} from (\n                {{ node['compiled_code'] }}\n            ) subq\n        {%- endset -%}\n        {% set query_columns = get_columns_in_query(select_check_cols_from_target) %}\n\n    {% else %}\n        {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n    {% endif %}\n\n    {%- set existing_cols = adapter.get_columns_in_relation(target_relation) | map(attribute = 'name') | list -%}\n    {%- set ns = namespace() -%} {#-- handle for-loop scoping with a namespace --#}\n    {%- set ns.column_added = false -%}\n\n    {%- set intersection = [] -%}\n    {%- for col in query_columns -%}\n        {%- if col in existing_cols -%}\n            {%- do intersection.append(adapter.quote(col)) -%}\n        {%- else -%}\n            {% set ns.column_added = true %}\n        {%- endif -%}\n    {%- endfor -%}\n    {{ return((ns.column_added, intersection)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.98998, "supported_languages": null}, "macro.dbt.snapshot_check_strategy": {"name": "snapshot_check_strategy", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_check_strategy", "macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n    {% set check_cols_config = config['check_cols'] %}\n    {% set primary_key = config['unique_key'] %}\n    {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n    {% set updated_at = config.get('updated_at', snapshot_get_time()) %}\n\n    {% set column_added = false %}\n\n    {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists, check_cols_config) %}\n\n    {%- set row_changed_expr -%}\n    (\n    {%- if column_added -%}\n        {{ get_true_sql() }}\n    {%- else -%}\n    {%- for col in check_cols -%}\n        {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }}\n        or\n        (\n            (({{ snapshotted_rel }}.{{ col }} is null) and not ({{ current_rel }}.{{ col }} is null))\n            or\n            ((not {{ snapshotted_rel }}.{{ col }} is null) and ({{ current_rel }}.{{ col }} is null))\n        )\n        {%- if not loop.last %} or {% endif -%}\n    {%- endfor -%}\n    {%- endif -%}\n    )\n    {%- endset %}\n\n    {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n    {% do return({\n        \"unique_key\": primary_key,\n        \"updated_at\": updated_at,\n        \"row_changed\": row_changed_expr,\n        \"scd_id\": scd_id_expr,\n        \"invalidate_hard_deletes\": invalidate_hard_deletes\n    }) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.snapshot_get_time", "macro.dbt.snapshot_check_all_get_existing_columns", "macro.dbt.get_true_sql", "macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.991317, "supported_languages": null}, "macro.dbt.create_columns": {"name": "create_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n  {{ adapter.dispatch('create_columns', 'dbt')(relation, columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.995445, "supported_languages": null}, "macro.dbt.default__create_columns": {"name": "default__create_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__create_columns", "macro_sql": "{% macro default__create_columns(relation, columns) %}\n  {% for column in columns %}\n    {% call statement() %}\n      alter table {{ relation }} add column \"{{ column.name }}\" {{ column.data_type }};\n    {% endcall %}\n  {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.995737, "supported_languages": null}, "macro.dbt.post_snapshot": {"name": "post_snapshot", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n  {{ adapter.dispatch('post_snapshot', 'dbt')(staging_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9959092, "supported_languages": null}, "macro.dbt.default__post_snapshot": {"name": "default__post_snapshot", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__post_snapshot", "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n    {# no-op #}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.995997, "supported_languages": null}, "macro.dbt.get_true_sql": {"name": "get_true_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.get_true_sql", "macro_sql": "{% macro get_true_sql() %}\n  {{ adapter.dispatch('get_true_sql', 'dbt')() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_true_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.996145, "supported_languages": null}, "macro.dbt.default__get_true_sql": {"name": "default__get_true_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__get_true_sql", "macro_sql": "{% macro default__get_true_sql() %}\n    {{ return('TRUE') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9962611, "supported_languages": null}, "macro.dbt.snapshot_staging_table": {"name": "snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.snapshot_staging_table", "macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n  {{ adapter.dispatch('snapshot_staging_table', 'dbt')(strategy, source_sql, target_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__snapshot_staging_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.996473, "supported_languages": null}, "macro.dbt.default__snapshot_staging_table": {"name": "default__snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__snapshot_staging_table", "macro_sql": "{% macro default__snapshot_staging_table(strategy, source_sql, target_relation) -%}\n\n    with snapshot_query as (\n\n        {{ source_sql }}\n\n    ),\n\n    snapshotted_data as (\n\n        select *,\n            {{ strategy.unique_key }} as dbt_unique_key\n\n        from {{ target_relation }}\n        where dbt_valid_to is null\n\n    ),\n\n    insertions_source_data as (\n\n        select\n            *,\n            {{ strategy.unique_key }} as dbt_unique_key,\n            {{ strategy.updated_at }} as dbt_updated_at,\n            {{ strategy.updated_at }} as dbt_valid_from,\n            nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,\n            {{ strategy.scd_id }} as dbt_scd_id\n\n        from snapshot_query\n    ),\n\n    updates_source_data as (\n\n        select\n            *,\n            {{ strategy.unique_key }} as dbt_unique_key,\n            {{ strategy.updated_at }} as dbt_updated_at,\n            {{ strategy.updated_at }} as dbt_valid_from,\n            {{ strategy.updated_at }} as dbt_valid_to\n\n        from snapshot_query\n    ),\n\n    {%- if strategy.invalidate_hard_deletes %}\n\n    deletes_source_data as (\n\n        select\n            *,\n            {{ strategy.unique_key }} as dbt_unique_key\n        from snapshot_query\n    ),\n    {% endif %}\n\n    insertions as (\n\n        select\n            'insert' as dbt_change_type,\n            source_data.*\n\n        from insertions_source_data as source_data\n        left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n        where snapshotted_data.dbt_unique_key is null\n           or (\n                snapshotted_data.dbt_unique_key is not null\n            and (\n                {{ strategy.row_changed }}\n            )\n        )\n\n    ),\n\n    updates as (\n\n        select\n            'update' as dbt_change_type,\n            source_data.*,\n            snapshotted_data.dbt_scd_id\n\n        from updates_source_data as source_data\n        join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n        where (\n            {{ strategy.row_changed }}\n        )\n    )\n\n    {%- if strategy.invalidate_hard_deletes -%}\n    ,\n\n    deletes as (\n\n        select\n            'delete' as dbt_change_type,\n            source_data.*,\n            {{ snapshot_get_time() }} as dbt_valid_from,\n            {{ snapshot_get_time() }} as dbt_updated_at,\n            {{ snapshot_get_time() }} as dbt_valid_to,\n            snapshotted_data.dbt_scd_id\n\n        from snapshotted_data\n        left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n        where source_data.dbt_unique_key is null\n    )\n    {%- endif %}\n\n    select * from insertions\n    union all\n    select * from updates\n    {%- if strategy.invalidate_hard_deletes %}\n    union all\n    select * from deletes\n    {%- endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.997372, "supported_languages": null}, "macro.dbt.build_snapshot_table": {"name": "build_snapshot_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.build_snapshot_table", "macro_sql": "{% macro build_snapshot_table(strategy, sql) -%}\n  {{ adapter.dispatch('build_snapshot_table', 'dbt')(strategy, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__build_snapshot_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9975638, "supported_languages": null}, "macro.dbt.default__build_snapshot_table": {"name": "default__build_snapshot_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__build_snapshot_table", "macro_sql": "{% macro default__build_snapshot_table(strategy, sql) %}\n\n    select *,\n        {{ strategy.scd_id }} as dbt_scd_id,\n        {{ strategy.updated_at }} as dbt_updated_at,\n        {{ strategy.updated_at }} as dbt_valid_from,\n        nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to\n    from (\n        {{ sql }}\n    ) sbq\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.997825, "supported_languages": null}, "macro.dbt.build_snapshot_staging_table": {"name": "build_snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n    {% set temp_relation = make_temp_relation(target_relation) %}\n\n    {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n    {% call statement('build_snapshot_staging_relation') %}\n        {{ create_table_as(True, temp_relation, select) }}\n    {% endcall %}\n\n    {% do return(temp_relation) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_temp_relation", "macro.dbt.snapshot_staging_table", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9982579, "supported_languages": null}, "macro.dbt.materialization_snapshot_default": {"name": "materialization_snapshot_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot.sql", "original_file_path": "macros/materializations/snapshots/snapshot.sql", "unique_id": "macro.dbt.materialization_snapshot_default", "macro_sql": "{% materialization snapshot, default %}\n  {%- set config = model['config'] -%}\n\n  {%- set target_table = model.get('alias', model.get('name')) -%}\n\n  {%- set strategy_name = config.get('strategy') -%}\n  {%- set unique_key = config.get('unique_key') %}\n  -- grab current tables grants config for comparision later on\n  {%- set grant_config = config.get('grants') -%}\n\n  {% set target_relation_exists, target_relation = get_or_create_relation(\n          database=model.database,\n          schema=model.schema,\n          identifier=target_table,\n          type='table') -%}\n\n  {%- if not target_relation.is_table -%}\n    {% do exceptions.relation_wrong_type(target_relation, 'table') %}\n  {%- endif -%}\n\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  {% set strategy_macro = strategy_dispatch(strategy_name) %}\n  {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", config, target_relation_exists) %}\n\n  {% if not target_relation_exists %}\n\n      {% set build_sql = build_snapshot_table(strategy, model['compiled_code']) %}\n      {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n  {% else %}\n\n      {{ adapter.valid_snapshot_target(target_relation) }}\n\n      {% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}\n\n      -- this may no-op if the database does not require column expansion\n      {% do adapter.expand_target_column_types(from_relation=staging_table,\n                                               to_relation=target_relation) %}\n\n      {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n                                   | rejectattr('name', 'equalto', 'dbt_change_type')\n                                   | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n                                   | rejectattr('name', 'equalto', 'dbt_unique_key')\n                                   | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n                                   | list %}\n\n      {% do create_columns(target_relation, missing_columns) %}\n\n      {% set source_columns = adapter.get_columns_in_relation(staging_table)\n                                   | rejectattr('name', 'equalto', 'dbt_change_type')\n                                   | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n                                   | rejectattr('name', 'equalto', 'dbt_unique_key')\n                                   | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n                                   | list %}\n\n      {% set quoted_source_columns = [] %}\n      {% for column in source_columns %}\n        {% do quoted_source_columns.append(adapter.quote(column.name)) %}\n      {% endfor %}\n\n      {% set final_sql = snapshot_merge_sql(\n            target = target_relation,\n            source = staging_table,\n            insert_cols = quoted_source_columns\n         )\n      %}\n\n  {% endif %}\n\n  {% call statement('main') %}\n      {{ final_sql }}\n  {% endcall %}\n\n  {% set should_revoke = should_revoke(target_relation_exists, full_refresh_mode=False) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {% if not target_relation_exists %}\n    {% do create_indexes(target_relation) %}\n  {% endif %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  {{ adapter.commit() }}\n\n  {% if staging_table is defined %}\n      {% do post_snapshot(staging_table) %}\n  {% endif %}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.get_or_create_relation", "macro.dbt.run_hooks", "macro.dbt.strategy_dispatch", "macro.dbt.build_snapshot_table", "macro.dbt.create_table_as", "macro.dbt.build_snapshot_staging_table", "macro.dbt.create_columns", "macro.dbt.snapshot_merge_sql", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes", "macro.dbt.post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.004441, "supported_languages": ["sql"]}, "macro.dbt.materialization_test_default": {"name": "materialization_test_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/test.sql", "original_file_path": "macros/materializations/tests/test.sql", "unique_id": "macro.dbt.materialization_test_default", "macro_sql": "{%- materialization test, default -%}\n\n  {% set relations = [] %}\n\n  {% if should_store_failures() %}\n\n    {% set identifier = model['alias'] %}\n    {% set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n    {% set store_failures_as = config.get('store_failures_as') %}\n    -- if `--store-failures` is invoked via command line and `store_failures_as` is not set,\n    -- config.get('store_failures_as', 'table') returns None, not 'table'\n    {% if store_failures_as == none %}{% set store_failures_as = 'table' %}{% endif %}\n    {% if store_failures_as not in ['table', 'view'] %}\n        {{ exceptions.raise_compiler_error(\n            \"'\" ~ store_failures_as ~ \"' is not a valid value for `store_failures_as`. \"\n            \"Accepted values are: ['ephemeral', 'table', 'view']\"\n        ) }}\n    {% endif %}\n\n    {% set target_relation = api.Relation.create(\n        identifier=identifier, schema=schema, database=database, type=store_failures_as) -%} %}\n\n    {% if old_relation %}\n        {% do adapter.drop_relation(old_relation) %}\n    {% endif %}\n\n    {% call statement(auto_begin=True) %}\n        {{ get_create_sql(target_relation, sql) }}\n    {% endcall %}\n\n    {% do relations.append(target_relation) %}\n\n    {% set main_sql %}\n        select *\n        from {{ target_relation }}\n    {% endset %}\n\n    {{ adapter.commit() }}\n\n  {% else %}\n\n      {% set main_sql = sql %}\n\n  {% endif %}\n\n  {% set limit = config.get('limit') %}\n  {% set fail_calc = config.get('fail_calc') %}\n  {% set warn_if = config.get('warn_if') %}\n  {% set error_if = config.get('error_if') %}\n\n  {% call statement('main', fetch_result=True) -%}\n\n    {{ get_test_sql(main_sql, fail_calc, warn_if, error_if, limit)}}\n\n  {%- endcall %}\n\n  {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.should_store_failures", "macro.dbt.statement", "macro.dbt.get_create_sql", "macro.dbt.get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.007191, "supported_languages": ["sql"]}, "macro.dbt.get_test_sql": {"name": "get_test_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "unique_id": "macro.dbt.get_test_sql", "macro_sql": "{% macro get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n  {{ adapter.dispatch('get_test_sql', 'dbt')(main_sql, fail_calc, warn_if, error_if, limit) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.007652, "supported_languages": null}, "macro.dbt.default__get_test_sql": {"name": "default__get_test_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "unique_id": "macro.dbt.default__get_test_sql", "macro_sql": "{% macro default__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n    select\n      {{ fail_calc }} as failures,\n      {{ fail_calc }} {{ warn_if }} as should_warn,\n      {{ fail_calc }} {{ error_if }} as should_error\n    from (\n      {{ main_sql }}\n      {{ \"limit \" ~ limit if limit != none }}\n    ) dbt_internal_test\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.007967, "supported_languages": null}, "macro.dbt.get_where_subquery": {"name": "get_where_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "unique_id": "macro.dbt.get_where_subquery", "macro_sql": "{% macro get_where_subquery(relation) -%}\n    {% do return(adapter.dispatch('get_where_subquery', 'dbt')(relation)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_where_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.008341, "supported_languages": null}, "macro.dbt.default__get_where_subquery": {"name": "default__get_where_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "unique_id": "macro.dbt.default__get_where_subquery", "macro_sql": "{% macro default__get_where_subquery(relation) -%}\n    {% set where = config.get('where', '') %}\n    {% if where %}\n        {%- set filtered -%}\n            (select * from {{ relation }} where {{ where }}) dbt_subquery\n        {%- endset -%}\n        {% do return(filtered) %}\n    {%- else -%}\n        {% do return(relation) %}\n    {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0087218, "supported_languages": null}, "macro.dbt.materialization_materialized_view_default": {"name": "materialization_materialized_view_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialization_materialized_view_default", "macro_sql": "{% materialization materialized_view, default %}\n    {% set existing_relation = load_cached_relation(this) %}\n    {% set target_relation = this.incorporate(type=this.MaterializedView) %}\n    {% set intermediate_relation = make_intermediate_relation(target_relation) %}\n    {% set backup_relation_type = target_relation.MaterializedView if existing_relation is none else existing_relation.type %}\n    {% set backup_relation = make_backup_relation(target_relation, backup_relation_type) %}\n\n    {{ materialized_view_setup(backup_relation, intermediate_relation, pre_hooks) }}\n\n        {% set build_sql = materialized_view_get_build_sql(existing_relation, target_relation, backup_relation, intermediate_relation) %}\n\n        {% if build_sql == '' %}\n            {{ materialized_view_execute_no_op(target_relation) }}\n        {% else %}\n            {{ materialized_view_execute_build_sql(build_sql, existing_relation, target_relation, post_hooks) }}\n        {% endif %}\n\n    {{ materialized_view_teardown(backup_relation, intermediate_relation, post_hooks) }}\n\n    {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.materialized_view_setup", "macro.dbt.materialized_view_get_build_sql", "macro.dbt.materialized_view_execute_no_op", "macro.dbt.materialized_view_execute_build_sql", "macro.dbt.materialized_view_teardown"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0136478, "supported_languages": ["sql"]}, "macro.dbt.materialized_view_setup": {"name": "materialized_view_setup", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_setup", "macro_sql": "{% macro materialized_view_setup(backup_relation, intermediate_relation, pre_hooks) %}\n\n    -- backup_relation and intermediate_relation should not already exist in the database\n    -- it's possible these exist because of a previous run that exited unexpectedly\n    {% set preexisting_backup_relation = load_cached_relation(backup_relation) %}\n    {% set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) %}\n\n    -- drop the temp relations if they exist already in the database\n    {{ drop_relation_if_exists(preexisting_backup_relation) }}\n    {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n\n    {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.014064, "supported_languages": null}, "macro.dbt.materialized_view_teardown": {"name": "materialized_view_teardown", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_teardown", "macro_sql": "{% macro materialized_view_teardown(backup_relation, intermediate_relation, post_hooks) %}\n\n    -- drop the temp relations if they exist to leave the database clean for the next run\n    {{ drop_relation_if_exists(backup_relation) }}\n    {{ drop_relation_if_exists(intermediate_relation) }}\n\n    {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.014335, "supported_languages": null}, "macro.dbt.materialized_view_get_build_sql": {"name": "materialized_view_get_build_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_get_build_sql", "macro_sql": "{% macro materialized_view_get_build_sql(existing_relation, target_relation, backup_relation, intermediate_relation) %}\n\n    {% set full_refresh_mode = should_full_refresh() %}\n\n    -- determine the scenario we're in: create, full_refresh, alter, refresh data\n    {% if existing_relation is none %}\n        {% set build_sql = get_create_materialized_view_as_sql(target_relation, sql) %}\n    {% elif full_refresh_mode or not existing_relation.is_materialized_view %}\n        {% set build_sql = get_replace_sql(existing_relation, target_relation, sql) %}\n    {% else %}\n\n        -- get config options\n        {% set on_configuration_change = config.get('on_configuration_change') %}\n        {% set configuration_changes = get_materialized_view_configuration_changes(existing_relation, config) %}\n\n        {% if configuration_changes is none %}\n            {% set build_sql = refresh_materialized_view(target_relation) %}\n\n        {% elif on_configuration_change == 'apply' %}\n            {% set build_sql = get_alter_materialized_view_as_sql(target_relation, configuration_changes, sql, existing_relation, backup_relation, intermediate_relation) %}\n        {% elif on_configuration_change == 'continue' %}\n            {% set build_sql = '' %}\n            {{ exceptions.warn(\"Configuration changes were identified and `on_configuration_change` was set to `continue` for `\" ~ target_relation ~ \"`\") }}\n        {% elif on_configuration_change == 'fail' %}\n            {{ exceptions.raise_fail_fast_error(\"Configuration changes were identified and `on_configuration_change` was set to `fail` for `\" ~ target_relation ~ \"`\") }}\n\n        {% else %}\n            -- this only happens if the user provides a value other than `apply`, 'skip', 'fail'\n            {{ exceptions.raise_compiler_error(\"Unexpected configuration scenario\") }}\n\n        {% endif %}\n\n    {% endif %}\n\n    {% do return(build_sql) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.get_create_materialized_view_as_sql", "macro.dbt.get_replace_sql", "macro.dbt.get_materialized_view_configuration_changes", "macro.dbt.refresh_materialized_view", "macro.dbt.get_alter_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.015647, "supported_languages": null}, "macro.dbt.materialized_view_execute_no_op": {"name": "materialized_view_execute_no_op", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_execute_no_op", "macro_sql": "{% macro materialized_view_execute_no_op(target_relation) %}\n    {% do store_raw_result(\n        name=\"main\",\n        message=\"skip \" ~ target_relation,\n        code=\"skip\",\n        rows_affected=\"-1\"\n    ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.015886, "supported_languages": null}, "macro.dbt.materialized_view_execute_build_sql": {"name": "materialized_view_execute_build_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_execute_build_sql", "macro_sql": "{% macro materialized_view_execute_build_sql(build_sql, existing_relation, target_relation, post_hooks) %}\n\n    -- `BEGIN` happens here:\n    {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n    {% set grant_config = config.get('grants') %}\n\n    {% call statement(name=\"main\") %}\n        {{ build_sql }}\n    {% endcall %}\n\n    {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n    {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n    {% do persist_docs(target_relation, model) %}\n\n    {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n    {{ adapter.commit() }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.016553, "supported_languages": null}, "macro.dbt.materialization_view_default": {"name": "materialization_view_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/view.sql", "original_file_path": "macros/materializations/models/view.sql", "unique_id": "macro.dbt.materialization_view_default", "macro_sql": "{%- materialization view, default -%}\n\n  {%- set existing_relation = load_cached_relation(this) -%}\n  {%- set target_relation = this.incorporate(type='view') -%}\n  {%- set intermediate_relation =  make_intermediate_relation(target_relation) -%}\n\n  -- the intermediate_relation should not already exist in the database; get_relation\n  -- will return None in that case. Otherwise, we get a relation that we can drop\n  -- later, before we try to use this name for the current operation\n  {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n  /*\n     This relation (probably) doesn't exist yet. If it does exist, it's a leftover from\n     a previous run, and we're going to try to drop it immediately. At the end of this\n     materialization, we're going to rename the \"existing_relation\" to this identifier,\n     and then we're going to drop it. In order to make sure we run the correct one of:\n       - drop view ...\n       - drop table ...\n\n     We need to set the type of this relation to be the type of the existing_relation, if it exists,\n     or else \"view\" as a sane default if it does not. Note that if the existing_relation does not\n     exist, then there is nothing to move out of the way and subsequentally drop. In that case,\n     this relation will be effectively unused.\n  */\n  {%- set backup_relation_type = 'view' if existing_relation is none else existing_relation.type -%}\n  {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n  -- as above, the backup_relation should not already exist\n  {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n  -- grab current tables grants config for comparision later on\n  {% set grant_config = config.get('grants') %}\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  -- drop the temp relations if they exist already in the database\n  {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n  {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n  -- `BEGIN` happens here:\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  -- build model\n  {% call statement('main') -%}\n    {{ get_create_view_as_sql(intermediate_relation, sql) }}\n  {%- endcall %}\n\n  -- cleanup\n  -- move the existing view out of the way\n  {% if existing_relation is not none %}\n     /* Do the equivalent of rename_if_exists. 'existing_relation' could have been dropped\n        since the variable was first set. */\n    {% set existing_relation = load_cached_relation(existing_relation) %}\n    {% if existing_relation is not none %}\n        {{ adapter.rename_relation(existing_relation, backup_relation) }}\n    {% endif %}\n  {% endif %}\n  {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n  {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  {{ adapter.commit() }}\n\n  {{ drop_relation_if_exists(backup_relation) }}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.019542, "supported_languages": ["sql"]}, "macro.dbt.materialization_table_default": {"name": "materialization_table_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/table.sql", "original_file_path": "macros/materializations/models/table.sql", "unique_id": "macro.dbt.materialization_table_default", "macro_sql": "{% materialization table, default %}\n\n  {%- set existing_relation = load_cached_relation(this) -%}\n  {%- set target_relation = this.incorporate(type='table') %}\n  {%- set intermediate_relation =  make_intermediate_relation(target_relation) -%}\n  -- the intermediate_relation should not already exist in the database; get_relation\n  -- will return None in that case. Otherwise, we get a relation that we can drop\n  -- later, before we try to use this name for the current operation\n  {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n  /*\n      See ../view/view.sql for more information about this relation.\n  */\n  {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n  {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n  -- as above, the backup_relation should not already exist\n  {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n  -- grab current tables grants config for comparision later on\n  {% set grant_config = config.get('grants') %}\n\n  -- drop the temp relations if they exist already in the database\n  {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n  {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  -- `BEGIN` happens here:\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  -- build model\n  {% call statement('main') -%}\n    {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n  {%- endcall %}\n\n  -- cleanup\n  {% if existing_relation is not none %}\n     /* Do the equivalent of rename_if_exists. 'existing_relation' could have been dropped\n        since the variable was first set. */\n    {% set existing_relation = load_cached_relation(existing_relation) %}\n    {% if existing_relation is not none %}\n        {{ adapter.rename_relation(existing_relation, backup_relation) }}\n    {% endif %}\n  {% endif %}\n\n  {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n  {% do create_indexes(target_relation) %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  -- `COMMIT` happens here\n  {{ adapter.commit() }}\n\n  -- finally, drop the existing/backup relation after the commit\n  {{ drop_relation_if_exists(backup_relation) }}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt.create_indexes", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.022434, "supported_languages": ["sql"]}, "macro.dbt.get_quoted_csv": {"name": "get_quoted_csv", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.get_quoted_csv", "macro_sql": "{% macro get_quoted_csv(column_names) %}\n\n    {% set quoted = [] %}\n    {% for col in column_names -%}\n        {%- do quoted.append(adapter.quote(col)) -%}\n    {%- endfor %}\n\n    {%- set dest_cols_csv = quoted | join(', ') -%}\n    {{ return(dest_cols_csv) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0240629, "supported_languages": null}, "macro.dbt.diff_columns": {"name": "diff_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.diff_columns", "macro_sql": "{% macro diff_columns(source_columns, target_columns) %}\n\n  {% set result = [] %}\n  {% set source_names = source_columns | map(attribute = 'column') | list %}\n  {% set target_names = target_columns | map(attribute = 'column') | list %}\n\n   {# --check whether the name attribute exists in the target - this does not perform a data type check #}\n   {% for sc in source_columns %}\n     {% if sc.name not in target_names %}\n        {{ result.append(sc) }}\n     {% endif %}\n   {% endfor %}\n\n  {{ return(result) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.024627, "supported_languages": null}, "macro.dbt.diff_column_data_types": {"name": "diff_column_data_types", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.diff_column_data_types", "macro_sql": "{% macro diff_column_data_types(source_columns, target_columns) %}\n\n  {% set result = [] %}\n  {% for sc in source_columns %}\n    {% set tc = target_columns | selectattr(\"name\", \"equalto\", sc.name) | list | first %}\n    {% if tc %}\n      {% if sc.data_type != tc.data_type and not sc.can_expand_to(other_column=tc) %}\n        {{ result.append( { 'column_name': tc.name, 'new_type': sc.data_type } ) }}\n      {% endif %}\n    {% endif %}\n  {% endfor %}\n\n  {{ return(result) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0253062, "supported_languages": null}, "macro.dbt.get_merge_update_columns": {"name": "get_merge_update_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.get_merge_update_columns", "macro_sql": "{% macro get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) %}\n  {{ return(adapter.dispatch('get_merge_update_columns', 'dbt')(merge_update_columns, merge_exclude_columns, dest_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_merge_update_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0255492, "supported_languages": null}, "macro.dbt.default__get_merge_update_columns": {"name": "default__get_merge_update_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.default__get_merge_update_columns", "macro_sql": "{% macro default__get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) %}\n  {%- set default_cols = dest_columns | map(attribute=\"quoted\") | list -%}\n\n  {%- if merge_update_columns and merge_exclude_columns -%}\n    {{ exceptions.raise_compiler_error(\n        'Model cannot specify merge_update_columns and merge_exclude_columns. Please update model to use only one config'\n    )}}\n  {%- elif merge_update_columns -%}\n    {%- set update_columns = merge_update_columns -%}\n  {%- elif merge_exclude_columns -%}\n    {%- set update_columns = [] -%}\n    {%- for column in dest_columns -%}\n      {% if column.column | lower not in merge_exclude_columns | map(\"lower\") | list %}\n        {%- do update_columns.append(column.quoted) -%}\n      {% endif %}\n    {%- endfor -%}\n  {%- else -%}\n    {%- set update_columns = default_cols -%}\n  {%- endif -%}\n\n  {{ return(update_columns) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.026272, "supported_languages": null}, "macro.dbt.get_merge_sql": {"name": "get_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_merge_sql", "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, incremental_predicates=none) -%}\n   -- back compat for old kwarg name\n  {% set incremental_predicates = kwargs.get('predicates', incremental_predicates) %}\n  {{ adapter.dispatch('get_merge_sql', 'dbt')(target, source, unique_key, dest_columns, incremental_predicates) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.032711, "supported_languages": null}, "macro.dbt.default__get_merge_sql": {"name": "default__get_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_merge_sql", "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, incremental_predicates=none) -%}\n    {%- set predicates = [] if incremental_predicates is none else [] + incremental_predicates -%}\n    {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n    {%- set merge_update_columns = config.get('merge_update_columns') -%}\n    {%- set merge_exclude_columns = config.get('merge_exclude_columns') -%}\n    {%- set update_columns = get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) -%}\n    {%- set sql_header = config.get('sql_header', none) -%}\n\n    {% if unique_key %}\n        {% if unique_key is sequence and unique_key is not mapping and unique_key is not string %}\n            {% for key in unique_key %}\n                {% set this_key_match %}\n                    DBT_INTERNAL_SOURCE.{{ key }} = DBT_INTERNAL_DEST.{{ key }}\n                {% endset %}\n                {% do predicates.append(this_key_match) %}\n            {% endfor %}\n        {% else %}\n            {% set unique_key_match %}\n                DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }}\n            {% endset %}\n            {% do predicates.append(unique_key_match) %}\n        {% endif %}\n    {% else %}\n        {% do predicates.append('FALSE') %}\n    {% endif %}\n\n    {{ sql_header if sql_header is not none }}\n\n    merge into {{ target }} as DBT_INTERNAL_DEST\n        using {{ source }} as DBT_INTERNAL_SOURCE\n        on {{\"(\" ~ predicates | join(\") and (\") ~ \")\"}}\n\n    {% if unique_key %}\n    when matched then update set\n        {% for column_name in update_columns -%}\n            {{ column_name }} = DBT_INTERNAL_SOURCE.{{ column_name }}\n            {%- if not loop.last %}, {%- endif %}\n        {%- endfor %}\n    {% endif %}\n\n    when not matched then insert\n        ({{ dest_cols_csv }})\n    values\n        ({{ dest_cols_csv }})\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv", "macro.dbt.get_merge_update_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0343401, "supported_languages": null}, "macro.dbt.get_delete_insert_merge_sql": {"name": "get_delete_insert_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_delete_insert_merge_sql", "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) -%}\n  {{ adapter.dispatch('get_delete_insert_merge_sql', 'dbt')(target, source, unique_key, dest_columns, incremental_predicates) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0346081, "supported_languages": null}, "macro.dbt.default__get_delete_insert_merge_sql": {"name": "default__get_delete_insert_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_delete_insert_merge_sql", "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) -%}\n\n    {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n    {% if unique_key %}\n        {% if unique_key is sequence and unique_key is not string %}\n            delete from {{target }}\n            using {{ source }}\n            where (\n                {% for key in unique_key %}\n                    {{ source }}.{{ key }} = {{ target }}.{{ key }}\n                    {{ \"and \" if not loop.last}}\n                {% endfor %}\n                {% if incremental_predicates %}\n                    {% for predicate in incremental_predicates %}\n                        and {{ predicate }}\n                    {% endfor %}\n                {% endif %}\n            );\n        {% else %}\n            delete from {{ target }}\n            where (\n                {{ unique_key }}) in (\n                select ({{ unique_key }})\n                from {{ source }}\n            )\n            {%- if incremental_predicates %}\n                {% for predicate in incremental_predicates %}\n                    and {{ predicate }}\n                {% endfor %}\n            {%- endif -%};\n\n        {% endif %}\n    {% endif %}\n\n    insert into {{ target }} ({{ dest_cols_csv }})\n    (\n        select {{ dest_cols_csv }}\n        from {{ source }}\n    )\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0356412, "supported_languages": null}, "macro.dbt.get_insert_overwrite_merge_sql": {"name": "get_insert_overwrite_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_insert_overwrite_merge_sql", "macro_sql": "{% macro get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header=false) -%}\n  {{ adapter.dispatch('get_insert_overwrite_merge_sql', 'dbt')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.035916, "supported_languages": null}, "macro.dbt.default__get_insert_overwrite_merge_sql": {"name": "default__get_insert_overwrite_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n    {#-- The only time include_sql_header is True: --#}\n    {#-- BigQuery + insert_overwrite strategy + \"static\" partitions config --#}\n    {#-- We should consider including the sql header at the materialization level instead --#}\n\n    {%- set predicates = [] if predicates is none else [] + predicates -%}\n    {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n    {%- set sql_header = config.get('sql_header', none) -%}\n\n    {{ sql_header if sql_header is not none and include_sql_header }}\n\n    merge into {{ target }} as DBT_INTERNAL_DEST\n        using {{ source }} as DBT_INTERNAL_SOURCE\n        on FALSE\n\n    when not matched by source\n        {% if predicates %} and {{ predicates | join(' and ') }} {% endif %}\n        then delete\n\n    when not matched then insert\n        ({{ dest_cols_csv }})\n    values\n        ({{ dest_cols_csv }})\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0365791, "supported_languages": null}, "macro.dbt.is_incremental": {"name": "is_incremental", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/is_incremental.sql", "original_file_path": "macros/materializations/models/incremental/is_incremental.sql", "unique_id": "macro.dbt.is_incremental", "macro_sql": "{% macro is_incremental() %}\n    {#-- do not run introspective queries in parsing #}\n    {% if not execute %}\n        {{ return(False) }}\n    {% else %}\n        {% set relation = adapter.get_relation(this.database, this.schema, this.table) %}\n        {{ return(relation is not none\n                  and relation.type == 'table'\n                  and model.config.materialized == 'incremental'\n                  and not should_full_refresh()) }}\n    {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.037218, "supported_languages": null}, "macro.dbt.get_incremental_append_sql": {"name": "get_incremental_append_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_append_sql", "macro_sql": "{% macro get_incremental_append_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_append_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_incremental_append_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.038104, "supported_languages": null}, "macro.dbt.default__get_incremental_append_sql": {"name": "default__get_incremental_append_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_append_sql", "macro_sql": "{% macro default__get_incremental_append_sql(arg_dict) %}\n\n  {% do return(get_insert_into_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"dest_columns\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_insert_into_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.038353, "supported_languages": null}, "macro.dbt.get_incremental_delete_insert_sql": {"name": "get_incremental_delete_insert_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_delete_insert_sql", "macro_sql": "{% macro get_incremental_delete_insert_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_delete_insert_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_delete_insert_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.038545, "supported_languages": null}, "macro.dbt.default__get_incremental_delete_insert_sql": {"name": "default__get_incremental_delete_insert_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_delete_insert_sql", "macro_sql": "{% macro default__get_incremental_delete_insert_sql(arg_dict) %}\n\n  {% do return(get_delete_insert_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"unique_key\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.038846, "supported_languages": null}, "macro.dbt.get_incremental_merge_sql": {"name": "get_incremental_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_merge_sql", "macro_sql": "{% macro get_incremental_merge_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_merge_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0391, "supported_languages": null}, "macro.dbt.default__get_incremental_merge_sql": {"name": "default__get_incremental_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_merge_sql", "macro_sql": "{% macro default__get_incremental_merge_sql(arg_dict) %}\n\n  {% do return(get_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"unique_key\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.039407, "supported_languages": null}, "macro.dbt.get_incremental_insert_overwrite_sql": {"name": "get_incremental_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_insert_overwrite_sql", "macro_sql": "{% macro get_incremental_insert_overwrite_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_insert_overwrite_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_insert_overwrite_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.039597, "supported_languages": null}, "macro.dbt.default__get_incremental_insert_overwrite_sql": {"name": "default__get_incremental_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_insert_overwrite_sql", "macro_sql": "{% macro default__get_incremental_insert_overwrite_sql(arg_dict) %}\n\n  {% do return(get_insert_overwrite_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.039867, "supported_languages": null}, "macro.dbt.get_incremental_default_sql": {"name": "get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_default_sql", "macro_sql": "{% macro get_incremental_default_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_default_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_incremental_default_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0400581, "supported_languages": null}, "macro.dbt.default__get_incremental_default_sql": {"name": "default__get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_default_sql", "macro_sql": "{% macro default__get_incremental_default_sql(arg_dict) %}\n\n  {% do return(get_incremental_append_sql(arg_dict)) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_incremental_append_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.040212, "supported_languages": null}, "macro.dbt.get_insert_into_sql": {"name": "get_insert_into_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_insert_into_sql", "macro_sql": "{% macro get_insert_into_sql(target_relation, temp_relation, dest_columns) %}\n\n    {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n    insert into {{ target_relation }} ({{ dest_cols_csv }})\n    (\n        select {{ dest_cols_csv }}\n        from {{ temp_relation }}\n    )\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.040492, "supported_languages": null}, "macro.dbt.materialization_incremental_default": {"name": "materialization_incremental_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/incremental.sql", "original_file_path": "macros/materializations/models/incremental/incremental.sql", "unique_id": "macro.dbt.materialization_incremental_default", "macro_sql": "{% materialization incremental, default -%}\n\n  -- relations\n  {%- set existing_relation = load_cached_relation(this) -%}\n  {%- set target_relation = this.incorporate(type='table') -%}\n  {%- set temp_relation = make_temp_relation(target_relation)-%}\n  {%- set intermediate_relation = make_intermediate_relation(target_relation)-%}\n  {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n  {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n\n  -- configs\n  {%- set unique_key = config.get('unique_key') -%}\n  {%- set full_refresh_mode = (should_full_refresh()  or existing_relation.is_view) -%}\n  {%- set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') -%}\n\n  -- the temp_ and backup_ relations should not already exist in the database; get_relation\n  -- will return None in that case. Otherwise, we get a relation that we can drop\n  -- later, before we try to use this name for the current operation. This has to happen before\n  -- BEGIN, in a separate transaction\n  {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation)-%}\n  {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n   -- grab current tables grants config for comparision later on\n  {% set grant_config = config.get('grants') %}\n  {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n  {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  -- `BEGIN` happens here:\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  {% set to_drop = [] %}\n\n  {% if existing_relation is none %}\n      {% set build_sql = get_create_table_as_sql(False, target_relation, sql) %}\n  {% elif full_refresh_mode %}\n      {% set build_sql = get_create_table_as_sql(False, intermediate_relation, sql) %}\n      {% set need_swap = true %}\n  {% else %}\n    {% do run_query(get_create_table_as_sql(True, temp_relation, sql)) %}\n    {% do adapter.expand_target_column_types(\n             from_relation=temp_relation,\n             to_relation=target_relation) %}\n    {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n    {% set dest_columns = process_schema_changes(on_schema_change, temp_relation, existing_relation) %}\n    {% if not dest_columns %}\n      {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n    {% endif %}\n\n    {#-- Get the incremental_strategy, the macro to use for the strategy, and build the sql --#}\n    {% set incremental_strategy = config.get('incremental_strategy') or 'default' %}\n    {% set incremental_predicates = config.get('predicates', none) or config.get('incremental_predicates', none) %}\n    {% set strategy_sql_macro_func = adapter.get_incremental_strategy_macro(context, incremental_strategy) %}\n    {% set strategy_arg_dict = ({'target_relation': target_relation, 'temp_relation': temp_relation, 'unique_key': unique_key, 'dest_columns': dest_columns, 'incremental_predicates': incremental_predicates }) %}\n    {% set build_sql = strategy_sql_macro_func(strategy_arg_dict) %}\n\n  {% endif %}\n\n  {% call statement(\"main\") %}\n      {{ build_sql }}\n  {% endcall %}\n\n  {% if need_swap %}\n      {% do adapter.rename_relation(target_relation, backup_relation) %}\n      {% do adapter.rename_relation(intermediate_relation, target_relation) %}\n      {% do to_drop.append(backup_relation) %}\n  {% endif %}\n\n  {% set should_revoke = should_revoke(existing_relation, full_refresh_mode) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {% if existing_relation is none or existing_relation.is_view or should_full_refresh() %}\n    {% do create_indexes(target_relation) %}\n  {% endif %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  -- `COMMIT` happens here\n  {% do adapter.commit() %}\n\n  {% for rel in to_drop %}\n      {% do adapter.drop_relation(rel) %}\n  {% endfor %}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_temp_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.should_full_refresh", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.get_create_table_as_sql", "macro.dbt.run_query", "macro.dbt.process_schema_changes", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.045553, "supported_languages": ["sql"]}, "macro.dbt.incremental_validate_on_schema_change": {"name": "incremental_validate_on_schema_change", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.incremental_validate_on_schema_change", "macro_sql": "{% macro incremental_validate_on_schema_change(on_schema_change, default='ignore') %}\n\n   {% if on_schema_change not in ['sync_all_columns', 'append_new_columns', 'fail', 'ignore'] %}\n\n     {% set log_message = 'Invalid value for on_schema_change (%s) specified. Setting default value of %s.' % (on_schema_change, default) %}\n     {% do log(log_message) %}\n\n     {{ return(default) }}\n\n   {% else %}\n\n     {{ return(on_schema_change) }}\n\n   {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.051162, "supported_languages": null}, "macro.dbt.check_for_schema_changes": {"name": "check_for_schema_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.check_for_schema_changes", "macro_sql": "{% macro check_for_schema_changes(source_relation, target_relation) %}\n\n  {% set schema_changed = False %}\n\n  {%- set source_columns = adapter.get_columns_in_relation(source_relation) -%}\n  {%- set target_columns = adapter.get_columns_in_relation(target_relation) -%}\n  {%- set source_not_in_target = diff_columns(source_columns, target_columns) -%}\n  {%- set target_not_in_source = diff_columns(target_columns, source_columns) -%}\n\n  {% set new_target_types = diff_column_data_types(source_columns, target_columns) %}\n\n  {% if source_not_in_target != [] %}\n    {% set schema_changed = True %}\n  {% elif target_not_in_source != [] or new_target_types != [] %}\n    {% set schema_changed = True %}\n  {% elif new_target_types != [] %}\n    {% set schema_changed = True %}\n  {% endif %}\n\n  {% set changes_dict = {\n    'schema_changed': schema_changed,\n    'source_not_in_target': source_not_in_target,\n    'target_not_in_source': target_not_in_source,\n    'source_columns': source_columns,\n    'target_columns': target_columns,\n    'new_target_types': new_target_types\n  } %}\n\n  {% set msg %}\n    In {{ target_relation }}:\n        Schema changed: {{ schema_changed }}\n        Source columns not in target: {{ source_not_in_target }}\n        Target columns not in source: {{ target_not_in_source }}\n        New column types: {{ new_target_types }}\n  {% endset %}\n\n  {% do log(msg) %}\n\n  {{ return(changes_dict) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.diff_columns", "macro.dbt.diff_column_data_types"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0524, "supported_languages": null}, "macro.dbt.sync_column_schemas": {"name": "sync_column_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.sync_column_schemas", "macro_sql": "{% macro sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n\n  {%- set add_to_target_arr = schema_changes_dict['source_not_in_target'] -%}\n\n  {%- if on_schema_change == 'append_new_columns'-%}\n     {%- if add_to_target_arr | length > 0 -%}\n       {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, none) -%}\n     {%- endif -%}\n\n  {% elif on_schema_change == 'sync_all_columns' %}\n     {%- set remove_from_target_arr = schema_changes_dict['target_not_in_source'] -%}\n     {%- set new_target_types = schema_changes_dict['new_target_types'] -%}\n\n     {% if add_to_target_arr | length > 0 or remove_from_target_arr | length > 0 %}\n       {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, remove_from_target_arr) -%}\n     {% endif %}\n\n     {% if new_target_types != [] %}\n       {% for ntt in new_target_types %}\n         {% set column_name = ntt['column_name'] %}\n         {% set new_type = ntt['new_type'] %}\n         {% do alter_column_type(target_relation, column_name, new_type) %}\n       {% endfor %}\n     {% endif %}\n\n  {% endif %}\n\n  {% set schema_change_message %}\n    In {{ target_relation }}:\n        Schema change approach: {{ on_schema_change }}\n        Columns added: {{ add_to_target_arr }}\n        Columns removed: {{ remove_from_target_arr }}\n        Data types changed: {{ new_target_types }}\n  {% endset %}\n\n  {% do log(schema_change_message) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.alter_relation_add_remove_columns", "macro.dbt.alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.053623, "supported_languages": null}, "macro.dbt.process_schema_changes": {"name": "process_schema_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.process_schema_changes", "macro_sql": "{% macro process_schema_changes(on_schema_change, source_relation, target_relation) %}\n\n    {% if on_schema_change == 'ignore' %}\n\n     {{ return({}) }}\n\n    {% else %}\n\n      {% set schema_changes_dict = check_for_schema_changes(source_relation, target_relation) %}\n\n      {% if schema_changes_dict['schema_changed'] %}\n\n        {% if on_schema_change == 'fail' %}\n\n          {% set fail_msg %}\n              The source and target schemas on this incremental model are out of sync!\n              They can be reconciled in several ways:\n                - set the `on_schema_change` config to either append_new_columns or sync_all_columns, depending on your situation.\n                - Re-run the incremental model with `full_refresh: True` to update the target schema.\n                - update the schema manually and re-run the process.\n\n              Additional troubleshooting context:\n                 Source columns not in target: {{ schema_changes_dict['source_not_in_target'] }}\n                 Target columns not in source: {{ schema_changes_dict['target_not_in_source'] }}\n                 New column types: {{ schema_changes_dict['new_target_types'] }}\n          {% endset %}\n\n          {% do exceptions.raise_compiler_error(fail_msg) %}\n\n        {# -- unless we ignore, run the sync operation per the config #}\n        {% else %}\n\n          {% do sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n\n        {% endif %}\n\n      {% endif %}\n\n      {{ return(schema_changes_dict['source_columns']) }}\n\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.check_for_schema_changes", "macro.dbt.sync_column_schemas"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0544891, "supported_languages": null}, "macro.dbt.can_clone_table": {"name": "can_clone_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/can_clone_table.sql", "original_file_path": "macros/materializations/models/clone/can_clone_table.sql", "unique_id": "macro.dbt.can_clone_table", "macro_sql": "{% macro can_clone_table() %}\n    {{ return(adapter.dispatch('can_clone_table', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__can_clone_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.054753, "supported_languages": null}, "macro.dbt.default__can_clone_table": {"name": "default__can_clone_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/can_clone_table.sql", "original_file_path": "macros/materializations/models/clone/can_clone_table.sql", "unique_id": "macro.dbt.default__can_clone_table", "macro_sql": "{% macro default__can_clone_table() %}\n    {{ return(False) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0548759, "supported_languages": null}, "macro.dbt.create_or_replace_clone": {"name": "create_or_replace_clone", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/create_or_replace_clone.sql", "original_file_path": "macros/materializations/models/clone/create_or_replace_clone.sql", "unique_id": "macro.dbt.create_or_replace_clone", "macro_sql": "{% macro create_or_replace_clone(this_relation, defer_relation) %}\n    {{ return(adapter.dispatch('create_or_replace_clone', 'dbt')(this_relation, defer_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_or_replace_clone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0551732, "supported_languages": null}, "macro.dbt.default__create_or_replace_clone": {"name": "default__create_or_replace_clone", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/create_or_replace_clone.sql", "original_file_path": "macros/materializations/models/clone/create_or_replace_clone.sql", "unique_id": "macro.dbt.default__create_or_replace_clone", "macro_sql": "{% macro default__create_or_replace_clone(this_relation, defer_relation) %}\n    create or replace table {{ this_relation }} clone {{ defer_relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.055309, "supported_languages": null}, "macro.dbt.materialization_clone_default": {"name": "materialization_clone_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/clone.sql", "original_file_path": "macros/materializations/models/clone/clone.sql", "unique_id": "macro.dbt.materialization_clone_default", "macro_sql": "{%- materialization clone, default -%}\n\n  {%- set relations = {'relations': []} -%}\n\n  {%- if not defer_relation -%}\n      -- nothing to do\n      {{ log(\"No relation found in state manifest for \" ~ model.unique_id, info=True) }}\n      {{ return(relations) }}\n  {%- endif -%}\n\n  {%- set existing_relation = load_cached_relation(this) -%}\n\n  {%- if existing_relation and not flags.FULL_REFRESH -%}\n      -- noop!\n      {{ log(\"Relation \" ~ existing_relation ~ \" already exists\", info=True) }}\n      {{ return(relations) }}\n  {%- endif -%}\n\n  {%- set other_existing_relation = load_cached_relation(defer_relation) -%}\n\n  -- If this is a database that can do zero-copy cloning of tables, and the other relation is a table, then this will be a table\n  -- Otherwise, this will be a view\n\n  {% set can_clone_table = can_clone_table() %}\n\n  {%- if other_existing_relation and other_existing_relation.type == 'table' and can_clone_table -%}\n\n      {%- set target_relation = this.incorporate(type='table') -%}\n      {% if existing_relation is not none and not existing_relation.is_table %}\n        {{ log(\"Dropping relation \" ~ existing_relation ~ \" because it is of type \" ~ existing_relation.type) }}\n        {{ drop_relation_if_exists(existing_relation) }}\n      {% endif %}\n\n      -- as a general rule, data platforms that can clone tables can also do atomic 'create or replace'\n      {% call statement('main') %}\n          {% if target_relation and defer_relation and target_relation == defer_relation %}\n              {{ log(\"Target relation and defer relation are the same, skipping clone for relation: \" ~ target_relation) }}\n          {% else %}\n              {{ create_or_replace_clone(target_relation, defer_relation) }}\n          {% endif %}\n\n      {% endcall %}\n\n      {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n      {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n      {% do persist_docs(target_relation, model) %}\n\n      {{ return({'relations': [target_relation]}) }}\n\n  {%- else -%}\n\n      {%- set target_relation = this.incorporate(type='view') -%}\n\n      -- reuse the view materialization\n      -- TODO: support actual dispatch for materialization macros\n      -- Tracking ticket: https://github.com/dbt-labs/dbt-core/issues/7799\n      {% set search_name = \"materialization_view_\" ~ adapter.type() %}\n      {% if not search_name in context %}\n          {% set search_name = \"materialization_view_default\" %}\n      {% endif %}\n      {% set materialization_macro = context[search_name] %}\n      {% set relations = materialization_macro() %}\n      {{ return(relations) }}\n\n  {%- endif -%}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.can_clone_table", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_or_replace_clone", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0589912, "supported_languages": ["sql"]}, "macro.dbt.materialization_seed_default": {"name": "materialization_seed_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/seed.sql", "original_file_path": "macros/materializations/seeds/seed.sql", "unique_id": "macro.dbt.materialization_seed_default", "macro_sql": "{% materialization seed, default %}\n\n  {%- set identifier = model['alias'] -%}\n  {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n  {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n  {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n  {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n  {%- set grant_config = config.get('grants') -%}\n  {%- set agate_table = load_agate_table() -%}\n  -- grab current tables grants config for comparison later on\n\n  {%- do store_result('agate_table', response='OK', agate_table=agate_table) -%}\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  -- `BEGIN` happens here:\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  -- build model\n  {% set create_table_sql = \"\" %}\n  {% if exists_as_view %}\n    {{ exceptions.raise_compiler_error(\"Cannot seed to '{}', it is a view\".format(old_relation)) }}\n  {% elif exists_as_table %}\n    {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %}\n  {% else %}\n    {% set create_table_sql = create_csv_table(model, agate_table) %}\n  {% endif %}\n\n  {% set code = 'CREATE' if full_refresh_mode else 'INSERT' %}\n  {% set rows_affected = (agate_table.rows | length) %}\n  {% set sql = load_csv_rows(model, agate_table) %}\n\n  {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %}\n    {{ get_csv_sql(create_table_sql, sql) }};\n  {% endcall %}\n\n  {% set target_relation = this.incorporate(type='table') %}\n\n  {% set should_revoke = should_revoke(old_relation, full_refresh_mode) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {% if full_refresh_mode or not exists_as_table %}\n    {% do create_indexes(target_relation) %}\n  {% endif %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  -- `COMMIT` happens here\n  {{ adapter.commit() }}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.run_hooks", "macro.dbt.reset_csv_table", "macro.dbt.create_csv_table", "macro.dbt.load_csv_rows", "macro.dbt.noop_statement", "macro.dbt.get_csv_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.062251, "supported_languages": ["sql"]}, "macro.dbt.create_csv_table": {"name": "create_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n  {{ adapter.dispatch('create_csv_table', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.067302, "supported_languages": null}, "macro.dbt.default__create_csv_table": {"name": "default__create_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__create_csv_table", "macro_sql": "{% macro default__create_csv_table(model, agate_table) %}\n  {%- set column_override = model['config'].get('column_types', {}) -%}\n  {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n\n  {% set sql %}\n    create table {{ this.render() }} (\n        {%- for col_name in agate_table.column_names -%}\n            {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}\n            {%- set type = column_override.get(col_name, inferred_type) -%}\n            {%- set column_name = (col_name | string) -%}\n            {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%}\n        {%- endfor -%}\n    )\n  {% endset %}\n\n  {% call statement('_') -%}\n    {{ sql }}\n  {%- endcall %}\n\n  {{ return(sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.068225, "supported_languages": null}, "macro.dbt.reset_csv_table": {"name": "reset_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n  {{ adapter.dispatch('reset_csv_table', 'dbt')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__reset_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.068466, "supported_languages": null}, "macro.dbt.default__reset_csv_table": {"name": "default__reset_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__reset_csv_table", "macro_sql": "{% macro default__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n    {% set sql = \"\" %}\n    {% if full_refresh %}\n        {{ adapter.drop_relation(old_relation) }}\n        {% set sql = create_csv_table(model, agate_table) %}\n    {% else %}\n        {{ adapter.truncate_relation(old_relation) }}\n        {% set sql = \"truncate table \" ~ old_relation %}\n    {% endif %}\n\n    {{ return(sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.068955, "supported_languages": null}, "macro.dbt.get_csv_sql": {"name": "get_csv_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_csv_sql", "macro_sql": "{% macro get_csv_sql(create_or_truncate_sql, insert_sql) %}\n    {{ adapter.dispatch('get_csv_sql', 'dbt')(create_or_truncate_sql, insert_sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_csv_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.069151, "supported_languages": null}, "macro.dbt.default__get_csv_sql": {"name": "default__get_csv_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_csv_sql", "macro_sql": "{% macro default__get_csv_sql(create_or_truncate_sql, insert_sql) %}\n    {{ create_or_truncate_sql }};\n    -- dbt seed --\n    {{ insert_sql }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.069289, "supported_languages": null}, "macro.dbt.get_binding_char": {"name": "get_binding_char", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_binding_char", "macro_sql": "{% macro get_binding_char() -%}\n  {{ adapter.dispatch('get_binding_char', 'dbt')() }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.06943, "supported_languages": null}, "macro.dbt.default__get_binding_char": {"name": "default__get_binding_char", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_binding_char", "macro_sql": "{% macro default__get_binding_char() %}\n  {{ return('%s') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.06955, "supported_languages": null}, "macro.dbt.get_batch_size": {"name": "get_batch_size", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_batch_size", "macro_sql": "{% macro get_batch_size() -%}\n  {{ return(adapter.dispatch('get_batch_size', 'dbt')()) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_batch_size"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.06971, "supported_languages": null}, "macro.dbt.default__get_batch_size": {"name": "default__get_batch_size", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_batch_size", "macro_sql": "{% macro default__get_batch_size() %}\n  {{ return(10000) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.069827, "supported_languages": null}, "macro.dbt.get_seed_column_quoted_csv": {"name": "get_seed_column_quoted_csv", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_seed_column_quoted_csv", "macro_sql": "{% macro get_seed_column_quoted_csv(model, column_names) %}\n  {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n    {% set quoted = [] %}\n    {% for col in column_names -%}\n        {%- do quoted.append(adapter.quote_seed_column(col, quote_seed_column)) -%}\n    {%- endfor %}\n\n    {%- set dest_cols_csv = quoted | join(', ') -%}\n    {{ return(dest_cols_csv) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0703151, "supported_languages": null}, "macro.dbt.load_csv_rows": {"name": "load_csv_rows", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n  {{ adapter.dispatch('load_csv_rows', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0705018, "supported_languages": null}, "macro.dbt.default__load_csv_rows": {"name": "default__load_csv_rows", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__load_csv_rows", "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n\n  {% set batch_size = get_batch_size() %}\n\n  {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n  {% set bindings = [] %}\n\n  {% set statements = [] %}\n\n  {% for chunk in agate_table.rows | batch(batch_size) %}\n      {% set bindings = [] %}\n\n      {% for row in chunk %}\n          {% do bindings.extend(row) %}\n      {% endfor %}\n\n      {% set sql %}\n          insert into {{ this.render() }} ({{ cols_sql }}) values\n          {% for row in chunk -%}\n              ({%- for column in agate_table.column_names -%}\n                  {{ get_binding_char() }}\n                  {%- if not loop.last%},{%- endif %}\n              {%- endfor -%})\n              {%- if not loop.last%},{%- endif %}\n          {%- endfor %}\n      {% endset %}\n\n      {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n\n      {% if loop.index0 == 0 %}\n          {% do statements.append(sql) %}\n      {% endif %}\n  {% endfor %}\n\n  {# Return SQL so we can render it out into the compiled files #}\n  {{ return(statements[0]) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv", "macro.dbt.get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.071799, "supported_languages": null}, "macro.dbt.generate_alias_name": {"name": "generate_alias_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "unique_id": "macro.dbt.generate_alias_name", "macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n    {% do return(adapter.dispatch('generate_alias_name', 'dbt')(custom_alias_name, node)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_alias_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.072227, "supported_languages": null}, "macro.dbt.default__generate_alias_name": {"name": "default__generate_alias_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "unique_id": "macro.dbt.default__generate_alias_name", "macro_sql": "{% macro default__generate_alias_name(custom_alias_name=none, node=none) -%}\n\n    {%- if custom_alias_name -%}\n\n        {{ custom_alias_name | trim }}\n\n    {%- elif node.version -%}\n\n        {{ return(node.name ~ \"_v\" ~ (node.version | replace(\".\", \"_\"))) }}\n\n    {%- else -%}\n\n        {{ node.name }}\n\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.072612, "supported_languages": null}, "macro.dbt.generate_schema_name": {"name": "generate_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name=none, node=none) -%}\n    {{ return(adapter.dispatch('generate_schema_name', 'dbt')(custom_schema_name, node)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.073138, "supported_languages": null}, "macro.dbt.default__generate_schema_name": {"name": "default__generate_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.default__generate_schema_name", "macro_sql": "{% macro default__generate_schema_name(custom_schema_name, node) -%}\n\n    {%- set default_schema = target.schema -%}\n    {%- if custom_schema_name is none -%}\n\n        {{ default_schema }}\n\n    {%- else -%}\n\n        {{ default_schema }}_{{ custom_schema_name | trim }}\n\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.073401, "supported_languages": null}, "macro.dbt.generate_schema_name_for_env": {"name": "generate_schema_name_for_env", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.generate_schema_name_for_env", "macro_sql": "{% macro generate_schema_name_for_env(custom_schema_name, node) -%}\n\n    {%- set default_schema = target.schema -%}\n    {%- if target.name == 'prod' and custom_schema_name is not none -%}\n\n        {{ custom_schema_name | trim }}\n\n    {%- else -%}\n\n        {{ default_schema }}\n\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.073685, "supported_languages": null}, "macro.dbt.generate_database_name": {"name": "generate_database_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "unique_id": "macro.dbt.generate_database_name", "macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n    {% do return(adapter.dispatch('generate_database_name', 'dbt')(custom_database_name, node)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0740821, "supported_languages": null}, "macro.dbt.default__generate_database_name": {"name": "default__generate_database_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "unique_id": "macro.dbt.default__generate_database_name", "macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n    {%- set default_database = target.database -%}\n    {%- if custom_database_name is none -%}\n\n        {{ default_database }}\n\n    {%- else -%}\n\n        {{ custom_database_name }}\n\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.074338, "supported_languages": null}, "macro.dbt.get_drop_sql": {"name": "get_drop_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.get_drop_sql", "macro_sql": "{%- macro get_drop_sql(relation) -%}\n    {{- log('Applying DROP to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_drop_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.075052, "supported_languages": null}, "macro.dbt.default__get_drop_sql": {"name": "default__get_drop_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.default__get_drop_sql", "macro_sql": "{%- macro default__get_drop_sql(relation) -%}\n\n    {%- if relation.is_view -%}\n        {{ drop_view(relation) }}\n\n    {%- elif relation.is_table -%}\n        {{ drop_table(relation) }}\n\n    {%- elif relation.is_materialized_view -%}\n        {{ drop_materialized_view(relation) }}\n\n    {%- else -%}\n        drop {{ relation.type }} if exists {{ relation }} cascade\n\n    {%- endif -%}\n\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.drop_view", "macro.dbt.drop_table", "macro.dbt.drop_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.075427, "supported_languages": null}, "macro.dbt.drop_relation": {"name": "drop_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n    {{ return(adapter.dispatch('drop_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0756102, "supported_languages": null}, "macro.dbt.default__drop_relation": {"name": "default__drop_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.default__drop_relation", "macro_sql": "{% macro default__drop_relation(relation) -%}\n    {% call statement('drop_relation', auto_begin=False) -%}\n        {{ get_drop_sql(relation) }}\n    {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.075816, "supported_languages": null}, "macro.dbt.drop_relation_if_exists": {"name": "drop_relation_if_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.drop_relation_if_exists", "macro_sql": "{% macro drop_relation_if_exists(relation) %}\n  {% if relation is not none %}\n    {{ adapter.drop_relation(relation) }}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0760121, "supported_languages": null}, "macro.dbt.get_replace_sql": {"name": "get_replace_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/replace.sql", "original_file_path": "macros/relations/replace.sql", "unique_id": "macro.dbt.get_replace_sql", "macro_sql": "{% macro get_replace_sql(existing_relation, target_relation, sql) %}\n    {{- log('Applying REPLACE to: ' ~ existing_relation) -}}\n    {{- adapter.dispatch('get_replace_sql', 'dbt')(existing_relation, target_relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_replace_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.076802, "supported_languages": null}, "macro.dbt.default__get_replace_sql": {"name": "default__get_replace_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/replace.sql", "original_file_path": "macros/relations/replace.sql", "unique_id": "macro.dbt.default__get_replace_sql", "macro_sql": "{% macro default__get_replace_sql(existing_relation, target_relation, sql) %}\n\n    {# /* use a create or replace statement if possible */ #}\n\n    {% set is_replaceable = existing_relation.type == target_relation_type and existing_relation.can_be_replaced %}\n\n    {% if is_replaceable and existing_relation.is_view %}\n        {{ get_replace_view_sql(target_relation, sql) }}\n\n    {% elif is_replaceable and existing_relation.is_table %}\n        {{ get_replace_table_sql(target_relation, sql) }}\n\n    {% elif is_replaceable and existing_relation.is_materialized_view %}\n        {{ get_replace_materialized_view_sql(target_relation, sql) }}\n\n    {# /* a create or replace statement is not possible, so try to stage and/or backup to be safe */ #}\n\n    {# /* create target_relation as an intermediate relation, then swap it out with the existing one using a backup */ #}\n    {%- elif target_relation.can_be_renamed and existing_relation.can_be_renamed -%}\n        {{ get_create_intermediate_sql(target_relation, sql) }};\n        {{ get_create_backup_sql(existing_relation) }};\n        {{ get_rename_intermediate_sql(target_relation) }};\n        {{ get_drop_backup_sql(existing_relation) }}\n\n    {# /* create target_relation as an intermediate relation, then swap it out with the existing one without using a backup */ #}\n    {%- elif target_relation.can_be_renamed -%}\n        {{ get_create_intermediate_sql(target_relation, sql) }};\n        {{ get_drop_sql(existing_relation) }};\n        {{ get_rename_intermediate_sql(target_relation) }}\n\n    {# /* create target_relation in place by first backing up the existing relation */ #}\n    {%- elif existing_relation.can_be_renamed -%}\n        {{ get_create_backup_sql(existing_relation) }};\n        {{ get_create_sql(target_relation, sql) }};\n        {{ get_drop_backup_sql(existing_relation) }}\n\n    {# /* no renaming is allowed, so just drop and create */ #}\n    {%- else -%}\n        {{ get_drop_sql(existing_relation) }};\n        {{ get_create_sql(target_relation, sql) }}\n\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_replace_view_sql", "macro.dbt.get_replace_table_sql", "macro.dbt.get_replace_materialized_view_sql", "macro.dbt.get_create_intermediate_sql", "macro.dbt.get_create_backup_sql", "macro.dbt.get_rename_intermediate_sql", "macro.dbt.get_drop_backup_sql", "macro.dbt.get_drop_sql", "macro.dbt.get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.07811, "supported_languages": null}, "macro.dbt.get_create_intermediate_sql": {"name": "get_create_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_intermediate.sql", "original_file_path": "macros/relations/create_intermediate.sql", "unique_id": "macro.dbt.get_create_intermediate_sql", "macro_sql": "{%- macro get_create_intermediate_sql(relation, sql) -%}\n    {{- log('Applying CREATE INTERMEDIATE to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_create_intermediate_sql', 'dbt')(relation, sql) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_create_intermediate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0784981, "supported_languages": null}, "macro.dbt.default__get_create_intermediate_sql": {"name": "default__get_create_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_intermediate.sql", "original_file_path": "macros/relations/create_intermediate.sql", "unique_id": "macro.dbt.default__get_create_intermediate_sql", "macro_sql": "{%- macro default__get_create_intermediate_sql(relation, sql) -%}\n\n    -- get the standard intermediate name\n    {% set intermediate_relation = make_intermediate_relation(relation) %}\n\n    -- drop any pre-existing intermediate\n    {{ get_drop_sql(intermediate_relation) }};\n\n    {{ get_create_sql(intermediate_relation, sql) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_intermediate_relation", "macro.dbt.get_drop_sql", "macro.dbt.get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.078753, "supported_languages": null}, "macro.dbt.get_drop_backup_sql": {"name": "get_drop_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop_backup.sql", "original_file_path": "macros/relations/drop_backup.sql", "unique_id": "macro.dbt.get_drop_backup_sql", "macro_sql": "{%- macro get_drop_backup_sql(relation) -%}\n    {{- log('Applying DROP BACKUP to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_drop_backup_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_drop_backup_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0790882, "supported_languages": null}, "macro.dbt.default__get_drop_backup_sql": {"name": "default__get_drop_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop_backup.sql", "original_file_path": "macros/relations/drop_backup.sql", "unique_id": "macro.dbt.default__get_drop_backup_sql", "macro_sql": "{%- macro default__get_drop_backup_sql(relation) -%}\n\n    -- get the standard backup name\n    {% set backup_relation = make_backup_relation(relation, relation.type) %}\n\n    {{ get_drop_sql(backup_relation) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_backup_relation", "macro.dbt.get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0793002, "supported_languages": null}, "macro.dbt.get_rename_sql": {"name": "get_rename_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.get_rename_sql", "macro_sql": "{%- macro get_rename_sql(relation, new_name) -%}\n    {{- log('Applying RENAME to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_rename_sql', 'dbt')(relation, new_name) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.080062, "supported_languages": null}, "macro.dbt.default__get_rename_sql": {"name": "default__get_rename_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.default__get_rename_sql", "macro_sql": "{%- macro default__get_rename_sql(relation, new_name) -%}\n\n    {%- if relation.is_view -%}\n        {{ get_rename_view_sql(relation, new_name) }}\n\n    {%- elif relation.is_table -%}\n        {{ get_rename_table_sql(relation, new_name) }}\n\n    {%- elif relation.is_materialized_view -%}\n        {{ get_rename_materialized_view_sql(relation, new_name) }}\n\n    {%- else -%}\n        {{- exceptions.raise_compiler_error(\"`get_rename_sql` has not been implemented for: \" ~ relation.type ) -}}\n\n    {%- endif -%}\n\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.get_rename_view_sql", "macro.dbt.get_rename_table_sql", "macro.dbt.get_rename_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0805051, "supported_languages": null}, "macro.dbt.rename_relation": {"name": "rename_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n  {{ return(adapter.dispatch('rename_relation', 'dbt')(from_relation, to_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__rename_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.080719, "supported_languages": null}, "macro.dbt.default__rename_relation": {"name": "default__rename_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.default__rename_relation", "macro_sql": "{% macro default__rename_relation(from_relation, to_relation) -%}\n  {% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}\n  {% call statement('rename_relation') -%}\n    alter table {{ from_relation }} rename to {{ target_name }}\n  {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.081013, "supported_languages": null}, "macro.dbt.get_create_backup_sql": {"name": "get_create_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_backup.sql", "original_file_path": "macros/relations/create_backup.sql", "unique_id": "macro.dbt.get_create_backup_sql", "macro_sql": "{%- macro get_create_backup_sql(relation) -%}\n    {{- log('Applying CREATE BACKUP to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_create_backup_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_create_backup_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.081362, "supported_languages": null}, "macro.dbt.default__get_create_backup_sql": {"name": "default__get_create_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_backup.sql", "original_file_path": "macros/relations/create_backup.sql", "unique_id": "macro.dbt.default__get_create_backup_sql", "macro_sql": "{%- macro default__get_create_backup_sql(relation) -%}\n\n    -- get the standard backup name\n    {% set backup_relation = make_backup_relation(relation, relation.type) %}\n\n    -- drop any pre-existing backup\n    {{ get_drop_sql(backup_relation) }};\n\n    {{ get_rename_sql(relation, backup_relation.identifier) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_backup_relation", "macro.dbt.get_drop_sql", "macro.dbt.get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0816362, "supported_languages": null}, "macro.dbt.get_create_sql": {"name": "get_create_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create.sql", "original_file_path": "macros/relations/create.sql", "unique_id": "macro.dbt.get_create_sql", "macro_sql": "{%- macro get_create_sql(relation, sql) -%}\n    {{- log('Applying CREATE to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_create_sql', 'dbt')(relation, sql) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.082108, "supported_languages": null}, "macro.dbt.default__get_create_sql": {"name": "default__get_create_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create.sql", "original_file_path": "macros/relations/create.sql", "unique_id": "macro.dbt.default__get_create_sql", "macro_sql": "{%- macro default__get_create_sql(relation, sql) -%}\n\n    {%- if relation.is_view -%}\n        {{ get_create_view_as_sql(relation, sql) }}\n\n    {%- elif relation.is_table -%}\n        {{ get_create_table_as_sql(False, relation, sql) }}\n\n    {%- elif relation.is_materialized_view -%}\n        {{ get_create_materialized_view_as_sql(relation, sql) }}\n\n    {%- else -%}\n        {{- exceptions.raise_compiler_error(\"`get_create_sql` has not been implemented for: \" ~ relation.type ) -}}\n\n    {%- endif -%}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.get_create_view_as_sql", "macro.dbt.get_create_table_as_sql", "macro.dbt.get_create_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0825589, "supported_languages": null}, "macro.dbt.get_rename_intermediate_sql": {"name": "get_rename_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename_intermediate.sql", "original_file_path": "macros/relations/rename_intermediate.sql", "unique_id": "macro.dbt.get_rename_intermediate_sql", "macro_sql": "{%- macro get_rename_intermediate_sql(relation) -%}\n    {{- log('Applying RENAME INTERMEDIATE to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_rename_intermediate_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_rename_intermediate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.08289, "supported_languages": null}, "macro.dbt.default__get_rename_intermediate_sql": {"name": "default__get_rename_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename_intermediate.sql", "original_file_path": "macros/relations/rename_intermediate.sql", "unique_id": "macro.dbt.default__get_rename_intermediate_sql", "macro_sql": "{%- macro default__get_rename_intermediate_sql(relation) -%}\n\n    -- get the standard intermediate name\n    {% set intermediate_relation = make_intermediate_relation(relation) %}\n\n    {{ get_rename_sql(intermediate_relation, relation.identifier) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_intermediate_relation", "macro.dbt.get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.083102, "supported_languages": null}, "macro.dbt.drop_materialized_view": {"name": "drop_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/drop.sql", "original_file_path": "macros/relations/materialized_view/drop.sql", "unique_id": "macro.dbt.drop_materialized_view", "macro_sql": "{% macro drop_materialized_view(relation) -%}\n    {{ return(adapter.dispatch('drop_materialized_view', 'dbt')(relation)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.08337, "supported_languages": null}, "macro.dbt.default__drop_materialized_view": {"name": "default__drop_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/drop.sql", "original_file_path": "macros/relations/materialized_view/drop.sql", "unique_id": "macro.dbt.default__drop_materialized_view", "macro_sql": "{% macro default__drop_materialized_view(relation) -%}\n    drop materialized view if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.083482, "supported_languages": null}, "macro.dbt.get_replace_materialized_view_sql": {"name": "get_replace_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/replace.sql", "original_file_path": "macros/relations/materialized_view/replace.sql", "unique_id": "macro.dbt.get_replace_materialized_view_sql", "macro_sql": "{% macro get_replace_materialized_view_sql(relation, sql) %}\n    {{- adapter.dispatch('get_replace_materialized_view_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_replace_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.083756, "supported_languages": null}, "macro.dbt.default__get_replace_materialized_view_sql": {"name": "default__get_replace_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/replace.sql", "original_file_path": "macros/relations/materialized_view/replace.sql", "unique_id": "macro.dbt.default__get_replace_materialized_view_sql", "macro_sql": "{% macro default__get_replace_materialized_view_sql(relation, sql) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_replace_materialized_view_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.08391, "supported_languages": null}, "macro.dbt.refresh_materialized_view": {"name": "refresh_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/refresh.sql", "original_file_path": "macros/relations/materialized_view/refresh.sql", "unique_id": "macro.dbt.refresh_materialized_view", "macro_sql": "{% macro refresh_materialized_view(relation) %}\n    {{- log('Applying REFRESH to: ' ~ relation) -}}\n    {{- adapter.dispatch('refresh_materialized_view', 'dbt')(relation) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__refresh_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.084237, "supported_languages": null}, "macro.dbt.default__refresh_materialized_view": {"name": "default__refresh_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/refresh.sql", "original_file_path": "macros/relations/materialized_view/refresh.sql", "unique_id": "macro.dbt.default__refresh_materialized_view", "macro_sql": "{% macro default__refresh_materialized_view(relation) %}\n    {{ exceptions.raise_compiler_error(\"`refresh_materialized_view` has not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.084434, "supported_languages": null}, "macro.dbt.get_rename_materialized_view_sql": {"name": "get_rename_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/rename.sql", "original_file_path": "macros/relations/materialized_view/rename.sql", "unique_id": "macro.dbt.get_rename_materialized_view_sql", "macro_sql": "{% macro get_rename_materialized_view_sql(relation, new_name) %}\n    {{- adapter.dispatch('get_rename_materialized_view_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_rename_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0847092, "supported_languages": null}, "macro.dbt.default__get_rename_materialized_view_sql": {"name": "default__get_rename_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/rename.sql", "original_file_path": "macros/relations/materialized_view/rename.sql", "unique_id": "macro.dbt.default__get_rename_materialized_view_sql", "macro_sql": "{% macro default__get_rename_materialized_view_sql(relation, new_name) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_rename_materialized_view_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.084853, "supported_languages": null}, "macro.dbt.get_alter_materialized_view_as_sql": {"name": "get_alter_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.get_alter_materialized_view_as_sql", "macro_sql": "{% macro get_alter_materialized_view_as_sql(\n    relation,\n    configuration_changes,\n    sql,\n    existing_relation,\n    backup_relation,\n    intermediate_relation\n) %}\n    {{- log('Applying ALTER to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_alter_materialized_view_as_sql', 'dbt')(\n        relation,\n        configuration_changes,\n        sql,\n        existing_relation,\n        backup_relation,\n        intermediate_relation\n    ) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_alter_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0854678, "supported_languages": null}, "macro.dbt.default__get_alter_materialized_view_as_sql": {"name": "default__get_alter_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.default__get_alter_materialized_view_as_sql", "macro_sql": "{% macro default__get_alter_materialized_view_as_sql(\n    relation,\n    configuration_changes,\n    sql,\n    existing_relation,\n    backup_relation,\n    intermediate_relation\n) %}\n    {{ exceptions.raise_compiler_error(\"Materialized views have not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.08566, "supported_languages": null}, "macro.dbt.get_materialized_view_configuration_changes": {"name": "get_materialized_view_configuration_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.get_materialized_view_configuration_changes", "macro_sql": "{% macro get_materialized_view_configuration_changes(existing_relation, new_config) %}\n    /* {#\n    It's recommended that configuration changes be formatted as follows:\n    {\"<change_category>\": [{\"action\": \"<name>\", \"context\": ...}]}\n\n    For example:\n    {\n        \"indexes\": [\n            {\"action\": \"drop\", \"context\": \"index_abc\"},\n            {\"action\": \"create\", \"context\": {\"columns\": [\"column_1\", \"column_2\"], \"type\": \"hash\", \"unique\": True}},\n        ],\n    }\n\n    Either way, `get_materialized_view_configuration_changes` needs to align with `get_alter_materialized_view_as_sql`.\n    #} */\n    {{- log('Determining configuration changes on: ' ~ existing_relation) -}}\n    {%- do return(adapter.dispatch('get_materialized_view_configuration_changes', 'dbt')(existing_relation, new_config)) -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_materialized_view_configuration_changes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0859442, "supported_languages": null}, "macro.dbt.default__get_materialized_view_configuration_changes": {"name": "default__get_materialized_view_configuration_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.default__get_materialized_view_configuration_changes", "macro_sql": "{% macro default__get_materialized_view_configuration_changes(existing_relation, new_config) %}\n    {{ exceptions.raise_compiler_error(\"Materialized views have not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.086091, "supported_languages": null}, "macro.dbt.get_create_materialized_view_as_sql": {"name": "get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/create.sql", "original_file_path": "macros/relations/materialized_view/create.sql", "unique_id": "macro.dbt.get_create_materialized_view_as_sql", "macro_sql": "{% macro get_create_materialized_view_as_sql(relation, sql) -%}\n    {{- adapter.dispatch('get_create_materialized_view_as_sql', 'dbt')(relation, sql) -}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.086365, "supported_languages": null}, "macro.dbt.default__get_create_materialized_view_as_sql": {"name": "default__get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/create.sql", "original_file_path": "macros/relations/materialized_view/create.sql", "unique_id": "macro.dbt.default__get_create_materialized_view_as_sql", "macro_sql": "{% macro default__get_create_materialized_view_as_sql(relation, sql) -%}\n    {{ exceptions.raise_compiler_error(\n        \"`get_create_materialized_view_as_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0865111, "supported_languages": null}, "macro.dbt.get_table_columns_and_constraints": {"name": "get_table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.get_table_columns_and_constraints", "macro_sql": "{%- macro get_table_columns_and_constraints() -%}\n  {{ adapter.dispatch('get_table_columns_and_constraints', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__get_table_columns_and_constraints"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.087512, "supported_languages": null}, "macro.dbt.default__get_table_columns_and_constraints": {"name": "default__get_table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__get_table_columns_and_constraints", "macro_sql": "{% macro default__get_table_columns_and_constraints() -%}\n  {{ return(table_columns_and_constraints()) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.table_columns_and_constraints"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.087632, "supported_languages": null}, "macro.dbt.table_columns_and_constraints": {"name": "table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.table_columns_and_constraints", "macro_sql": "{% macro table_columns_and_constraints() %}\n  {# loop through user_provided_columns to create DDL with data types and constraints #}\n    {%- set raw_column_constraints = adapter.render_raw_columns_constraints(raw_columns=model['columns']) -%}\n    {%- set raw_model_constraints = adapter.render_raw_model_constraints(raw_constraints=model['constraints']) -%}\n    (\n    {% for c in raw_column_constraints -%}\n      {{ c }}{{ \",\" if not loop.last or raw_model_constraints }}\n    {% endfor %}\n    {% for c in raw_model_constraints -%}\n        {{ c }}{{ \",\" if not loop.last }}\n    {% endfor -%}\n    )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.088177, "supported_languages": null}, "macro.dbt.get_assert_columns_equivalent": {"name": "get_assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.get_assert_columns_equivalent", "macro_sql": "\n\n{%- macro get_assert_columns_equivalent(sql) -%}\n  {{ adapter.dispatch('get_assert_columns_equivalent', 'dbt')(sql) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.088348, "supported_languages": null}, "macro.dbt.default__get_assert_columns_equivalent": {"name": "default__get_assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__get_assert_columns_equivalent", "macro_sql": "{% macro default__get_assert_columns_equivalent(sql) -%}\n  {{ return(assert_columns_equivalent(sql)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.088483, "supported_languages": null}, "macro.dbt.assert_columns_equivalent": {"name": "assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.assert_columns_equivalent", "macro_sql": "{% macro assert_columns_equivalent(sql) %}\n\n  {#-- First ensure the user has defined 'columns' in yaml specification --#}\n  {%- set user_defined_columns = model['columns'] -%}\n  {%- if not user_defined_columns -%}\n      {{ exceptions.raise_contract_error([], []) }}\n  {%- endif -%}\n\n  {#-- Obtain the column schema provided by sql file. #}\n  {%- set sql_file_provided_columns = get_column_schema_from_query(sql, config.get('sql_header', none)) -%}\n  {#--Obtain the column schema provided by the schema file by generating an 'empty schema' query from the model's columns. #}\n  {%- set schema_file_provided_columns = get_column_schema_from_query(get_empty_schema_sql(user_defined_columns)) -%}\n\n  {#-- create dictionaries with name and formatted data type and strings for exception #}\n  {%- set sql_columns = format_columns(sql_file_provided_columns) -%}\n  {%- set yaml_columns = format_columns(schema_file_provided_columns)  -%}\n\n  {%- if sql_columns|length != yaml_columns|length -%}\n    {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n  {%- endif -%}\n\n  {%- for sql_col in sql_columns -%}\n    {%- set yaml_col = [] -%}\n    {%- for this_col in yaml_columns -%}\n      {%- if this_col['name'] == sql_col['name'] -%}\n        {%- do yaml_col.append(this_col) -%}\n        {%- break -%}\n      {%- endif -%}\n    {%- endfor -%}\n    {%- if not yaml_col -%}\n      {#-- Column with name not found in yaml #}\n      {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n    {%- endif -%}\n    {%- if sql_col['formatted'] != yaml_col[0]['formatted'] -%}\n      {#-- Column data types don't match #}\n      {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n    {%- endif -%}\n  {%- endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_column_schema_from_query", "macro.dbt.get_empty_schema_sql", "macro.dbt.format_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0899572, "supported_languages": null}, "macro.dbt.format_columns": {"name": "format_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.format_columns", "macro_sql": "{% macro format_columns(columns) %}\n  {% set formatted_columns = [] %}\n  {% for column in columns %}\n    {%- set formatted_column = adapter.dispatch('format_column', 'dbt')(column) -%}\n    {%- do formatted_columns.append(formatted_column) -%}\n  {% endfor %}\n  {{ return(formatted_columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__format_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0903602, "supported_languages": null}, "macro.dbt.default__format_column": {"name": "default__format_column", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__format_column", "macro_sql": "{% macro default__format_column(column) -%}\n  {% set data_type = column.dtype %}\n  {% set formatted = column.column.lower() ~ \" \" ~ data_type %}\n  {{ return({'name': column.name, 'data_type': data_type, 'formatted': formatted}) }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0907142, "supported_languages": null}, "macro.dbt.drop_table": {"name": "drop_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt.drop_table", "macro_sql": "{% macro drop_table(relation) -%}\n    {{ return(adapter.dispatch('drop_table', 'dbt')(relation)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.090987, "supported_languages": null}, "macro.dbt.default__drop_table": {"name": "default__drop_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt.default__drop_table", "macro_sql": "{% macro default__drop_table(relation) -%}\n    drop table if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.091094, "supported_languages": null}, "macro.dbt.get_replace_table_sql": {"name": "get_replace_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt.get_replace_table_sql", "macro_sql": "{% macro get_replace_table_sql(relation, sql) %}\n    {{- adapter.dispatch('get_replace_table_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_replace_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0913641, "supported_languages": null}, "macro.dbt.default__get_replace_table_sql": {"name": "default__get_replace_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt.default__get_replace_table_sql", "macro_sql": "{% macro default__get_replace_table_sql(relation, sql) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_replace_table_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0915132, "supported_languages": null}, "macro.dbt.get_rename_table_sql": {"name": "get_rename_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt.get_rename_table_sql", "macro_sql": "{% macro get_rename_table_sql(relation, new_name) %}\n    {{- adapter.dispatch('get_rename_table_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_rename_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.091784, "supported_languages": null}, "macro.dbt.default__get_rename_table_sql": {"name": "default__get_rename_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt.default__get_rename_table_sql", "macro_sql": "{% macro default__get_rename_table_sql(relation, new_name) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_rename_table_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.091933, "supported_languages": null}, "macro.dbt.get_create_table_as_sql": {"name": "get_create_table_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.get_create_table_as_sql", "macro_sql": "{% macro get_create_table_as_sql(temporary, relation, sql) -%}\n  {{ adapter.dispatch('get_create_table_as_sql', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_table_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.092787, "supported_languages": null}, "macro.dbt.default__get_create_table_as_sql": {"name": "default__get_create_table_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_create_table_as_sql", "macro_sql": "{% macro default__get_create_table_as_sql(temporary, relation, sql) -%}\n  {{ return(create_table_as(temporary, relation, sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.092972, "supported_languages": null}, "macro.dbt.create_table_as": {"name": "create_table_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, compiled_code, language='sql') -%}\n  {# backward compatibility for create_table_as that does not support language #}\n  {% if language == \"sql\" %}\n    {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, compiled_code)}}\n  {% else %}\n    {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, compiled_code, language) }}\n  {% endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.093416, "supported_languages": null}, "macro.dbt.default__create_table_as": {"name": "default__create_table_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__create_table_as", "macro_sql": "{% macro default__create_table_as(temporary, relation, sql) -%}\n  {%- set sql_header = config.get('sql_header', none) -%}\n\n  {{ sql_header if sql_header is not none }}\n\n  create {% if temporary: -%}temporary{%- endif %} table\n    {{ relation.include(database=(not temporary), schema=(not temporary)) }}\n  {% set contract_config = config.get('contract') %}\n  {% if contract_config.enforced and (not temporary) %}\n    {{ get_assert_columns_equivalent(sql) }}\n    {{ get_table_columns_and_constraints() }}\n    {%- set sql = get_select_subquery(sql) %}\n  {% endif %}\n  as (\n    {{ sql }}\n  );\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent", "macro.dbt.get_table_columns_and_constraints", "macro.dbt.get_select_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.094121, "supported_languages": null}, "macro.dbt.default__get_column_names": {"name": "default__get_column_names", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_column_names", "macro_sql": "{% macro default__get_column_names() %}\n  {#- loop through user_provided_columns to get column names -#}\n    {%- set user_provided_columns = model['columns'] -%}\n    {%- for i in user_provided_columns %}\n      {%- set col = user_provided_columns[i] -%}\n      {%- set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] -%}\n      {{ col_name }}{{ \", \" if not loop.last }}\n    {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.094591, "supported_languages": null}, "macro.dbt.get_select_subquery": {"name": "get_select_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.get_select_subquery", "macro_sql": "{% macro get_select_subquery(sql) %}\n  {{ return(adapter.dispatch('get_select_subquery', 'dbt')(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_select_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.094781, "supported_languages": null}, "macro.dbt.default__get_select_subquery": {"name": "default__get_select_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_select_subquery", "macro_sql": "{% macro default__get_select_subquery(sql) %}\n    select {{ adapter.dispatch('get_column_names', 'dbt')() }}\n    from (\n        {{ sql }}\n    ) as model_subq\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_column_names"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0949628, "supported_languages": null}, "macro.dbt.drop_view": {"name": "drop_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt.drop_view", "macro_sql": "{% macro drop_view(relation) -%}\n    {{ return(adapter.dispatch('drop_view', 'dbt')(relation)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0952299, "supported_languages": null}, "macro.dbt.default__drop_view": {"name": "default__drop_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt.default__drop_view", "macro_sql": "{% macro default__drop_view(relation) -%}\n    drop view if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.095337, "supported_languages": null}, "macro.dbt.get_replace_view_sql": {"name": "get_replace_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.get_replace_view_sql", "macro_sql": "{% macro get_replace_view_sql(relation, sql) %}\n    {{- adapter.dispatch('get_replace_view_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_replace_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0961988, "supported_languages": null}, "macro.dbt.default__get_replace_view_sql": {"name": "default__get_replace_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.default__get_replace_view_sql", "macro_sql": "{% macro default__get_replace_view_sql(relation, sql) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_replace_view_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0963461, "supported_languages": null}, "macro.dbt.create_or_replace_view": {"name": "create_or_replace_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.create_or_replace_view", "macro_sql": "{% macro create_or_replace_view() %}\n  {%- set identifier = model['alias'] -%}\n\n  {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n  {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n  {%- set target_relation = api.Relation.create(\n      identifier=identifier, schema=schema, database=database,\n      type='view') -%}\n  {% set grant_config = config.get('grants') %}\n\n  {{ run_hooks(pre_hooks) }}\n\n  -- If there's a table with the same name and we weren't told to full refresh,\n  -- that's an error. If we were told to full refresh, drop it. This behavior differs\n  -- for Snowflake and BigQuery, so multiple dispatch is used.\n  {%- if old_relation is not none and old_relation.is_table -%}\n    {{ handle_existing_table(should_full_refresh(), old_relation) }}\n  {%- endif -%}\n\n  -- build model\n  {% call statement('main') -%}\n    {{ get_create_view_as_sql(target_relation, sql) }}\n  {%- endcall %}\n\n  {% set should_revoke = should_revoke(exists_as_view, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {{ run_hooks(post_hooks) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.097559, "supported_languages": null}, "macro.dbt.handle_existing_table": {"name": "handle_existing_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n    {{ adapter.dispatch('handle_existing_table', 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__handle_existing_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.09776, "supported_languages": null}, "macro.dbt.default__handle_existing_table": {"name": "default__handle_existing_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n    {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n    {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.097989, "supported_languages": null}, "macro.dbt.get_rename_view_sql": {"name": "get_rename_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt.get_rename_view_sql", "macro_sql": "{% macro get_rename_view_sql(relation, new_name) %}\n    {{- adapter.dispatch('get_rename_view_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_rename_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.098264, "supported_languages": null}, "macro.dbt.default__get_rename_view_sql": {"name": "default__get_rename_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt.default__get_rename_view_sql", "macro_sql": "{% macro default__get_rename_view_sql(relation, new_name) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_rename_view_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.098411, "supported_languages": null}, "macro.dbt.get_create_view_as_sql": {"name": "get_create_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.get_create_view_as_sql", "macro_sql": "{% macro get_create_view_as_sql(relation, sql) -%}\n  {{ adapter.dispatch('get_create_view_as_sql', 'dbt')(relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.09883, "supported_languages": null}, "macro.dbt.default__get_create_view_as_sql": {"name": "default__get_create_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.default__get_create_view_as_sql", "macro_sql": "{% macro default__get_create_view_as_sql(relation, sql) -%}\n  {{ return(create_view_as(relation, sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0989969, "supported_languages": null}, "macro.dbt.create_view_as": {"name": "create_view_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n  {{ adapter.dispatch('create_view_as', 'dbt')(relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.099179, "supported_languages": null}, "macro.dbt.default__create_view_as": {"name": "default__create_view_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.default__create_view_as", "macro_sql": "{% macro default__create_view_as(relation, sql) -%}\n  {%- set sql_header = config.get('sql_header', none) -%}\n\n  {{ sql_header if sql_header is not none }}\n  create view {{ relation }}\n    {% set contract_config = config.get('contract') %}\n    {% if contract_config.enforced %}\n      {{ get_assert_columns_equivalent(sql) }}\n    {%- endif %}\n  as (\n    {{ sql }}\n  );\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0996091, "supported_languages": null}, "macro.dbt.default__test_relationships": {"name": "default__test_relationships", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/relationships.sql", "original_file_path": "macros/generic_test_sql/relationships.sql", "unique_id": "macro.dbt.default__test_relationships", "macro_sql": "{% macro default__test_relationships(model, column_name, to, field) %}\n\nwith child as (\n    select {{ column_name }} as from_field\n    from {{ model }}\n    where {{ column_name }} is not null\n),\n\nparent as (\n    select {{ field }} as to_field\n    from {{ to }}\n)\n\nselect\n    from_field\n\nfrom child\nleft join parent\n    on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.099966, "supported_languages": null}, "macro.dbt.default__test_not_null": {"name": "default__test_not_null", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/not_null.sql", "original_file_path": "macros/generic_test_sql/not_null.sql", "unique_id": "macro.dbt.default__test_not_null", "macro_sql": "{% macro default__test_not_null(model, column_name) %}\n\n{% set column_list = '*' if should_store_failures() else column_name %}\n\nselect {{ column_list }}\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_store_failures"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1002638, "supported_languages": null}, "macro.dbt.default__test_unique": {"name": "default__test_unique", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/unique.sql", "original_file_path": "macros/generic_test_sql/unique.sql", "unique_id": "macro.dbt.default__test_unique", "macro_sql": "{% macro default__test_unique(model, column_name) %}\n\nselect\n    {{ column_name }} as unique_field,\n    count(*) as n_records\n\nfrom {{ model }}\nwhere {{ column_name }} is not null\ngroup by {{ column_name }}\nhaving count(*) > 1\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.100513, "supported_languages": null}, "macro.dbt.default__test_accepted_values": {"name": "default__test_accepted_values", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/accepted_values.sql", "original_file_path": "macros/generic_test_sql/accepted_values.sql", "unique_id": "macro.dbt.default__test_accepted_values", "macro_sql": "{% macro default__test_accepted_values(model, column_name, values, quote=True) %}\n\nwith all_values as (\n\n    select\n        {{ column_name }} as value_field,\n        count(*) as n_records\n\n    from {{ model }}\n    group by {{ column_name }}\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n    {% for value in values -%}\n        {% if quote -%}\n        '{{ value }}'\n        {%- else -%}\n        {{ value }}\n        {%- endif -%}\n        {%- if not loop.last -%},{%- endif %}\n    {%- endfor %}\n)\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.101089, "supported_languages": null}, "macro.dbt.statement": {"name": "statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.statement", "macro_sql": "\n{%- macro statement(name=None, fetch_result=False, auto_begin=True, language='sql') -%}\n  {%- if execute: -%}\n    {%- set compiled_code = caller() -%}\n\n    {%- if name == 'main' -%}\n      {{ log('Writing runtime {} for node \"{}\"'.format(language, model['unique_id'])) }}\n      {{ write(compiled_code) }}\n    {%- endif -%}\n    {%- if language == 'sql'-%}\n      {%- set res, table = adapter.execute(compiled_code, auto_begin=auto_begin, fetch=fetch_result) -%}\n    {%- elif language == 'python' -%}\n      {%- set res = submit_python_job(model, compiled_code) -%}\n      {#-- TODO: What should table be for python models? --#}\n      {%- set table = None -%}\n    {%- else -%}\n      {% do exceptions.raise_compiler_error(\"statement macro didn't get supported language\") %}\n    {%- endif -%}\n\n    {%- if name is not none -%}\n      {{ store_result(name, response=res, agate_table=table) }}\n    {%- endif -%}\n\n  {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.102566, "supported_languages": null}, "macro.dbt.noop_statement": {"name": "noop_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.noop_statement", "macro_sql": "{% macro noop_statement(name=None, message=None, code=None, rows_affected=None, res=None) -%}\n  {%- set sql = caller() -%}\n\n  {%- if name == 'main' -%}\n    {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n    {{ write(sql) }}\n  {%- endif -%}\n\n  {%- if name is not none -%}\n    {{ store_raw_result(name, message=message, code=code, rows_affected=rows_affected, agate_table=res) }}\n  {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.103153, "supported_languages": null}, "macro.dbt.run_query": {"name": "run_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.run_query", "macro_sql": "{% macro run_query(sql) %}\n  {% call statement(\"run_query_statement\", fetch_result=true, auto_begin=false) %}\n    {{ sql }}\n  {% endcall %}\n\n  {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.103449, "supported_languages": null}, "macro.dbt.convert_datetime": {"name": "convert_datetime", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.convert_datetime", "macro_sql": "{% macro convert_datetime(date_str, date_fmt) %}\n\n  {% set error_msg -%}\n      The provided partition date '{{ date_str }}' does not match the expected format '{{ date_fmt }}'\n  {%- endset %}\n\n  {% set res = try_or_compiler_error(error_msg, modules.datetime.datetime.strptime, date_str.strip(), date_fmt) %}\n  {{ return(res) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.105291, "supported_languages": null}, "macro.dbt.dates_in_range": {"name": "dates_in_range", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.dates_in_range", "macro_sql": "{% macro dates_in_range(start_date_str, end_date_str=none, in_fmt=\"%Y%m%d\", out_fmt=\"%Y%m%d\") %}\n    {% set end_date_str = start_date_str if end_date_str is none else end_date_str %}\n\n    {% set start_date = convert_datetime(start_date_str, in_fmt) %}\n    {% set end_date = convert_datetime(end_date_str, in_fmt) %}\n\n    {% set day_count = (end_date - start_date).days %}\n    {% if day_count < 0 %}\n        {% set msg -%}\n            Partition start date is after the end date ({{ start_date }}, {{ end_date }})\n        {%- endset %}\n\n        {{ exceptions.raise_compiler_error(msg, model) }}\n    {% endif %}\n\n    {% set date_list = [] %}\n    {% for i in range(0, day_count + 1) %}\n        {% set the_date = (modules.datetime.timedelta(days=i) + start_date) %}\n        {% if not out_fmt %}\n            {% set _ = date_list.append(the_date) %}\n        {% else %}\n            {% set _ = date_list.append(the_date.strftime(out_fmt)) %}\n        {% endif %}\n    {% endfor %}\n\n    {{ return(date_list) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.convert_datetime"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.106573, "supported_languages": null}, "macro.dbt.partition_range": {"name": "partition_range", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.partition_range", "macro_sql": "{% macro partition_range(raw_partition_date, date_fmt='%Y%m%d') %}\n    {% set partition_range = (raw_partition_date | string).split(\",\") %}\n\n    {% if (partition_range | length) == 1 %}\n      {% set start_date = partition_range[0] %}\n      {% set end_date = none %}\n    {% elif (partition_range | length) == 2 %}\n      {% set start_date = partition_range[0] %}\n      {% set end_date = partition_range[1] %}\n    {% else %}\n      {{ exceptions.raise_compiler_error(\"Invalid partition time. Expected format: {Start Date}[,{End Date}]. Got: \" ~ raw_partition_date) }}\n    {% endif %}\n\n    {{ return(dates_in_range(start_date, end_date, in_fmt=date_fmt)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dates_in_range"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.107337, "supported_languages": null}, "macro.dbt.py_current_timestring": {"name": "py_current_timestring", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.py_current_timestring", "macro_sql": "{% macro py_current_timestring() %}\n    {% set dt = modules.datetime.datetime.now() %}\n    {% do return(dt.strftime(\"%Y%m%d%H%M%S%f\")) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.107572, "supported_languages": null}, "macro.dbt.except": {"name": "except", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/except.sql", "original_file_path": "macros/utils/except.sql", "unique_id": "macro.dbt.except", "macro_sql": "{% macro except() %}\n  {{ return(adapter.dispatch('except', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1078022, "supported_languages": null}, "macro.dbt.default__except": {"name": "default__except", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/except.sql", "original_file_path": "macros/utils/except.sql", "unique_id": "macro.dbt.default__except", "macro_sql": "{% macro default__except() %}\n\n    except\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.107881, "supported_languages": null}, "macro.dbt.get_intervals_between": {"name": "get_intervals_between", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n    {{ return(adapter.dispatch('get_intervals_between', 'dbt')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.108664, "supported_languages": null}, "macro.dbt.default__get_intervals_between": {"name": "default__get_intervals_between", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n    {%- call statement('get_intervals_between', fetch_result=True) %}\n\n        select {{ dbt.datediff(start_date, end_date, datepart) }}\n\n    {%- endcall -%}\n\n    {%- set value_list = load_result('get_intervals_between') -%}\n\n    {%- if value_list and value_list['data'] -%}\n        {%- set values = value_list['data'] | map(attribute=0) | list %}\n        {{ return(values[0]) }}\n    {%- else -%}\n        {{ return(1) }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.109269, "supported_languages": null}, "macro.dbt.date_spine": {"name": "date_spine", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n    {{ return(adapter.dispatch('date_spine', 'dbt')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.109505, "supported_languages": null}, "macro.dbt.default__date_spine": {"name": "default__date_spine", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n    {# call as follows:\n\n    date_spine(\n        \"day\",\n        \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n        \"dbt.dateadd(week, 1, current_date)\"\n    ) #}\n\n\n    with rawdata as (\n\n        {{dbt.generate_series(\n            dbt.get_intervals_between(start_date, end_date, datepart)\n        )}}\n\n    ),\n\n    all_periods as (\n\n        select (\n            {{\n                dbt.dateadd(\n                    datepart,\n                    \"row_number() over (order by 1) - 1\",\n                    start_date\n                )\n            }}\n        ) as date_{{datepart}}\n        from rawdata\n\n    ),\n\n    filtered as (\n\n        select *\n        from all_periods\n        where date_{{datepart}} <= {{ end_date }}\n\n    )\n\n    select * from filtered\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.generate_series", "macro.dbt.get_intervals_between", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.109882, "supported_languages": null}, "macro.dbt.replace": {"name": "replace", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/replace.sql", "original_file_path": "macros/utils/replace.sql", "unique_id": "macro.dbt.replace", "macro_sql": "{% macro replace(field, old_chars, new_chars) -%}\n    {{ return(adapter.dispatch('replace', 'dbt') (field, old_chars, new_chars)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__replace"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.110215, "supported_languages": null}, "macro.dbt.default__replace": {"name": "default__replace", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/replace.sql", "original_file_path": "macros/utils/replace.sql", "unique_id": "macro.dbt.default__replace", "macro_sql": "{% macro default__replace(field, old_chars, new_chars) %}\n\n    replace(\n        {{ field }},\n        {{ old_chars }},\n        {{ new_chars }}\n    )\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.110383, "supported_languages": null}, "macro.dbt.concat": {"name": "concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/concat.sql", "original_file_path": "macros/utils/concat.sql", "unique_id": "macro.dbt.concat", "macro_sql": "{% macro concat(fields) -%}\n  {{ return(adapter.dispatch('concat', 'dbt')(fields)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1106281, "supported_languages": null}, "macro.dbt.default__concat": {"name": "default__concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/concat.sql", "original_file_path": "macros/utils/concat.sql", "unique_id": "macro.dbt.default__concat", "macro_sql": "{% macro default__concat(fields) -%}\n    {{ fields|join(' || ') }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.110755, "supported_languages": null}, "macro.dbt.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n    {{ return(adapter.dispatch('get_powers_of_two', 'dbt')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.111595, "supported_languages": null}, "macro.dbt.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n    {% if upper_bound <= 0 %}\n    {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n    {% endif %}\n\n    {% for _ in range(1, 100) %}\n       {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n    {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1120179, "supported_languages": null}, "macro.dbt.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n    {{ return(adapter.dispatch('generate_series', 'dbt')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.112216, "supported_languages": null}, "macro.dbt.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n    {% set n = dbt.get_powers_of_two(upper_bound) %}\n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    {% for i in range(n) %}\n    p{{i}}.generated_number * power(2, {{i}})\n    {% if not loop.last %} + {% endif %}\n    {% endfor %}\n    + 1\n    as generated_number\n\n    from\n\n    {% for i in range(n) %}\n    p as p{{i}}\n    {% if not loop.last %} cross join {% endif %}\n    {% endfor %}\n\n    )\n\n    select *\n    from unioned\n    where generated_number <= {{upper_bound}}\n    order by generated_number\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.112743, "supported_languages": null}, "macro.dbt.length": {"name": "length", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/length.sql", "original_file_path": "macros/utils/length.sql", "unique_id": "macro.dbt.length", "macro_sql": "{% macro length(expression) -%}\n    {{ return(adapter.dispatch('length', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__length"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1130009, "supported_languages": null}, "macro.dbt.default__length": {"name": "default__length", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/length.sql", "original_file_path": "macros/utils/length.sql", "unique_id": "macro.dbt.default__length", "macro_sql": "{% macro default__length(expression) %}\n\n    length(\n        {{ expression }}\n    )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1131089, "supported_languages": null}, "macro.dbt.dateadd": {"name": "dateadd", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/dateadd.sql", "original_file_path": "macros/utils/dateadd.sql", "unique_id": "macro.dbt.dateadd", "macro_sql": "{% macro dateadd(datepart, interval, from_date_or_timestamp) %}\n  {{ return(adapter.dispatch('dateadd', 'dbt')(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1134489, "supported_languages": null}, "macro.dbt.default__dateadd": {"name": "default__dateadd", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/dateadd.sql", "original_file_path": "macros/utils/dateadd.sql", "unique_id": "macro.dbt.default__dateadd", "macro_sql": "{% macro default__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n    dateadd(\n        {{ datepart }},\n        {{ interval }},\n        {{ from_date_or_timestamp }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1136231, "supported_languages": null}, "macro.dbt.intersect": {"name": "intersect", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/intersect.sql", "original_file_path": "macros/utils/intersect.sql", "unique_id": "macro.dbt.intersect", "macro_sql": "{% macro intersect() %}\n  {{ return(adapter.dispatch('intersect', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__intersect"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.113847, "supported_languages": null}, "macro.dbt.default__intersect": {"name": "default__intersect", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/intersect.sql", "original_file_path": "macros/utils/intersect.sql", "unique_id": "macro.dbt.default__intersect", "macro_sql": "{% macro default__intersect() %}\n\n    intersect\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.113993, "supported_languages": null}, "macro.dbt.escape_single_quotes": {"name": "escape_single_quotes", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt.escape_single_quotes", "macro_sql": "{% macro escape_single_quotes(expression) %}\n      {{ return(adapter.dispatch('escape_single_quotes', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__escape_single_quotes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.114259, "supported_languages": null}, "macro.dbt.default__escape_single_quotes": {"name": "default__escape_single_quotes", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt.default__escape_single_quotes", "macro_sql": "{% macro default__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\",\"''\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.114402, "supported_languages": null}, "macro.dbt.right": {"name": "right", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt.right", "macro_sql": "{% macro right(string_text, length_expression) -%}\n    {{ return(adapter.dispatch('right', 'dbt') (string_text, length_expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__right"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.114696, "supported_languages": null}, "macro.dbt.default__right": {"name": "default__right", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt.default__right", "macro_sql": "{% macro default__right(string_text, length_expression) %}\n\n    right(\n        {{ string_text }},\n        {{ length_expression }}\n    )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.114835, "supported_languages": null}, "macro.dbt.listagg": {"name": "listagg", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/listagg.sql", "original_file_path": "macros/utils/listagg.sql", "unique_id": "macro.dbt.listagg", "macro_sql": "{% macro listagg(measure, delimiter_text=\"','\", order_by_clause=none, limit_num=none) -%}\n    {{ return(adapter.dispatch('listagg', 'dbt') (measure, delimiter_text, order_by_clause, limit_num)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__listagg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.115475, "supported_languages": null}, "macro.dbt.default__listagg": {"name": "default__listagg", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/listagg.sql", "original_file_path": "macros/utils/listagg.sql", "unique_id": "macro.dbt.default__listagg", "macro_sql": "{% macro default__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n    {% if limit_num -%}\n    array_to_string(\n        array_slice(\n            array_agg(\n                {{ measure }}\n            ){% if order_by_clause -%}\n            within group ({{ order_by_clause }})\n            {%- endif %}\n            ,0\n            ,{{ limit_num }}\n        ),\n        {{ delimiter_text }}\n        )\n    {%- else %}\n    listagg(\n        {{ measure }},\n        {{ delimiter_text }}\n        )\n        {% if order_by_clause -%}\n        within group ({{ order_by_clause }})\n        {%- endif %}\n    {%- endif %}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.115926, "supported_languages": null}, "macro.dbt.datediff": {"name": "datediff", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/datediff.sql", "original_file_path": "macros/utils/datediff.sql", "unique_id": "macro.dbt.datediff", "macro_sql": "{% macro datediff(first_date, second_date, datepart) %}\n  {{ return(adapter.dispatch('datediff', 'dbt')(first_date, second_date, datepart)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.116267, "supported_languages": null}, "macro.dbt.default__datediff": {"name": "default__datediff", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/datediff.sql", "original_file_path": "macros/utils/datediff.sql", "unique_id": "macro.dbt.default__datediff", "macro_sql": "{% macro default__datediff(first_date, second_date, datepart) -%}\n\n    datediff(\n        {{ datepart }},\n        {{ first_date }},\n        {{ second_date }}\n        )\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.11644, "supported_languages": null}, "macro.dbt.safe_cast": {"name": "safe_cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt.safe_cast", "macro_sql": "{% macro safe_cast(field, type) %}\n  {{ return(adapter.dispatch('safe_cast', 'dbt') (field, type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1167302, "supported_languages": null}, "macro.dbt.default__safe_cast": {"name": "default__safe_cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt.default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n    {# most databases don't support this function yet\n    so we just need to use cast #}\n    cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1168761, "supported_languages": null}, "macro.dbt.hash": {"name": "hash", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/hash.sql", "original_file_path": "macros/utils/hash.sql", "unique_id": "macro.dbt.hash", "macro_sql": "{% macro hash(field) -%}\n  {{ return(adapter.dispatch('hash', 'dbt') (field)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.117135, "supported_languages": null}, "macro.dbt.default__hash": {"name": "default__hash", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/hash.sql", "original_file_path": "macros/utils/hash.sql", "unique_id": "macro.dbt.default__hash", "macro_sql": "{% macro default__hash(field) -%}\n    md5(cast({{ field }} as {{ api.Column.translate_type('string') }}))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1173, "supported_languages": null}, "macro.dbt.cast_bool_to_text": {"name": "cast_bool_to_text", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast_bool_to_text.sql", "original_file_path": "macros/utils/cast_bool_to_text.sql", "unique_id": "macro.dbt.cast_bool_to_text", "macro_sql": "{% macro cast_bool_to_text(field) %}\n  {{ adapter.dispatch('cast_bool_to_text', 'dbt') (field) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.117545, "supported_languages": null}, "macro.dbt.default__cast_bool_to_text": {"name": "default__cast_bool_to_text", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast_bool_to_text.sql", "original_file_path": "macros/utils/cast_bool_to_text.sql", "unique_id": "macro.dbt.default__cast_bool_to_text", "macro_sql": "{% macro default__cast_bool_to_text(field) %}\n    cast({{ field }} as {{ api.Column.translate_type('string') }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.117708, "supported_languages": null}, "macro.dbt.any_value": {"name": "any_value", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/any_value.sql", "original_file_path": "macros/utils/any_value.sql", "unique_id": "macro.dbt.any_value", "macro_sql": "{% macro any_value(expression) -%}\n    {{ return(adapter.dispatch('any_value', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__any_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.117957, "supported_languages": null}, "macro.dbt.default__any_value": {"name": "default__any_value", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/any_value.sql", "original_file_path": "macros/utils/any_value.sql", "unique_id": "macro.dbt.default__any_value", "macro_sql": "{% macro default__any_value(expression) -%}\n\n    any_value({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1180658, "supported_languages": null}, "macro.dbt.position": {"name": "position", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/position.sql", "original_file_path": "macros/utils/position.sql", "unique_id": "macro.dbt.position", "macro_sql": "{% macro position(substring_text, string_text) -%}\n    {{ return(adapter.dispatch('position', 'dbt') (substring_text, string_text)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__position"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.118357, "supported_languages": null}, "macro.dbt.default__position": {"name": "default__position", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/position.sql", "original_file_path": "macros/utils/position.sql", "unique_id": "macro.dbt.default__position", "macro_sql": "{% macro default__position(substring_text, string_text) %}\n\n    position(\n        {{ substring_text }} in {{ string_text }}\n    )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1184928, "supported_languages": null}, "macro.dbt.string_literal": {"name": "string_literal", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/literal.sql", "original_file_path": "macros/utils/literal.sql", "unique_id": "macro.dbt.string_literal", "macro_sql": "{%- macro string_literal(value) -%}\n  {{ return(adapter.dispatch('string_literal', 'dbt') (value)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__string_literal"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.118739, "supported_languages": null}, "macro.dbt.default__string_literal": {"name": "default__string_literal", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/literal.sql", "original_file_path": "macros/utils/literal.sql", "unique_id": "macro.dbt.default__string_literal", "macro_sql": "{% macro default__string_literal(value) -%}\n    '{{ value }}'\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.118901, "supported_languages": null}, "macro.dbt.type_string": {"name": "type_string", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_string", "macro_sql": "\n\n{%- macro type_string() -%}\n  {{ return(adapter.dispatch('type_string', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1198668, "supported_languages": null}, "macro.dbt.default__type_string": {"name": "default__type_string", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_string", "macro_sql": "{% macro default__type_string() %}\n    {{ return(api.Column.translate_type(\"string\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.120023, "supported_languages": null}, "macro.dbt.type_timestamp": {"name": "type_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_timestamp", "macro_sql": "\n\n{%- macro type_timestamp() -%}\n  {{ return(adapter.dispatch('type_timestamp', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.120194, "supported_languages": null}, "macro.dbt.default__type_timestamp": {"name": "default__type_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_timestamp", "macro_sql": "{% macro default__type_timestamp() %}\n    {{ return(api.Column.translate_type(\"timestamp\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.120348, "supported_languages": null}, "macro.dbt.type_float": {"name": "type_float", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_float", "macro_sql": "\n\n{%- macro type_float() -%}\n  {{ return(adapter.dispatch('type_float', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_float"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.120512, "supported_languages": null}, "macro.dbt.default__type_float": {"name": "default__type_float", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_float", "macro_sql": "{% macro default__type_float() %}\n    {{ return(api.Column.translate_type(\"float\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.120665, "supported_languages": null}, "macro.dbt.type_numeric": {"name": "type_numeric", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_numeric", "macro_sql": "\n\n{%- macro type_numeric() -%}\n  {{ return(adapter.dispatch('type_numeric', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.12083, "supported_languages": null}, "macro.dbt.default__type_numeric": {"name": "default__type_numeric", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_numeric", "macro_sql": "{% macro default__type_numeric() %}\n    {{ return(api.Column.numeric_type(\"numeric\", 28, 6)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.121016, "supported_languages": null}, "macro.dbt.type_bigint": {"name": "type_bigint", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_bigint", "macro_sql": "\n\n{%- macro type_bigint() -%}\n  {{ return(adapter.dispatch('type_bigint', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1211789, "supported_languages": null}, "macro.dbt.default__type_bigint": {"name": "default__type_bigint", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_bigint", "macro_sql": "{% macro default__type_bigint() %}\n    {{ return(api.Column.translate_type(\"bigint\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.121333, "supported_languages": null}, "macro.dbt.type_int": {"name": "type_int", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_int", "macro_sql": "\n\n{%- macro type_int() -%}\n  {{ return(adapter.dispatch('type_int', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.121505, "supported_languages": null}, "macro.dbt.default__type_int": {"name": "default__type_int", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_int", "macro_sql": "{%- macro default__type_int() -%}\n  {{ return(api.Column.translate_type(\"integer\")) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.121652, "supported_languages": null}, "macro.dbt.type_boolean": {"name": "type_boolean", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_boolean", "macro_sql": "\n\n{%- macro type_boolean() -%}\n  {{ return(adapter.dispatch('type_boolean', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_boolean"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.121811, "supported_languages": null}, "macro.dbt.default__type_boolean": {"name": "default__type_boolean", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_boolean", "macro_sql": "{%- macro default__type_boolean() -%}\n  {{ return(api.Column.translate_type(\"boolean\")) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.121959, "supported_languages": null}, "macro.dbt.array_concat": {"name": "array_concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_concat.sql", "original_file_path": "macros/utils/array_concat.sql", "unique_id": "macro.dbt.array_concat", "macro_sql": "{% macro array_concat(array_1, array_2) -%}\n  {{ return(adapter.dispatch('array_concat', 'dbt')(array_1, array_2)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__array_concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1222348, "supported_languages": null}, "macro.dbt.default__array_concat": {"name": "default__array_concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_concat.sql", "original_file_path": "macros/utils/array_concat.sql", "unique_id": "macro.dbt.default__array_concat", "macro_sql": "{% macro default__array_concat(array_1, array_2) -%}\n    array_cat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.122373, "supported_languages": null}, "macro.dbt.bool_or": {"name": "bool_or", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt.bool_or", "macro_sql": "{% macro bool_or(expression) -%}\n    {{ return(adapter.dispatch('bool_or', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__bool_or"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1226208, "supported_languages": null}, "macro.dbt.default__bool_or": {"name": "default__bool_or", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt.default__bool_or", "macro_sql": "{% macro default__bool_or(expression) -%}\n\n    bool_or({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.122726, "supported_languages": null}, "macro.dbt.last_day": {"name": "last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.last_day", "macro_sql": "{% macro last_day(date, datepart) %}\n  {{ return(adapter.dispatch('last_day', 'dbt') (date, datepart)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.123065, "supported_languages": null}, "macro.dbt.default_last_day": {"name": "default_last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.default_last_day", "macro_sql": "\n\n{%- macro default_last_day(date, datepart) -%}\n    cast(\n        {{dbt.dateadd('day', '-1',\n        dbt.dateadd(datepart, '1', dbt.date_trunc(datepart, date))\n        )}}\n        as date)\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.123405, "supported_languages": null}, "macro.dbt.default__last_day": {"name": "default__last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.default__last_day", "macro_sql": "{% macro default__last_day(date, datepart) -%}\n    {{dbt.default_last_day(date, datepart)}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.123557, "supported_languages": null}, "macro.dbt.split_part": {"name": "split_part", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt.split_part", "macro_sql": "{% macro split_part(string_text, delimiter_text, part_number) %}\n  {{ return(adapter.dispatch('split_part', 'dbt') (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__split_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.124089, "supported_languages": null}, "macro.dbt.default__split_part": {"name": "default__split_part", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt.default__split_part", "macro_sql": "{% macro default__split_part(string_text, delimiter_text, part_number) %}\n\n    split_part(\n        {{ string_text }},\n        {{ delimiter_text }},\n        {{ part_number }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.124258, "supported_languages": null}, "macro.dbt._split_part_negative": {"name": "_split_part_negative", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt._split_part_negative", "macro_sql": "{% macro _split_part_negative(string_text, delimiter_text, part_number) %}\n\n    split_part(\n        {{ string_text }},\n        {{ delimiter_text }},\n          length({{ string_text }})\n          - length(\n              replace({{ string_text }},  {{ delimiter_text }}, '')\n          ) + 2 + {{ part_number }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.124485, "supported_languages": null}, "macro.dbt.date_trunc": {"name": "date_trunc", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_trunc.sql", "original_file_path": "macros/utils/date_trunc.sql", "unique_id": "macro.dbt.date_trunc", "macro_sql": "{% macro date_trunc(datepart, date) -%}\n  {{ return(adapter.dispatch('date_trunc', 'dbt') (datepart, date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.124761, "supported_languages": null}, "macro.dbt.default__date_trunc": {"name": "default__date_trunc", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_trunc.sql", "original_file_path": "macros/utils/date_trunc.sql", "unique_id": "macro.dbt.default__date_trunc", "macro_sql": "{% macro default__date_trunc(datepart, date) -%}\n    date_trunc('{{datepart}}', {{date}})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.124894, "supported_languages": null}, "macro.dbt.array_construct": {"name": "array_construct", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt.array_construct", "macro_sql": "{% macro array_construct(inputs=[], data_type=api.Column.translate_type('integer')) -%}\n  {{ return(adapter.dispatch('array_construct', 'dbt')(inputs, data_type)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__array_construct"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.125269, "supported_languages": null}, "macro.dbt.default__array_construct": {"name": "default__array_construct", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt.default__array_construct", "macro_sql": "{% macro default__array_construct(inputs, data_type) -%}\n    {% if inputs|length > 0 %}\n    array[ {{ inputs|join(' , ') }} ]\n    {% else %}\n    array[]::{{data_type}}[]\n    {% endif %}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.125514, "supported_languages": null}, "macro.dbt.array_append": {"name": "array_append", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_append.sql", "original_file_path": "macros/utils/array_append.sql", "unique_id": "macro.dbt.array_append", "macro_sql": "{% macro array_append(array, new_element) -%}\n  {{ return(adapter.dispatch('array_append', 'dbt')(array, new_element)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__array_append"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.125797, "supported_languages": null}, "macro.dbt.default__array_append": {"name": "default__array_append", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_append.sql", "original_file_path": "macros/utils/array_append.sql", "unique_id": "macro.dbt.default__array_append", "macro_sql": "{% macro default__array_append(array, new_element) -%}\n    array_append({{ array }}, {{ new_element }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.125931, "supported_languages": null}, "macro.dbt.create_schema": {"name": "create_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n  {{ adapter.dispatch('create_schema', 'dbt')(relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.126303, "supported_languages": null}, "macro.dbt.default__create_schema": {"name": "default__create_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.default__create_schema", "macro_sql": "{% macro default__create_schema(relation) -%}\n  {%- call statement('create_schema') -%}\n    create schema if not exists {{ relation.without_identifier() }}\n  {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.12649, "supported_languages": null}, "macro.dbt.drop_schema": {"name": "drop_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n  {{ adapter.dispatch('drop_schema', 'dbt')(relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.126653, "supported_languages": null}, "macro.dbt.default__drop_schema": {"name": "default__drop_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.default__drop_schema", "macro_sql": "{% macro default__drop_schema(relation) -%}\n  {%- call statement('drop_schema') -%}\n    drop schema if exists {{ relation.without_identifier() }} cascade\n  {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.126838, "supported_languages": null}, "macro.dbt.current_timestamp": {"name": "current_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp", "macro_sql": "{%- macro current_timestamp() -%}\n    {{ adapter.dispatch('current_timestamp', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.127326, "supported_languages": null}, "macro.dbt.default__current_timestamp": {"name": "default__current_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() -%}\n  {{ exceptions.raise_not_implemented(\n    'current_timestamp macro not implemented for adapter ' + adapter.type()) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.127479, "supported_languages": null}, "macro.dbt.snapshot_get_time": {"name": "snapshot_get_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.snapshot_get_time", "macro_sql": "\n\n{%- macro snapshot_get_time() -%}\n    {{ adapter.dispatch('snapshot_get_time', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.127622, "supported_languages": null}, "macro.dbt.default__snapshot_get_time": {"name": "default__snapshot_get_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__snapshot_get_time", "macro_sql": "{% macro default__snapshot_get_time() %}\n    {{ current_timestamp() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.127727, "supported_languages": null}, "macro.dbt.current_timestamp_backcompat": {"name": "current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp_backcompat", "macro_sql": "{% macro current_timestamp_backcompat() %}\n    {{ return(adapter.dispatch('current_timestamp_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__current_timestamp_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1278908, "supported_languages": null}, "macro.dbt.default__current_timestamp_backcompat": {"name": "default__current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp_backcompat", "macro_sql": "{% macro default__current_timestamp_backcompat() %}\n    current_timestamp::timestamp\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.127968, "supported_languages": null}, "macro.dbt.current_timestamp_in_utc_backcompat": {"name": "current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp_in_utc_backcompat", "macro_sql": "{% macro current_timestamp_in_utc_backcompat() %}\n    {{ return(adapter.dispatch('current_timestamp_in_utc_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__current_timestamp_in_utc_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.128201, "supported_languages": null}, "macro.dbt.default__current_timestamp_in_utc_backcompat": {"name": "default__current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp_in_utc_backcompat", "macro_sql": "{% macro default__current_timestamp_in_utc_backcompat() %}\n    {{ return(adapter.dispatch('current_timestamp_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp_backcompat", "macro.dbt_snowflake.snowflake__current_timestamp_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.128372, "supported_languages": null}, "macro.dbt.get_create_index_sql": {"name": "get_create_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_create_index_sql", "macro_sql": "{% macro get_create_index_sql(relation, index_dict) -%}\n  {{ return(adapter.dispatch('get_create_index_sql', 'dbt')(relation, index_dict)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.129209, "supported_languages": null}, "macro.dbt.default__get_create_index_sql": {"name": "default__get_create_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_create_index_sql", "macro_sql": "{% macro default__get_create_index_sql(relation, index_dict) -%}\n  {% do return(None) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.129344, "supported_languages": null}, "macro.dbt.create_indexes": {"name": "create_indexes", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.create_indexes", "macro_sql": "{% macro create_indexes(relation) -%}\n  {{ adapter.dispatch('create_indexes', 'dbt')(relation) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1295009, "supported_languages": null}, "macro.dbt.default__create_indexes": {"name": "default__create_indexes", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__create_indexes", "macro_sql": "{% macro default__create_indexes(relation) -%}\n  {%- set _indexes = config.get('indexes', default=[]) -%}\n\n  {% for _index_dict in _indexes %}\n    {% set create_index_sql = get_create_index_sql(relation, _index_dict) %}\n    {% if create_index_sql %}\n      {% do run_query(create_index_sql) %}\n    {% endif %}\n  {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_create_index_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.129916, "supported_languages": null}, "macro.dbt.get_drop_index_sql": {"name": "get_drop_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_drop_index_sql", "macro_sql": "{% macro get_drop_index_sql(relation, index_name) -%}\n    {{ adapter.dispatch('get_drop_index_sql', 'dbt')(relation, index_name) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_drop_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.130107, "supported_languages": null}, "macro.dbt.default__get_drop_index_sql": {"name": "default__get_drop_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_drop_index_sql", "macro_sql": "{% macro default__get_drop_index_sql(relation, index_name) -%}\n    {{ exceptions.raise_compiler_error(\"`get_drop_index_sql has not been implemented for this adapter.\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1302452, "supported_languages": null}, "macro.dbt.get_show_indexes_sql": {"name": "get_show_indexes_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_show_indexes_sql", "macro_sql": "{% macro get_show_indexes_sql(relation) -%}\n    {{ adapter.dispatch('get_show_indexes_sql', 'dbt')(relation) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_show_indexes_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1304152, "supported_languages": null}, "macro.dbt.default__get_show_indexes_sql": {"name": "default__get_show_indexes_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_show_indexes_sql", "macro_sql": "{% macro default__get_show_indexes_sql(relation) -%}\n    {{ exceptions.raise_compiler_error(\"`get_show_indexes_sql has not been implemented for this adapter.\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.130542, "supported_languages": null}, "macro.dbt.make_intermediate_relation": {"name": "make_intermediate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_intermediate_relation", "macro_sql": "{% macro make_intermediate_relation(base_relation, suffix='__dbt_tmp') %}\n  {{ return(adapter.dispatch('make_intermediate_relation', 'dbt')(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_intermediate_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1325362, "supported_languages": null}, "macro.dbt.default__make_intermediate_relation": {"name": "default__make_intermediate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_intermediate_relation", "macro_sql": "{% macro default__make_intermediate_relation(base_relation, suffix) %}\n    {{ return(default__make_temp_relation(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1327202, "supported_languages": null}, "macro.dbt.make_temp_relation": {"name": "make_temp_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n  {{ return(adapter.dispatch('make_temp_relation', 'dbt')(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1329432, "supported_languages": null}, "macro.dbt.default__make_temp_relation": {"name": "default__make_temp_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_temp_relation", "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n    {%- set temp_identifier = base_relation.identifier ~ suffix -%}\n    {%- set temp_relation = base_relation.incorporate(\n                                path={\"identifier\": temp_identifier}) -%}\n\n    {{ return(temp_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.133248, "supported_languages": null}, "macro.dbt.make_backup_relation": {"name": "make_backup_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_backup_relation", "macro_sql": "{% macro make_backup_relation(base_relation, backup_relation_type, suffix='__dbt_backup') %}\n    {{ return(adapter.dispatch('make_backup_relation', 'dbt')(base_relation, backup_relation_type, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_backup_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.133493, "supported_languages": null}, "macro.dbt.default__make_backup_relation": {"name": "default__make_backup_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_backup_relation", "macro_sql": "{% macro default__make_backup_relation(base_relation, backup_relation_type, suffix) %}\n    {%- set backup_identifier = base_relation.identifier ~ suffix -%}\n    {%- set backup_relation = base_relation.incorporate(\n                                  path={\"identifier\": backup_identifier},\n                                  type=backup_relation_type\n    ) -%}\n    {{ return(backup_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.133815, "supported_languages": null}, "macro.dbt.truncate_relation": {"name": "truncate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.truncate_relation", "macro_sql": "{% macro truncate_relation(relation) -%}\n  {{ return(adapter.dispatch('truncate_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__truncate_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.134, "supported_languages": null}, "macro.dbt.default__truncate_relation": {"name": "default__truncate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__truncate_relation", "macro_sql": "{% macro default__truncate_relation(relation) -%}\n  {% call statement('truncate_relation') -%}\n    truncate table {{ relation }}\n  {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1341639, "supported_languages": null}, "macro.dbt.get_or_create_relation": {"name": "get_or_create_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.get_or_create_relation", "macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) -%}\n  {{ return(adapter.dispatch('get_or_create_relation', 'dbt')(database, schema, identifier, type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_or_create_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1344168, "supported_languages": null}, "macro.dbt.default__get_or_create_relation": {"name": "default__get_or_create_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__get_or_create_relation", "macro_sql": "{% macro default__get_or_create_relation(database, schema, identifier, type) %}\n  {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n  {% if target_relation %}\n    {% do return([true, target_relation]) %}\n  {% endif %}\n\n  {%- set new_relation = api.Relation.create(\n      database=database,\n      schema=schema,\n      identifier=identifier,\n      type=type\n  ) -%}\n  {% do return([false, new_relation]) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.135039, "supported_languages": null}, "macro.dbt.load_cached_relation": {"name": "load_cached_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.load_cached_relation", "macro_sql": "{% macro load_cached_relation(relation) %}\n  {% do return(adapter.get_relation(\n    database=relation.database,\n    schema=relation.schema,\n    identifier=relation.identifier\n  )) -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.135272, "supported_languages": null}, "macro.dbt.load_relation": {"name": "load_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.load_relation", "macro_sql": "{% macro load_relation(relation) %}\n    {{ return(load_cached_relation(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.135416, "supported_languages": null}, "macro.dbt.collect_freshness": {"name": "collect_freshness", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "unique_id": "macro.dbt.collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n  {{ return(adapter.dispatch('collect_freshness', 'dbt')(source, loaded_at_field, filter))}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1358342, "supported_languages": null}, "macro.dbt.default__collect_freshness": {"name": "default__collect_freshness", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "unique_id": "macro.dbt.default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n  {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n    select\n      max({{ loaded_at_field }}) as max_loaded_at,\n      {{ current_timestamp() }} as snapshotted_at\n    from {{ source }}\n    {% if filter %}\n    where {{ filter }}\n    {% endif %}\n  {% endcall %}\n  {{ return(load_result('collect_freshness')) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.136252, "supported_languages": null}, "macro.dbt.validate_sql": {"name": "validate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/validate_sql.sql", "original_file_path": "macros/adapters/validate_sql.sql", "unique_id": "macro.dbt.validate_sql", "macro_sql": "{% macro validate_sql(sql) -%}\n  {{ return(adapter.dispatch('validate_sql', 'dbt')(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__validate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.136535, "supported_languages": null}, "macro.dbt.default__validate_sql": {"name": "default__validate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/validate_sql.sql", "original_file_path": "macros/adapters/validate_sql.sql", "unique_id": "macro.dbt.default__validate_sql", "macro_sql": "{% macro default__validate_sql(sql) -%}\n  {% call statement('validate_sql') -%}\n    explain {{ sql }}\n  {% endcall %}\n  {{ return(load_result('validate_sql')) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1367629, "supported_languages": null}, "macro.dbt.copy_grants": {"name": "copy_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.copy_grants", "macro_sql": "{% macro copy_grants() %}\n    {{ return(adapter.dispatch('copy_grants', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__copy_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1384692, "supported_languages": null}, "macro.dbt.default__copy_grants": {"name": "default__copy_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__copy_grants", "macro_sql": "{% macro default__copy_grants() %}\n    {{ return(True) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1385899, "supported_languages": null}, "macro.dbt.support_multiple_grantees_per_dcl_statement": {"name": "support_multiple_grantees_per_dcl_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.support_multiple_grantees_per_dcl_statement", "macro_sql": "{% macro support_multiple_grantees_per_dcl_statement() %}\n    {{ return(adapter.dispatch('support_multiple_grantees_per_dcl_statement', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__support_multiple_grantees_per_dcl_statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1387599, "supported_languages": null}, "macro.dbt.default__support_multiple_grantees_per_dcl_statement": {"name": "default__support_multiple_grantees_per_dcl_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__support_multiple_grantees_per_dcl_statement", "macro_sql": "\n\n{%- macro default__support_multiple_grantees_per_dcl_statement() -%}\n    {{ return(True) }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.138874, "supported_languages": null}, "macro.dbt.should_revoke": {"name": "should_revoke", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.should_revoke", "macro_sql": "{% macro should_revoke(existing_relation, full_refresh_mode=True) %}\n\n    {% if not existing_relation %}\n        {#-- The table doesn't already exist, so no grants to copy over --#}\n        {{ return(False) }}\n    {% elif full_refresh_mode %}\n        {#-- The object is being REPLACED -- whether grants are copied over depends on the value of user config --#}\n        {{ return(copy_grants()) }}\n    {% else %}\n        {#-- The table is being merged/upserted/inserted -- grants will be carried over --#}\n        {{ return(True) }}\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.copy_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.139222, "supported_languages": null}, "macro.dbt.get_show_grant_sql": {"name": "get_show_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_show_grant_sql", "macro_sql": "{% macro get_show_grant_sql(relation) %}\n    {{ return(adapter.dispatch(\"get_show_grant_sql\", \"dbt\")(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_show_grant_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.139414, "supported_languages": null}, "macro.dbt.default__get_show_grant_sql": {"name": "default__get_show_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_show_grant_sql", "macro_sql": "{% macro default__get_show_grant_sql(relation) %}\n    show grants on {{ relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.139519, "supported_languages": null}, "macro.dbt.get_grant_sql": {"name": "get_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_grant_sql", "macro_sql": "{% macro get_grant_sql(relation, privilege, grantees) %}\n    {{ return(adapter.dispatch('get_grant_sql', 'dbt')(relation, privilege, grantees)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_grant_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.139748, "supported_languages": null}, "macro.dbt.default__get_grant_sql": {"name": "default__get_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_grant_sql", "macro_sql": "\n\n{%- macro default__get_grant_sql(relation, privilege, grantees) -%}\n    grant {{ privilege }} on {{ relation }} to {{ grantees | join(', ') }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.139947, "supported_languages": null}, "macro.dbt.get_revoke_sql": {"name": "get_revoke_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_revoke_sql", "macro_sql": "{% macro get_revoke_sql(relation, privilege, grantees) %}\n    {{ return(adapter.dispatch('get_revoke_sql', 'dbt')(relation, privilege, grantees)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_revoke_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.140179, "supported_languages": null}, "macro.dbt.default__get_revoke_sql": {"name": "default__get_revoke_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_revoke_sql", "macro_sql": "\n\n{%- macro default__get_revoke_sql(relation, privilege, grantees) -%}\n    revoke {{ privilege }} on {{ relation }} from {{ grantees | join(', ') }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.14037, "supported_languages": null}, "macro.dbt.get_dcl_statement_list": {"name": "get_dcl_statement_list", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_dcl_statement_list", "macro_sql": "{% macro get_dcl_statement_list(relation, grant_config, get_dcl_macro) %}\n    {{ return(adapter.dispatch('get_dcl_statement_list', 'dbt')(relation, grant_config, get_dcl_macro)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_dcl_statement_list"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.140598, "supported_languages": null}, "macro.dbt.default__get_dcl_statement_list": {"name": "default__get_dcl_statement_list", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_dcl_statement_list", "macro_sql": "\n\n{%- macro default__get_dcl_statement_list(relation, grant_config, get_dcl_macro) -%}\n    {#\n      -- Unpack grant_config into specific privileges and the set of users who need them granted/revoked.\n      -- Depending on whether this database supports multiple grantees per statement, pass in the list of\n      -- all grantees per privilege, or (if not) template one statement per privilege-grantee pair.\n      -- `get_dcl_macro` will be either `get_grant_sql` or `get_revoke_sql`\n    #}\n    {%- set dcl_statements = [] -%}\n    {%- for privilege, grantees in grant_config.items() %}\n        {%- if support_multiple_grantees_per_dcl_statement() and grantees -%}\n          {%- set dcl = get_dcl_macro(relation, privilege, grantees) -%}\n          {%- do dcl_statements.append(dcl) -%}\n        {%- else -%}\n          {%- for grantee in grantees -%}\n              {% set dcl = get_dcl_macro(relation, privilege, [grantee]) %}\n              {%- do dcl_statements.append(dcl) -%}\n          {% endfor -%}\n        {%- endif -%}\n    {%- endfor -%}\n    {{ return(dcl_statements) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.support_multiple_grantees_per_dcl_statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1413481, "supported_languages": null}, "macro.dbt.call_dcl_statements": {"name": "call_dcl_statements", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.call_dcl_statements", "macro_sql": "{% macro call_dcl_statements(dcl_statement_list) %}\n    {{ return(adapter.dispatch(\"call_dcl_statements\", \"dbt\")(dcl_statement_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__call_dcl_statements"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.141541, "supported_languages": null}, "macro.dbt.default__call_dcl_statements": {"name": "default__call_dcl_statements", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__call_dcl_statements", "macro_sql": "{% macro default__call_dcl_statements(dcl_statement_list) %}\n    {#\n      -- By default, supply all grant + revoke statements in a single semicolon-separated block,\n      -- so that they're all processed together.\n\n      -- Some databases do not support this. Those adapters will need to override this macro\n      -- to run each statement individually.\n    #}\n    {% call statement('grants') %}\n        {% for dcl_statement in dcl_statement_list %}\n            {{ dcl_statement }};\n        {% endfor %}\n    {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1417868, "supported_languages": null}, "macro.dbt.apply_grants": {"name": "apply_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.apply_grants", "macro_sql": "{% macro apply_grants(relation, grant_config, should_revoke) %}\n    {{ return(adapter.dispatch(\"apply_grants\", \"dbt\")(relation, grant_config, should_revoke)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.142028, "supported_languages": null}, "macro.dbt.default__apply_grants": {"name": "default__apply_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__apply_grants", "macro_sql": "{% macro default__apply_grants(relation, grant_config, should_revoke=True) %}\n    {#-- If grant_config is {} or None, this is a no-op --#}\n    {% if grant_config %}\n        {% if should_revoke %}\n            {#-- We think previous grants may have carried over --#}\n            {#-- Show current grants and calculate diffs --#}\n            {% set current_grants_table = run_query(get_show_grant_sql(relation)) %}\n            {% set current_grants_dict = adapter.standardize_grants_dict(current_grants_table) %}\n            {% set needs_granting = diff_of_two_dicts(grant_config, current_grants_dict) %}\n            {% set needs_revoking = diff_of_two_dicts(current_grants_dict, grant_config) %}\n            {% if not (needs_granting or needs_revoking) %}\n                {{ log('On ' ~ relation ~': All grants are in place, no revocation or granting needed.')}}\n            {% endif %}\n        {% else %}\n            {#-- We don't think there's any chance of previous grants having carried over. --#}\n            {#-- Jump straight to granting what the user has configured. --#}\n            {% set needs_revoking = {} %}\n            {% set needs_granting = grant_config %}\n        {% endif %}\n        {% if needs_granting or needs_revoking %}\n            {% set revoke_statement_list = get_dcl_statement_list(relation, needs_revoking, get_revoke_sql) %}\n            {% set grant_statement_list = get_dcl_statement_list(relation, needs_granting, get_grant_sql) %}\n            {% set dcl_statement_list = revoke_statement_list + grant_statement_list %}\n            {% if dcl_statement_list %}\n                {{ call_dcl_statements(dcl_statement_list) }}\n            {% endif %}\n        {% endif %}\n    {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.get_show_grant_sql", "macro.dbt.get_dcl_statement_list", "macro.dbt.call_dcl_statements"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.143178, "supported_languages": null}, "macro.dbt.get_show_sql": {"name": "get_show_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.get_show_sql", "macro_sql": "{% macro get_show_sql(compiled_code, sql_header, limit) -%}\n  {%- if sql_header -%}\n  {{ sql_header }}\n  {%- endif -%}\n  {%- if limit is not none -%}\n  {{ get_limit_subquery_sql(compiled_code, limit) }}\n  {%- else -%}\n  {{ compiled_code }}\n  {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_limit_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.143709, "supported_languages": null}, "macro.dbt.get_limit_subquery_sql": {"name": "get_limit_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.get_limit_subquery_sql", "macro_sql": "{% macro get_limit_subquery_sql(sql, limit) %}\n  {{ adapter.dispatch('get_limit_subquery_sql', 'dbt')(sql, limit) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_limit_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.143904, "supported_languages": null}, "macro.dbt.default__get_limit_subquery_sql": {"name": "default__get_limit_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.default__get_limit_subquery_sql", "macro_sql": "{% macro default__get_limit_subquery_sql(sql, limit) %}\n    select *\n    from (\n        {{ sql }}\n    ) as model_limit_subq\n    limit {{ limit }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1440399, "supported_languages": null}, "macro.dbt.alter_column_comment": {"name": "alter_column_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n  {{ return(adapter.dispatch('alter_column_comment', 'dbt')(relation, column_dict)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.144713, "supported_languages": null}, "macro.dbt.default__alter_column_comment": {"name": "default__alter_column_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.default__alter_column_comment", "macro_sql": "{% macro default__alter_column_comment(relation, column_dict) -%}\n  {{ exceptions.raise_not_implemented(\n    'alter_column_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.144883, "supported_languages": null}, "macro.dbt.alter_relation_comment": {"name": "alter_relation_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n  {{ return(adapter.dispatch('alter_relation_comment', 'dbt')(relation, relation_comment)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_relation_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.14509, "supported_languages": null}, "macro.dbt.default__alter_relation_comment": {"name": "default__alter_relation_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.default__alter_relation_comment", "macro_sql": "{% macro default__alter_relation_comment(relation, relation_comment) -%}\n  {{ exceptions.raise_not_implemented(\n    'alter_relation_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.14527, "supported_languages": null}, "macro.dbt.persist_docs": {"name": "persist_docs", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n  {{ return(adapter.dispatch('persist_docs', 'dbt')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.145558, "supported_languages": null}, "macro.dbt.default__persist_docs": {"name": "default__persist_docs", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.default__persist_docs", "macro_sql": "{% macro default__persist_docs(relation, model, for_relation, for_columns) -%}\n  {% if for_relation and config.persist_relation_docs() and model.description %}\n    {% do run_query(alter_relation_comment(relation, model.description)) %}\n  {% endif %}\n\n  {% if for_columns and config.persist_column_docs() and model.columns %}\n    {% do run_query(alter_column_comment(relation, model.columns)) %}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.alter_relation_comment", "macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.146058, "supported_languages": null}, "macro.dbt.get_catalog_relations": {"name": "get_catalog_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_catalog_relations", "macro_sql": "{% macro get_catalog_relations(information_schema, relations) -%}\n  {{ return(adapter.dispatch('get_catalog_relations', 'dbt')(information_schema, relations)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.148909, "supported_languages": null}, "macro.dbt.default__get_catalog_relations": {"name": "default__get_catalog_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_catalog_relations", "macro_sql": "{% macro default__get_catalog_relations(information_schema, relations) -%}\n  {% set typename = adapter.type() %}\n  {% set msg -%}\n    get_catalog_relations not implemented for {{ typename }}\n  {%- endset %}\n\n  {{ exceptions.raise_compiler_error(msg) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.149168, "supported_languages": null}, "macro.dbt.get_catalog": {"name": "get_catalog", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n  {{ return(adapter.dispatch('get_catalog', 'dbt')(information_schema, schemas)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1493728, "supported_languages": null}, "macro.dbt.default__get_catalog": {"name": "default__get_catalog", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_catalog", "macro_sql": "{% macro default__get_catalog(information_schema, schemas) -%}\n\n  {% set typename = adapter.type() %}\n  {% set msg -%}\n    get_catalog not implemented for {{ typename }}\n  {%- endset %}\n\n  {{ exceptions.raise_compiler_error(msg) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1496372, "supported_languages": null}, "macro.dbt.information_schema_name": {"name": "information_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n  {{ return(adapter.dispatch('information_schema_name', 'dbt')(database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__information_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.149825, "supported_languages": null}, "macro.dbt.default__information_schema_name": {"name": "default__information_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__information_schema_name", "macro_sql": "{% macro default__information_schema_name(database) -%}\n  {%- if database -%}\n    {{ database }}.INFORMATION_SCHEMA\n  {%- else -%}\n    INFORMATION_SCHEMA\n  {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1499908, "supported_languages": null}, "macro.dbt.list_schemas": {"name": "list_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n  {{ return(adapter.dispatch('list_schemas', 'dbt')(database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__list_schemas"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1501708, "supported_languages": null}, "macro.dbt.default__list_schemas": {"name": "default__list_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__list_schemas", "macro_sql": "{% macro default__list_schemas(database) -%}\n  {% set sql %}\n    select distinct schema_name\n    from {{ information_schema_name(database) }}.SCHEMATA\n    where catalog_name ilike '{{ database }}'\n  {% endset %}\n  {{ return(run_query(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.information_schema_name", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1504881, "supported_languages": null}, "macro.dbt.check_schema_exists": {"name": "check_schema_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n  {{ return(adapter.dispatch('check_schema_exists', 'dbt')(information_schema, schema)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__check_schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1506948, "supported_languages": null}, "macro.dbt.default__check_schema_exists": {"name": "default__check_schema_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__check_schema_exists", "macro_sql": "{% macro default__check_schema_exists(information_schema, schema) -%}\n  {% set sql -%}\n        select count(*)\n        from {{ information_schema.replace(information_schema_view='SCHEMATA') }}\n        where catalog_name='{{ information_schema.database }}'\n          and schema_name='{{ schema }}'\n  {%- endset %}\n  {{ return(run_query(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.151006, "supported_languages": null}, "macro.dbt.list_relations_without_caching": {"name": "list_relations_without_caching", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n  {{ return(adapter.dispatch('list_relations_without_caching', 'dbt')(schema_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.151196, "supported_languages": null}, "macro.dbt.default__list_relations_without_caching": {"name": "default__list_relations_without_caching", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__list_relations_without_caching", "macro_sql": "{% macro default__list_relations_without_caching(schema_relation) %}\n  {{ exceptions.raise_not_implemented(\n    'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1513548, "supported_languages": null}, "macro.dbt.get_relations": {"name": "get_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_relations", "macro_sql": "{% macro get_relations() %}\n  {{ return(adapter.dispatch('get_relations', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.151526, "supported_languages": null}, "macro.dbt.default__get_relations": {"name": "default__get_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_relations", "macro_sql": "{% macro default__get_relations() %}\n  {{ exceptions.raise_not_implemented(\n    'get_relations macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.151681, "supported_languages": null}, "macro.dbt.get_relation_last_modified": {"name": "get_relation_last_modified", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_relation_last_modified", "macro_sql": "{% macro get_relation_last_modified(information_schema, relations) %}\n  {{ return(adapter.dispatch('get_relation_last_modified', 'dbt')(information_schema, relations)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_relation_last_modified"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1518898, "supported_languages": null}, "macro.dbt.default__get_relation_last_modified": {"name": "default__get_relation_last_modified", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_relation_last_modified", "macro_sql": "{% macro default__get_relation_last_modified(information_schema, relations) %}\n  {{ exceptions.raise_not_implemented(\n    'get_relation_last_modified macro not implemented for adapter ' + adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.152066, "supported_languages": null}, "macro.dbt.get_columns_in_relation": {"name": "get_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n  {{ return(adapter.dispatch('get_columns_in_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1543128, "supported_languages": null}, "macro.dbt.default__get_columns_in_relation": {"name": "default__get_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_columns_in_relation", "macro_sql": "{% macro default__get_columns_in_relation(relation) -%}\n  {{ exceptions.raise_not_implemented(\n    'get_columns_in_relation macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1544771, "supported_languages": null}, "macro.dbt.sql_convert_columns_in_relation": {"name": "sql_convert_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.sql_convert_columns_in_relation", "macro_sql": "{% macro sql_convert_columns_in_relation(table) -%}\n  {% set columns = [] %}\n  {% for row in table %}\n    {% do columns.append(api.Column(*row)) %}\n  {% endfor %}\n  {{ return(columns) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.154788, "supported_languages": null}, "macro.dbt.get_empty_subquery_sql": {"name": "get_empty_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_empty_subquery_sql", "macro_sql": "{% macro get_empty_subquery_sql(select_sql, select_sql_header=none) -%}\n  {{ return(adapter.dispatch('get_empty_subquery_sql', 'dbt')(select_sql, select_sql_header)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.155016, "supported_languages": null}, "macro.dbt.default__get_empty_subquery_sql": {"name": "default__get_empty_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_empty_subquery_sql", "macro_sql": "{% macro default__get_empty_subquery_sql(select_sql, select_sql_header=none) %}\n    {%- if select_sql_header is not none -%}\n    {{ select_sql_header }}\n    {%- endif -%}\n    select * from (\n        {{ select_sql }}\n    ) as __dbt_sbq\n    where false\n    limit 0\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.155224, "supported_languages": null}, "macro.dbt.get_empty_schema_sql": {"name": "get_empty_schema_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_empty_schema_sql", "macro_sql": "{% macro get_empty_schema_sql(columns) -%}\n  {{ return(adapter.dispatch('get_empty_schema_sql', 'dbt')(columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_empty_schema_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.155408, "supported_languages": null}, "macro.dbt.default__get_empty_schema_sql": {"name": "default__get_empty_schema_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_empty_schema_sql", "macro_sql": "{% macro default__get_empty_schema_sql(columns) %}\n    {%- set col_err = [] -%}\n    {%- set col_naked_numeric = [] -%}\n    select\n    {% for i in columns %}\n      {%- set col = columns[i] -%}\n      {%- if col['data_type'] is not defined -%}\n        {%- do col_err.append(col['name']) -%}\n      {#-- If this column's type is just 'numeric' then it is missing precision/scale, raise a warning --#}\n      {%- elif col['data_type'].strip().lower() in ('numeric', 'decimal', 'number') -%}\n        {%- do col_naked_numeric.append(col['name']) -%}\n      {%- endif -%}\n      {% set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] %}\n      cast(null as {{ col['data_type'] }}) as {{ col_name }}{{ \", \" if not loop.last }}\n    {%- endfor -%}\n    {%- if (col_err | length) > 0 -%}\n      {{ exceptions.column_type_missing(column_names=col_err) }}\n    {%- elif (col_naked_numeric | length) > 0 -%}\n      {{ exceptions.warn(\"Detected columns with numeric type and unspecified precision/scale, this can lead to unintended rounding: \" ~ col_naked_numeric ~ \"`\") }}\n    {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.156626, "supported_languages": null}, "macro.dbt.get_column_schema_from_query": {"name": "get_column_schema_from_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_column_schema_from_query", "macro_sql": "{% macro get_column_schema_from_query(select_sql, select_sql_header=none) -%}\n    {% set columns = [] %}\n    {# -- Using an 'empty subquery' here to get the same schema as the given select_sql statement, without necessitating a data scan.#}\n    {% set sql = get_empty_subquery_sql(select_sql, select_sql_header) %}\n    {% set column_schema = adapter.get_column_schema_from_query(sql) %}\n    {{ return(column_schema) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.15698, "supported_languages": null}, "macro.dbt.get_columns_in_query": {"name": "get_columns_in_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_columns_in_query", "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n  {{ return(adapter.dispatch('get_columns_in_query', 'dbt')(select_sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.157166, "supported_languages": null}, "macro.dbt.default__get_columns_in_query": {"name": "default__get_columns_in_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_columns_in_query", "macro_sql": "{% macro default__get_columns_in_query(select_sql) %}\n    {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n        {{ get_empty_subquery_sql(select_sql) }}\n    {% endcall %}\n    {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.157521, "supported_languages": null}, "macro.dbt.alter_column_type": {"name": "alter_column_type", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n  {{ return(adapter.dispatch('alter_column_type', 'dbt')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.157755, "supported_languages": null}, "macro.dbt.default__alter_column_type": {"name": "default__alter_column_type", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__alter_column_type", "macro_sql": "{% macro default__alter_column_type(relation, column_name, new_column_type) -%}\n  {#\n    1. Create a new column (w/ temp name and correct type)\n    2. Copy data over to it\n    3. Drop the existing column (cascade!)\n    4. Rename the new column to existing column\n  #}\n  {%- set tmp_column = column_name + \"__dbt_alter\" -%}\n\n  {% call statement('alter_column_type') %}\n    alter table {{ relation }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n    update {{ relation }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n    alter table {{ relation }} drop column {{ adapter.quote(column_name) }} cascade;\n    alter table {{ relation }} rename column {{ adapter.quote(tmp_column) }} to {{ adapter.quote(column_name) }}\n  {% endcall %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.15836, "supported_languages": null}, "macro.dbt.alter_relation_add_remove_columns": {"name": "alter_relation_add_remove_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.alter_relation_add_remove_columns", "macro_sql": "{% macro alter_relation_add_remove_columns(relation, add_columns = none, remove_columns = none) -%}\n  {{ return(adapter.dispatch('alter_relation_add_remove_columns', 'dbt')(relation, add_columns, remove_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_relation_add_remove_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.158619, "supported_languages": null}, "macro.dbt.default__alter_relation_add_remove_columns": {"name": "default__alter_relation_add_remove_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__alter_relation_add_remove_columns", "macro_sql": "{% macro default__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n\n  {% if add_columns is none %}\n    {% set add_columns = [] %}\n  {% endif %}\n  {% if remove_columns is none %}\n    {% set remove_columns = [] %}\n  {% endif %}\n\n  {% set sql -%}\n\n     alter {{ relation.type }} {{ relation }}\n\n            {% for column in add_columns %}\n               add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n            {% endfor %}{{ ',' if add_columns and remove_columns }}\n\n            {% for column in remove_columns %}\n                drop column {{ column.name }}{{ ',' if not loop.last }}\n            {% endfor %}\n\n  {%- endset -%}\n\n  {% do run_query(sql) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1594071, "supported_languages": null}, "macro.dbt.resolve_model_name": {"name": "resolve_model_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.resolve_model_name", "macro_sql": "{% macro resolve_model_name(input_model_name) %}\n    {{ return(adapter.dispatch('resolve_model_name', 'dbt')(input_model_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1610692, "supported_languages": null}, "macro.dbt.default__resolve_model_name": {"name": "default__resolve_model_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.default__resolve_model_name", "macro_sql": "\n\n{%- macro default__resolve_model_name(input_model_name) -%}\n    {{  input_model_name | string | replace('\"', '\\\"') }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.161226, "supported_languages": null}, "macro.dbt.build_ref_function": {"name": "build_ref_function", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_ref_function", "macro_sql": "{% macro build_ref_function(model) %}\n\n    {%- set ref_dict = {} -%}\n    {%- for _ref in model.refs -%}\n        {% set _ref_args = [_ref.get('package'), _ref['name']] if _ref.get('package') else [_ref['name'],] %}\n        {%- set resolved = ref(*_ref_args, v=_ref.get('version')) -%}\n        {%- if _ref.get('version') -%}\n            {% do _ref_args.extend([\"v\" ~ _ref['version']]) %}\n        {%- endif -%}\n       {%- do ref_dict.update({_ref_args | join('.'): resolve_model_name(resolved)}) -%}\n    {%- endfor -%}\n\ndef ref(*args, **kwargs):\n    refs = {{ ref_dict | tojson }}\n    key = '.'.join(args)\n    version = kwargs.get(\"v\") or kwargs.get(\"version\")\n    if version:\n        key += f\".v{version}\"\n    dbt_load_df_function = kwargs.get(\"dbt_load_df_function\")\n    return dbt_load_df_function(refs[key])\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1620538, "supported_languages": null}, "macro.dbt.build_source_function": {"name": "build_source_function", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_source_function", "macro_sql": "{% macro build_source_function(model) %}\n\n    {%- set source_dict = {} -%}\n    {%- for _source in model.sources -%}\n        {%- set resolved = source(*_source) -%}\n        {%- do source_dict.update({_source | join('.'): resolve_model_name(resolved)}) -%}\n    {%- endfor -%}\n\ndef source(*args, dbt_load_df_function):\n    sources = {{ source_dict | tojson }}\n    key = '.'.join(args)\n    return dbt_load_df_function(sources[key])\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.162467, "supported_languages": null}, "macro.dbt.build_config_dict": {"name": "build_config_dict", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_config_dict", "macro_sql": "{% macro build_config_dict(model) %}\n    {%- set config_dict = {} -%}\n    {% set config_dbt_used = zip(model.config.config_keys_used, model.config.config_keys_defaults) | list %}\n    {%- for key, default in config_dbt_used -%}\n        {# weird type testing with enum, would be much easier to write this logic in Python! #}\n        {%- if key == \"language\" -%}\n          {%- set value = \"python\" -%}\n        {%- endif -%}\n        {%- set value = model.config.get(key, default) -%}\n        {%- do config_dict.update({key: value}) -%}\n    {%- endfor -%}\nconfig_dict = {{ config_dict }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1630561, "supported_languages": null}, "macro.dbt.py_script_postfix": {"name": "py_script_postfix", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.py_script_postfix", "macro_sql": "{% macro py_script_postfix(model) %}\n# This part is user provided model code\n# you will need to copy the next section to run the code\n# COMMAND ----------\n# this part is dbt logic for get ref work, do not modify\n\n{{ build_ref_function(model ) }}\n{{ build_source_function(model ) }}\n{{ build_config_dict(model) }}\n\nclass config:\n    def __init__(self, *args, **kwargs):\n        pass\n\n    @staticmethod\n    def get(key, default=None):\n        return config_dict.get(key, default)\n\nclass this:\n    \"\"\"dbt.this() or dbt.this.identifier\"\"\"\n    database = \"{{ this.database }}\"\n    schema = \"{{ this.schema }}\"\n    identifier = \"{{ this.identifier }}\"\n    {% set this_relation_name = resolve_model_name(this) %}\n    def __repr__(self):\n        return '{{ this_relation_name  }}'\n\n\nclass dbtObj:\n    def __init__(self, load_df_function) -> None:\n        self.source = lambda *args: source(*args, dbt_load_df_function=load_df_function)\n        self.ref = lambda *args, **kwargs: ref(*args, **kwargs, dbt_load_df_function=load_df_function)\n        self.config = config\n        self.this = this()\n        self.is_incremental = {{ is_incremental() }}\n\n# COMMAND ----------\n{{py_script_comment()}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.build_ref_function", "macro.dbt.build_source_function", "macro.dbt.build_config_dict", "macro.dbt.resolve_model_name", "macro.dbt.is_incremental", "macro.dbt.py_script_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1636548, "supported_languages": null}, "macro.dbt.py_script_comment": {"name": "py_script_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.py_script_comment", "macro_sql": "{%macro py_script_comment()%}\n{%endmacro%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.163755, "supported_languages": null}, "macro.dbt.test_unique": {"name": "test_unique", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_unique", "macro_sql": "{% test unique(model, column_name) %}\n    {% set macro = adapter.dispatch('test_unique', 'dbt') %}\n    {{ macro(model, column_name) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_unique"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1642828, "supported_languages": null}, "macro.dbt.test_not_null": {"name": "test_not_null", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_not_null", "macro_sql": "{% test not_null(model, column_name) %}\n    {% set macro = adapter.dispatch('test_not_null', 'dbt') %}\n    {{ macro(model, column_name) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1645288, "supported_languages": null}, "macro.dbt.test_accepted_values": {"name": "test_accepted_values", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_accepted_values", "macro_sql": "{% test accepted_values(model, column_name, values, quote=True) %}\n    {% set macro = adapter.dispatch('test_accepted_values', 'dbt') %}\n    {{ macro(model, column_name, values, quote) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1648252, "supported_languages": null}, "macro.dbt.test_relationships": {"name": "test_relationships", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_relationships", "macro_sql": "{% test relationships(model, column_name, to, field) %}\n    {% set macro = adapter.dispatch('test_relationships', 'dbt') %}\n    {{ macro(model, column_name, to, field) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_relationships"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1651032, "supported_languages": null}, "macro.dbt_utils.get_url_host": {"name": "get_url_host", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "unique_id": "macro.dbt_utils.get_url_host", "macro_sql": "{% macro get_url_host(field) -%}\n    {{ return(adapter.dispatch('get_url_host', 'dbt_utils')(field)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_host"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.165463, "supported_languages": null}, "macro.dbt_utils.default__get_url_host": {"name": "default__get_url_host", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "unique_id": "macro.dbt_utils.default__get_url_host", "macro_sql": "{% macro default__get_url_host(field) -%}\n\n{%- set parsed =\n    dbt.split_part(\n        dbt.split_part(\n            dbt.replace(\n                dbt.replace(\n                    dbt.replace(field, \"'android-app://'\", \"''\"\n                    ), \"'http://'\", \"''\"\n                ), \"'https://'\", \"''\"\n            ), \"'/'\", 1\n        ), \"'?'\", 1\n    )\n\n-%}\n\n\n    {{ dbt.safe_cast(\n        parsed,\n        dbt.type_string()\n        )}}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.split_part", "macro.dbt.replace", "macro.dbt.safe_cast", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.166037, "supported_languages": null}, "macro.dbt_utils.get_url_path": {"name": "get_url_path", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "unique_id": "macro.dbt_utils.get_url_path", "macro_sql": "{% macro get_url_path(field) -%}\n    {{ return(adapter.dispatch('get_url_path', 'dbt_utils')(field)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_path"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.166525, "supported_languages": null}, "macro.dbt_utils.default__get_url_path": {"name": "default__get_url_path", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "unique_id": "macro.dbt_utils.default__get_url_path", "macro_sql": "{% macro default__get_url_path(field) -%}\n\n    {%- set stripped_url =\n        dbt.replace(\n            dbt.replace(field, \"'http://'\", \"''\"), \"'https://'\", \"''\")\n    -%}\n\n    {%- set first_slash_pos -%}\n        coalesce(\n            nullif({{ dbt.position(\"'/'\", stripped_url) }}, 0),\n            {{ dbt.position(\"'?'\", stripped_url) }} - 1\n            )\n    {%- endset -%}\n\n    {%- set parsed_path =\n        dbt.split_part(\n            dbt.right(\n                stripped_url,\n                dbt.length(stripped_url) ~ \"-\" ~ first_slash_pos\n                ),\n            \"'?'\", 1\n            )\n    -%}\n\n    {{ dbt.safe_cast(\n        parsed_path,\n        dbt.type_string()\n    )}}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.replace", "macro.dbt.position", "macro.dbt.split_part", "macro.dbt.right", "macro.dbt.length", "macro.dbt.safe_cast", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.167212, "supported_languages": null}, "macro.dbt_utils.get_url_parameter": {"name": "get_url_parameter", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "unique_id": "macro.dbt_utils.get_url_parameter", "macro_sql": "{% macro get_url_parameter(field, url_parameter) -%}\n    {{ return(adapter.dispatch('get_url_parameter', 'dbt_utils')(field, url_parameter)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.167532, "supported_languages": null}, "macro.dbt_utils.default__get_url_parameter": {"name": "default__get_url_parameter", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "unique_id": "macro.dbt_utils.default__get_url_parameter", "macro_sql": "{% macro default__get_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"='\" -%}\n\n{%- set split = dbt.split_part(dbt.split_part(field, formatted_url_parameter, 2), \"'&'\", 1) -%}\n\nnullif({{ split }},'')\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.split_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.167861, "supported_languages": null}, "macro.dbt_utils.test_fewer_rows_than": {"name": "test_fewer_rows_than", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "unique_id": "macro.dbt_utils.test_fewer_rows_than", "macro_sql": "{% test fewer_rows_than(model, compare_model, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_fewer_rows_than', 'dbt_utils')(model, compare_model, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_fewer_rows_than"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1689558, "supported_languages": null}, "macro.dbt_utils.default__test_fewer_rows_than": {"name": "default__test_fewer_rows_than", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "unique_id": "macro.dbt_utils.default__test_fewer_rows_than", "macro_sql": "{% macro default__test_fewer_rows_than(model, compare_model, group_by_columns) %}\n\n{{ config(fail_calc = 'sum(coalesce(row_count_delta, 0))') }}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set join_gb_cols %}\n    {% for c in group_by_columns %}\n      and a.{{c}} = b.{{c}}\n    {% endfor %}\n  {% endset %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n{#-- We must add a fake join key in case additional grouping variables are not provided --#}\n{#-- Redshift does not allow for dynamically created join conditions (e.g. full join on 1 = 1 --#}\n{#-- The same logic is used in equal_rowcount. In case of changes, maintain consistent logic --#}\n{% set group_by_columns = ['id_dbtutils_test_fewer_rows_than'] + group_by_columns %}\n{% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n\n\nwith a as (\n\n    select \n      {{select_gb_cols}}\n      1 as id_dbtutils_test_fewer_rows_than,\n      count(*) as count_our_model \n    from {{ model }}\n    {{ groupby_gb_cols }}\n\n),\nb as (\n\n    select \n      {{select_gb_cols}}\n      1 as id_dbtutils_test_fewer_rows_than,\n      count(*) as count_comparison_model \n    from {{ compare_model }}\n    {{ groupby_gb_cols }}\n\n),\ncounts as (\n\n    select\n\n        {% for c in group_by_columns -%}\n          a.{{c}} as {{c}}_a,\n          b.{{c}} as {{c}}_b,\n        {% endfor %}\n\n        count_our_model,\n        count_comparison_model\n    from a\n    full join b on \n    a.id_dbtutils_test_fewer_rows_than = b.id_dbtutils_test_fewer_rows_than\n    {{ join_gb_cols }}\n\n),\nfinal as (\n\n    select *,\n        case\n            -- fail the test if we have more rows than the reference model and return the row count delta\n            when count_our_model > count_comparison_model then (count_our_model - count_comparison_model)\n            -- fail the test if they are the same number\n            when count_our_model = count_comparison_model then 1\n            -- pass the test if the delta is positive (i.e. return the number 0)\n            else 0\n    end as row_count_delta\n    from counts\n\n)\n\nselect * from final\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.170006, "supported_languages": null}, "macro.dbt_utils.test_equal_rowcount": {"name": "test_equal_rowcount", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "unique_id": "macro.dbt_utils.test_equal_rowcount", "macro_sql": "{% test equal_rowcount(model, compare_model, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_equal_rowcount', 'dbt_utils')(model, compare_model, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_equal_rowcount"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.170881, "supported_languages": null}, "macro.dbt_utils.default__test_equal_rowcount": {"name": "default__test_equal_rowcount", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "unique_id": "macro.dbt_utils.default__test_equal_rowcount", "macro_sql": "{% macro default__test_equal_rowcount(model, compare_model, group_by_columns) %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = 'sum(coalesce(diff_count, 0))') }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n    {{ return('') }}\n{% endif %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(', ') + ', ' %}\n  {% set join_gb_cols %}\n    {% for c in group_by_columns %}\n      and a.{{c}} = b.{{c}}\n    {% endfor %}\n  {% endset %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n{#-- We must add a fake join key in case additional grouping variables are not provided --#}\n{#-- Redshift does not allow for dynamically created join conditions (e.g. full join on 1 = 1 --#}\n{#-- The same logic is used in fewer_rows_than. In case of changes, maintain consistent logic --#}\n{% set group_by_columns = ['id_dbtutils_test_equal_rowcount'] + group_by_columns %}\n{% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n\nwith a as (\n\n    select \n      {{select_gb_cols}}\n      1 as id_dbtutils_test_equal_rowcount,\n      count(*) as count_a \n    from {{ model }}\n    {{groupby_gb_cols}}\n\n\n),\nb as (\n\n    select \n      {{select_gb_cols}}\n      1 as id_dbtutils_test_equal_rowcount,\n      count(*) as count_b \n    from {{ compare_model }}\n    {{groupby_gb_cols}}\n\n),\nfinal as (\n\n    select\n    \n        {% for c in group_by_columns -%}\n          a.{{c}} as {{c}}_a,\n          b.{{c}} as {{c}}_b,\n        {% endfor %}\n\n        count_a,\n        count_b,\n        abs(count_a - count_b) as diff_count\n\n    from a\n    full join b\n    on\n    a.id_dbtutils_test_equal_rowcount = b.id_dbtutils_test_equal_rowcount\n    {{join_gb_cols}}\n\n\n)\n\nselect * from final\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.171984, "supported_languages": null}, "macro.dbt_utils.test_relationships_where": {"name": "test_relationships_where", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "unique_id": "macro.dbt_utils.test_relationships_where", "macro_sql": "{% test relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n  {{ return(adapter.dispatch('test_relationships_where', 'dbt_utils')(model, column_name, to, field, from_condition, to_condition)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_relationships_where"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.172666, "supported_languages": null}, "macro.dbt_utils.default__test_relationships_where": {"name": "default__test_relationships_where", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "unique_id": "macro.dbt_utils.default__test_relationships_where", "macro_sql": "{% macro default__test_relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n\nwith left_table as (\n\n  select\n    {{column_name}} as id\n\n  from {{model}}\n\n  where {{column_name}} is not null\n    and {{from_condition}}\n\n),\n\nright_table as (\n\n  select\n    {{field}} as id\n\n  from {{to}}\n\n  where {{field}} is not null\n    and {{to_condition}}\n\n),\n\nexceptions as (\n\n  select\n    left_table.id,\n    right_table.id as right_id\n\n  from left_table\n\n  left join right_table\n         on left_table.id = right_table.id\n\n  where right_table.id is null\n\n)\n\nselect * from exceptions\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.173013, "supported_languages": null}, "macro.dbt_utils.test_recency": {"name": "test_recency", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "unique_id": "macro.dbt_utils.test_recency", "macro_sql": "{% test recency(model, field, datepart, interval, ignore_time_component=False, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_recency', 'dbt_utils')(model, field, datepart, interval, ignore_time_component, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_recency"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.173756, "supported_languages": null}, "macro.dbt_utils.default__test_recency": {"name": "default__test_recency", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "unique_id": "macro.dbt_utils.default__test_recency", "macro_sql": "{% macro default__test_recency(model, field, datepart, interval, ignore_time_component, group_by_columns) %}\n\n{% set threshold = 'cast(' ~ dbt.dateadd(datepart, interval * -1, dbt.current_timestamp()) ~ ' as ' ~ ('date' if ignore_time_component else dbt.type_timestamp()) ~ ')'  %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n\nwith recency as (\n\n    select \n\n      {{ select_gb_cols }}\n      {% if ignore_time_component %}\n        cast(max({{ field }}) as date) as most_recent\n      {%- else %}\n        max({{ field }}) as most_recent\n      {%- endif %}\n\n    from {{ model }}\n\n    {{ groupby_gb_cols }}\n\n)\n\nselect\n\n    {{ select_gb_cols }}\n    most_recent,\n    {{ threshold }} as threshold\n\nfrom recency\nwhere most_recent < {{ threshold }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.current_timestamp", "macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.174609, "supported_languages": null}, "macro.dbt_utils.test_not_constant": {"name": "test_not_constant", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "unique_id": "macro.dbt_utils.test_not_constant", "macro_sql": "{% test not_constant(model, column_name, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_not_constant', 'dbt_utils')(model, column_name, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_constant"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.175064, "supported_languages": null}, "macro.dbt_utils.default__test_not_constant": {"name": "default__test_not_constant", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "unique_id": "macro.dbt_utils.default__test_not_constant", "macro_sql": "{% macro default__test_not_constant(model, column_name, group_by_columns) %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n\nselect\n    {# In TSQL, subquery aggregate columns need aliases #}\n    {# thus: a filler col name, 'filler_column' #}\n    {{select_gb_cols}}\n    count(distinct {{ column_name }}) as filler_column\n\nfrom {{ model }}\n\n  {{groupby_gb_cols}}\n\nhaving count(distinct {{ column_name }}) = 1\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.175533, "supported_languages": null}, "macro.dbt_utils.test_accepted_range": {"name": "test_accepted_range", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "unique_id": "macro.dbt_utils.test_accepted_range", "macro_sql": "{% test accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n  {{ return(adapter.dispatch('test_accepted_range', 'dbt_utils')(model, column_name, min_value, max_value, inclusive)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_accepted_range"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.17615, "supported_languages": null}, "macro.dbt_utils.default__test_accepted_range": {"name": "default__test_accepted_range", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "unique_id": "macro.dbt_utils.default__test_accepted_range", "macro_sql": "{% macro default__test_accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n\nwith meet_condition as(\n  select *\n  from {{ model }}\n),\n\nvalidation_errors as (\n  select *\n  from meet_condition\n  where\n    -- never true, defaults to an empty result set. Exists to ensure any combo of the `or` clauses below succeeds\n    1 = 2\n\n  {%- if min_value is not none %}\n    -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.\n    or not {{ column_name }} > {{- \"=\" if inclusive }} {{ min_value }}\n  {%- endif %}\n\n  {%- if max_value is not none %}\n    -- records with a value <= max_value are permitted. The `not` flips this to find records that don't meet the rule.\n    or not {{ column_name }} < {{- \"=\" if inclusive }} {{ max_value }}\n  {%- endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1766322, "supported_languages": null}, "macro.dbt_utils.test_not_accepted_values": {"name": "test_not_accepted_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "unique_id": "macro.dbt_utils.test_not_accepted_values", "macro_sql": "{% test not_accepted_values(model, column_name, values, quote=True) %}\n  {{ return(adapter.dispatch('test_not_accepted_values', 'dbt_utils')(model, column_name, values, quote)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1771898, "supported_languages": null}, "macro.dbt_utils.default__test_not_accepted_values": {"name": "default__test_not_accepted_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "unique_id": "macro.dbt_utils.default__test_not_accepted_values", "macro_sql": "{% macro default__test_not_accepted_values(model, column_name, values, quote=True) %}\nwith all_values as (\n\n    select distinct\n        {{ column_name }} as value_field\n\n    from {{ model }}\n\n),\n\nvalidation_errors as (\n\n    select\n        value_field\n\n    from all_values\n    where value_field in (\n        {% for value in values -%}\n            {% if quote -%}\n            '{{ value }}'\n            {%- else -%}\n            {{ value }}\n            {%- endif -%}\n            {%- if not loop.last -%},{%- endif %}\n        {%- endfor %}\n        )\n\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1777751, "supported_languages": null}, "macro.dbt_utils.test_at_least_one": {"name": "test_at_least_one", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "unique_id": "macro.dbt_utils.test_at_least_one", "macro_sql": "{% test at_least_one(model, column_name, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_at_least_one', 'dbt_utils')(model, column_name, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_at_least_one"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.178442, "supported_languages": null}, "macro.dbt_utils.default__test_at_least_one": {"name": "default__test_at_least_one", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "unique_id": "macro.dbt_utils.default__test_at_least_one", "macro_sql": "{% macro default__test_at_least_one(model, column_name, group_by_columns) %}\n\n{% set pruned_cols = [column_name] %}\n\n{% if group_by_columns|length() > 0 %}\n\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n  {% set pruned_cols = group_by_columns %}\n\n  {% if column_name not in pruned_cols %}\n    {% do pruned_cols.append(column_name) %}\n  {% endif %}\n\n{% endif %}\n\n{% set select_pruned_cols = pruned_cols|join(' ,') %}\n\nselect *\nfrom (\n    with pruned_rows as (\n      select\n        {{ select_pruned_cols }}\n      from {{ model }}\n      where {{ column_name }} is not null\n      limit 1\n    )\n    select\n        {# In TSQL, subquery aggregate columns need aliases #}\n        {# thus: a filler col name, 'filler_column' #}\n      {{select_gb_cols}}\n      count({{ column_name }}) as filler_column\n\n    from pruned_rows\n\n    {{groupby_gb_cols}}\n\n    having count({{ column_name }}) = 0\n\n) validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.179262, "supported_languages": null}, "macro.dbt_utils.test_unique_combination_of_columns": {"name": "test_unique_combination_of_columns", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "unique_id": "macro.dbt_utils.test_unique_combination_of_columns", "macro_sql": "{% test unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n  {{ return(adapter.dispatch('test_unique_combination_of_columns', 'dbt_utils')(model, combination_of_columns, quote_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_combination_of_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.179903, "supported_languages": null}, "macro.dbt_utils.default__test_unique_combination_of_columns": {"name": "default__test_unique_combination_of_columns", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "unique_id": "macro.dbt_utils.default__test_unique_combination_of_columns", "macro_sql": "{% macro default__test_unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n\n{% if not quote_columns %}\n    {%- set column_list=combination_of_columns %}\n{% elif quote_columns %}\n    {%- set column_list=[] %}\n        {% for column in combination_of_columns -%}\n            {% set column_list = column_list.append( adapter.quote(column) ) %}\n        {%- endfor %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\n        \"`quote_columns` argument for unique_combination_of_columns test must be one of [True, False] Got: '\" ~ quote ~\"'.'\"\n    ) }}\n{% endif %}\n\n{%- set columns_csv=column_list | join(', ') %}\n\n\nwith validation_errors as (\n\n    select\n        {{ columns_csv }}\n    from {{ model }}\n    group by {{ columns_csv }}\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1805482, "supported_languages": null}, "macro.dbt_utils.test_cardinality_equality": {"name": "test_cardinality_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "unique_id": "macro.dbt_utils.test_cardinality_equality", "macro_sql": "{% test cardinality_equality(model, column_name, to, field) %}\n    {{ return(adapter.dispatch('test_cardinality_equality', 'dbt_utils')(model, column_name, to, field)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_cardinality_equality"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.181112, "supported_languages": null}, "macro.dbt_utils.default__test_cardinality_equality": {"name": "default__test_cardinality_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "unique_id": "macro.dbt_utils.default__test_cardinality_equality", "macro_sql": "{% macro default__test_cardinality_equality(model, column_name, to, field) %}\n\n{# T-SQL does not let you use numbers as aliases for columns #}\n{# Thus, no \"GROUP BY 1\" #}\n\nwith table_a as (\nselect\n  {{ column_name }},\n  count(*) as num_rows\nfrom {{ model }}\ngroup by {{ column_name }}\n),\n\ntable_b as (\nselect\n  {{ field }},\n  count(*) as num_rows\nfrom {{ to }}\ngroup by {{ field }}\n),\n\nexcept_a as (\n  select *\n  from table_a\n  {{ dbt.except() }}\n  select *\n  from table_b\n),\n\nexcept_b as (\n  select *\n  from table_b\n  {{ dbt.except() }}\n  select *\n  from table_a\n),\n\nunioned as (\n  select *\n  from except_a\n  union all\n  select *\n  from except_b\n)\n\nselect *\nfrom unioned\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.181461, "supported_languages": null}, "macro.dbt_utils.test_expression_is_true": {"name": "test_expression_is_true", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "unique_id": "macro.dbt_utils.test_expression_is_true", "macro_sql": "{% test expression_is_true(model, expression, column_name=None) %}\n  {{ return(adapter.dispatch('test_expression_is_true', 'dbt_utils')(model, expression, column_name)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1818628, "supported_languages": null}, "macro.dbt_utils.default__test_expression_is_true": {"name": "default__test_expression_is_true", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "unique_id": "macro.dbt_utils.default__test_expression_is_true", "macro_sql": "{% macro default__test_expression_is_true(model, expression, column_name) %}\n\n{% set column_list = '*' if should_store_failures() else \"1\" %}\n\nselect\n    {{ column_list }}\nfrom {{ model }}\n{% if column_name is none %}\nwhere not({{ expression }})\n{%- else %}\nwhere not({{ column_name }} {{ expression }})\n{%- endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_store_failures"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.182223, "supported_languages": null}, "macro.dbt_utils.test_not_null_proportion": {"name": "test_not_null_proportion", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "unique_id": "macro.dbt_utils.test_not_null_proportion", "macro_sql": "{% macro test_not_null_proportion(model, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_not_null_proportion', 'dbt_utils')(model, group_by_columns, **kwargs)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_proportion"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.182872, "supported_languages": null}, "macro.dbt_utils.default__test_not_null_proportion": {"name": "default__test_not_null_proportion", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "unique_id": "macro.dbt_utils.default__test_not_null_proportion", "macro_sql": "{% macro default__test_not_null_proportion(model, group_by_columns) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n{% set at_least = kwargs.get('at_least', kwargs.get('arg')) %}\n{% set at_most = kwargs.get('at_most', kwargs.get('arg', 1)) %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\nwith validation as (\n  select\n    {{select_gb_cols}}\n    sum(case when {{ column_name }} is null then 0 else 1 end) / cast(count(*) as numeric) as not_null_proportion\n  from {{ model }}\n  {{groupby_gb_cols}}\n),\nvalidation_errors as (\n  select\n    {{select_gb_cols}}\n    not_null_proportion\n  from validation\n  where not_null_proportion < {{ at_least }} or not_null_proportion > {{ at_most }}\n)\nselect\n  *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.183713, "supported_languages": null}, "macro.dbt_utils.test_sequential_values": {"name": "test_sequential_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "unique_id": "macro.dbt_utils.test_sequential_values", "macro_sql": "{% test sequential_values(model, column_name, interval=1, datepart=None, group_by_columns = []) %}\n\n  {{ return(adapter.dispatch('test_sequential_values', 'dbt_utils')(model, column_name, interval, datepart, group_by_columns)) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_sequential_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1846201, "supported_languages": null}, "macro.dbt_utils.default__test_sequential_values": {"name": "default__test_sequential_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "unique_id": "macro.dbt_utils.default__test_sequential_values", "macro_sql": "{% macro default__test_sequential_values(model, column_name, interval=1, datepart=None, group_by_columns = []) %}\n\n{% set previous_column_name = \"previous_\" ~ dbt_utils.slugify(column_name) %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(',') + ', ' %}\n  {% set partition_gb_cols = 'partition by ' + group_by_columns|join(',') %}\n{% endif %}\n\nwith windowed as (\n\n    select\n        {{ select_gb_cols }}\n        {{ column_name }},\n        lag({{ column_name }}) over (\n            {{partition_gb_cols}}\n            order by {{ column_name }}\n        ) as {{ previous_column_name }}\n    from {{ model }}\n),\n\nvalidation_errors as (\n    select\n        *\n    from windowed\n    {% if datepart %}\n    where not(cast({{ column_name }} as {{ dbt.type_timestamp() }})= cast({{ dbt.dateadd(datepart, interval, previous_column_name) }} as {{ dbt.type_timestamp() }}))\n    {% else %}\n    where not({{ column_name }} = {{ previous_column_name }} + {{ interval }})\n    {% endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.slugify", "macro.dbt.type_timestamp", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1855638, "supported_languages": null}, "macro.dbt_utils.test_equality": {"name": "test_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "unique_id": "macro.dbt_utils.test_equality", "macro_sql": "{% test equality(model, compare_model, compare_columns=None) %}\n  {{ return(adapter.dispatch('test_equality', 'dbt_utils')(model, compare_model, compare_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_equality"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1863098, "supported_languages": null}, "macro.dbt_utils.default__test_equality": {"name": "default__test_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "unique_id": "macro.dbt_utils.default__test_equality", "macro_sql": "{% macro default__test_equality(model, compare_model, compare_columns=None) %}\n\n{% set set_diff %}\n    count(*) + coalesce(abs(\n        sum(case when which_diff = 'a_minus_b' then 1 else 0 end) -\n        sum(case when which_diff = 'b_minus_a' then 1 else 0 end)\n    ), 0)\n{% endset %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = set_diff) }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n    {{ return('') }}\n{% endif %}\n\n-- setup\n{%- do dbt_utils._is_relation(model, 'test_equality') -%}\n\n{#-\nIf the compare_cols arg is provided, we can run this test without querying the\ninformation schema\u00a0\u2014 this allows the model to be an ephemeral model\n-#}\n\n{%- if not compare_columns -%}\n    {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n    {%- set compare_columns = adapter.get_columns_in_relation(model) | map(attribute='quoted') -%}\n{%- endif -%}\n\n{% set compare_cols_csv = compare_columns | join(', ') %}\n\nwith a as (\n\n    select * from {{ model }}\n\n),\n\nb as (\n\n    select * from {{ compare_model }}\n\n),\n\na_minus_b as (\n\n    select {{compare_cols_csv}} from a\n    {{ dbt.except() }}\n    select {{compare_cols_csv}} from b\n\n),\n\nb_minus_a as (\n\n    select {{compare_cols_csv}} from b\n    {{ dbt.except() }}\n    select {{compare_cols_csv}} from a\n\n),\n\nunioned as (\n\n    select 'a_minus_b' as which_diff, a_minus_b.* from a_minus_b\n    union all\n    select 'b_minus_a' as which_diff, b_minus_a.* from b_minus_a\n\n)\n\nselect * from unioned\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.187215, "supported_languages": null}, "macro.dbt_utils.test_not_empty_string": {"name": "test_not_empty_string", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_empty_string.sql", "original_file_path": "macros/generic_tests/not_empty_string.sql", "unique_id": "macro.dbt_utils.test_not_empty_string", "macro_sql": "{% test not_empty_string(model, column_name, trim_whitespace=true) %}\n\n  {{ return(adapter.dispatch('test_not_empty_string', 'dbt_utils')(model, column_name, trim_whitespace)) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_empty_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.187731, "supported_languages": null}, "macro.dbt_utils.default__test_not_empty_string": {"name": "default__test_not_empty_string", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_empty_string.sql", "original_file_path": "macros/generic_tests/not_empty_string.sql", "unique_id": "macro.dbt_utils.default__test_not_empty_string", "macro_sql": "{% macro default__test_not_empty_string(model, column_name, trim_whitespace=true) %}\n\n    with\n    \n    all_values as (\n\n        select \n\n\n            {% if trim_whitespace == true -%}\n\n                trim({{ column_name }}) as {{ column_name }}\n\n            {%- else -%}\n\n                {{ column_name }}\n\n            {%- endif %}\n            \n        from {{ model }}\n\n    ),\n\n    errors as (\n\n        select * from all_values\n        where {{ column_name }} = ''\n\n    )\n\n    select * from errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1880372, "supported_languages": null}, "macro.dbt_utils.test_mutually_exclusive_ranges": {"name": "test_mutually_exclusive_ranges", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "unique_id": "macro.dbt_utils.test_mutually_exclusive_ranges", "macro_sql": "{% test mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n  {{ return(adapter.dispatch('test_mutually_exclusive_ranges', 'dbt_utils')(model, lower_bound_column, upper_bound_column, partition_by, gaps, zero_length_range_allowed)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_mutually_exclusive_ranges"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1916502, "supported_languages": null}, "macro.dbt_utils.default__test_mutually_exclusive_ranges": {"name": "default__test_mutually_exclusive_ranges", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "unique_id": "macro.dbt_utils.default__test_mutually_exclusive_ranges", "macro_sql": "{% macro default__test_mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n{% if gaps == 'not_allowed' %}\n    {% set allow_gaps_operator='=' %}\n    {% set allow_gaps_operator_in_words='equal_to' %}\n{% elif gaps == 'allowed' %}\n    {% set allow_gaps_operator='<=' %}\n    {% set allow_gaps_operator_in_words='less_than_or_equal_to' %}\n{% elif gaps == 'required' %}\n    {% set allow_gaps_operator='<' %}\n    {% set allow_gaps_operator_in_words='less_than' %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\n        \"`gaps` argument for mutually_exclusive_ranges test must be one of ['not_allowed', 'allowed', 'required'] Got: '\" ~ gaps ~\"'.'\"\n    ) }}\n{% endif %}\n{% if not zero_length_range_allowed %}\n    {% set allow_zero_length_operator='<' %}\n    {% set allow_zero_length_operator_in_words='less_than' %}\n{% elif zero_length_range_allowed %}\n    {% set allow_zero_length_operator='<=' %}\n    {% set allow_zero_length_operator_in_words='less_than_or_equal_to' %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\n        \"`zero_length_range_allowed` argument for mutually_exclusive_ranges test must be one of [true, false] Got: '\" ~ zero_length_range_allowed ~\"'.'\"\n    ) }}\n{% endif %}\n\n{% set partition_clause=\"partition by \" ~ partition_by if partition_by else '' %}\n\nwith window_functions as (\n\n    select\n        {% if partition_by %}\n        {{ partition_by }} as partition_by_col,\n        {% endif %}\n        {{ lower_bound_column }} as lower_bound,\n        {{ upper_bound_column }} as upper_bound,\n\n        lead({{ lower_bound_column }}) over (\n            {{ partition_clause }}\n            order by {{ lower_bound_column }}, {{ upper_bound_column }}\n        ) as next_lower_bound,\n\n        row_number() over (\n            {{ partition_clause }}\n            order by {{ lower_bound_column }} desc, {{ upper_bound_column }} desc\n        ) = 1 as is_last_record\n\n    from {{ model }}\n\n),\n\ncalc as (\n    -- We want to return records where one of our assumptions fails, so we'll use\n    -- the `not` function with `and` statements so we can write our assumptions more cleanly\n    select\n        *,\n\n        -- For each record: lower_bound should be < upper_bound.\n        -- Coalesce it to return an error on the null case (implicit assumption\n        -- these columns are not_null)\n        coalesce(\n            lower_bound {{ allow_zero_length_operator }} upper_bound,\n            false\n        ) as lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound,\n\n        -- For each record: upper_bound {{ allow_gaps_operator }} the next lower_bound.\n        -- Coalesce it to handle null cases for the last record.\n        coalesce(\n            upper_bound {{ allow_gaps_operator }} next_lower_bound,\n            is_last_record,\n            false\n        ) as upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n\n    from window_functions\n\n),\n\nvalidation_errors as (\n\n    select\n        *\n    from calc\n\n    where not(\n        -- THE FOLLOWING SHOULD BE TRUE --\n        lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound\n        and upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n    )\n)\n\nselect * from validation_errors\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.193277, "supported_languages": null}, "macro.dbt_utils.pretty_log_format": {"name": "pretty_log_format", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "unique_id": "macro.dbt_utils.pretty_log_format", "macro_sql": "{% macro pretty_log_format(message) %}\n    {{ return(adapter.dispatch('pretty_log_format', 'dbt_utils')(message)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.193553, "supported_languages": null}, "macro.dbt_utils.default__pretty_log_format": {"name": "default__pretty_log_format", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "unique_id": "macro.dbt_utils.default__pretty_log_format", "macro_sql": "{% macro default__pretty_log_format(message) %}\n    {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1937249, "supported_languages": null}, "macro.dbt_utils._is_relation": {"name": "_is_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/_is_relation.sql", "original_file_path": "macros/jinja_helpers/_is_relation.sql", "unique_id": "macro.dbt_utils._is_relation", "macro_sql": "{% macro _is_relation(obj, macro) %}\n    {%- if not (obj is mapping and obj.get('metadata', {}).get('type', '').endswith('Relation')) -%}\n        {%- do exceptions.raise_compiler_error(\"Macro \" ~ macro ~ \" expected a Relation but received the value: \" ~ obj) -%}\n    {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.194168, "supported_languages": null}, "macro.dbt_utils.pretty_time": {"name": "pretty_time", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "unique_id": "macro.dbt_utils.pretty_time", "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n    {{ return(adapter.dispatch('pretty_time', 'dbt_utils')(format)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1944451, "supported_languages": null}, "macro.dbt_utils.default__pretty_time": {"name": "default__pretty_time", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "unique_id": "macro.dbt_utils.default__pretty_time", "macro_sql": "{% macro default__pretty_time(format='%H:%M:%S') %}\n    {{ return(modules.datetime.datetime.now().strftime(format)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1946418, "supported_languages": null}, "macro.dbt_utils.log_info": {"name": "log_info", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "unique_id": "macro.dbt_utils.log_info", "macro_sql": "{% macro log_info(message) %}\n    {{ return(adapter.dispatch('log_info', 'dbt_utils')(message)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__log_info"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.194898, "supported_languages": null}, "macro.dbt_utils.default__log_info": {"name": "default__log_info", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "unique_id": "macro.dbt_utils.default__log_info", "macro_sql": "{% macro default__log_info(message) %}\n    {{ log(dbt_utils.pretty_log_format(message), info=True) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.195074, "supported_languages": null}, "macro.dbt_utils.slugify": {"name": "slugify", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/slugify.sql", "original_file_path": "macros/jinja_helpers/slugify.sql", "unique_id": "macro.dbt_utils.slugify", "macro_sql": "{% macro slugify(string) %}\n\n{#- Lower case the string -#}\n{% set string = string | lower %}\n{#- Replace spaces and dashes with underscores -#}\n{% set string = modules.re.sub('[ -]+', '_', string) %}\n{#- Only take letters, numbers, and underscores -#}\n{% set string = modules.re.sub('[^a-z0-9_]+', '', string) %}\n{#- Prepends \"_\" if string begins with a number -#}\n{% set string = modules.re.sub('^[0-9]', '_' + string[0], string) %}\n\n{{ return(string) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.195699, "supported_languages": null}, "macro.dbt_utils._is_ephemeral": {"name": "_is_ephemeral", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/_is_ephemeral.sql", "original_file_path": "macros/jinja_helpers/_is_ephemeral.sql", "unique_id": "macro.dbt_utils._is_ephemeral", "macro_sql": "{% macro _is_ephemeral(obj, macro) %}\n    {%- if obj.is_cte -%}\n        {% set ephemeral_prefix = api.Relation.add_ephemeral_prefix('') %}\n        {% if obj.name.startswith(ephemeral_prefix) %}\n            {% set model_name = obj.name[(ephemeral_prefix|length):] %}\n        {% else %}\n            {% set model_name = obj.name %}\n        {%- endif -%}\n        {% set error_message %}\nThe `{{ macro }}` macro cannot be used with ephemeral models, as it relies on the information schema.\n\n`{{ model_name }}` is an ephemeral model. Consider making it a view or table instead.\n        {% endset %}\n        {%- do exceptions.raise_compiler_error(error_message) -%}\n    {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1965399, "supported_languages": null}, "macro.dbt_utils.get_intervals_between": {"name": "get_intervals_between", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n    {{ return(adapter.dispatch('get_intervals_between', 'dbt_utils')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.197255, "supported_languages": null}, "macro.dbt_utils.default__get_intervals_between": {"name": "default__get_intervals_between", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n    {%- call statement('get_intervals_between', fetch_result=True) %}\n\n        select {{ dbt.datediff(start_date, end_date, datepart) }}\n\n    {%- endcall -%}\n\n    {%- set value_list = load_result('get_intervals_between') -%}\n\n    {%- if value_list and value_list['data'] -%}\n        {%- set values = value_list['data'] | map(attribute=0) | list %}\n        {{ return(values[0]) }}\n    {%- else -%}\n        {{ return(1) }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.197858, "supported_languages": null}, "macro.dbt_utils.date_spine": {"name": "date_spine", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n    {{ return(adapter.dispatch('date_spine', 'dbt_utils')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.198091, "supported_languages": null}, "macro.dbt_utils.default__date_spine": {"name": "default__date_spine", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n{# call as follows:\n\ndate_spine(\n    \"day\",\n    \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n    \"dbt.dateadd(week, 1, current_date)\"\n) #}\n\n\nwith rawdata as (\n\n    {{dbt_utils.generate_series(\n        dbt_utils.get_intervals_between(start_date, end_date, datepart)\n    )}}\n\n),\n\nall_periods as (\n\n    select (\n        {{\n            dbt.dateadd(\n                datepart,\n                \"row_number() over (order by 1) - 1\",\n                start_date\n            )\n        }}\n    ) as date_{{datepart}}\n    from rawdata\n\n),\n\nfiltered as (\n\n    select *\n    from all_periods\n    where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.generate_series", "macro.dbt_utils.get_intervals_between", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1984582, "supported_languages": null}, "macro.dbt_utils.safe_subtract": {"name": "safe_subtract", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_subtract.sql", "original_file_path": "macros/sql/safe_subtract.sql", "unique_id": "macro.dbt_utils.safe_subtract", "macro_sql": "{%- macro safe_subtract(field_list) -%}\n    {{ return(adapter.dispatch('safe_subtract', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_subtract"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.198842, "supported_languages": null}, "macro.dbt_utils.default__safe_subtract": {"name": "default__safe_subtract", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_subtract.sql", "original_file_path": "macros/sql/safe_subtract.sql", "unique_id": "macro.dbt_utils.default__safe_subtract", "macro_sql": "\n\n{%- macro default__safe_subtract(field_list) -%}\n\n{%- if field_list is not iterable or field_list is string or field_list is mapping -%}\n\n{%- set error_message = '\nWarning: the `safe_subtract` macro takes a single list argument instead of \\\nstring arguments. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.raise_compiler_error(error_message) -%}\n\n{%- endif -%}\n\n{% set fields = [] %}\n\n{%- for field in field_list -%}\n\n    {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' -\\n  ') }}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.199394, "supported_languages": null}, "macro.dbt_utils.nullcheck_table": {"name": "nullcheck_table", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "unique_id": "macro.dbt_utils.nullcheck_table", "macro_sql": "{% macro nullcheck_table(relation) %}\n    {{ return(adapter.dispatch('nullcheck_table', 'dbt_utils')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.199708, "supported_languages": null}, "macro.dbt_utils.default__nullcheck_table": {"name": "default__nullcheck_table", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "unique_id": "macro.dbt_utils.default__nullcheck_table", "macro_sql": "{% macro default__nullcheck_table(relation) %}\n\n  {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%}\n  {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%}\n  {% set cols = adapter.get_columns_in_relation(relation) %}\n\n  select {{ dbt_utils.nullcheck(cols) }}\n  from {{relation}}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2000608, "supported_languages": null}, "macro.dbt_utils.get_relations_by_pattern": {"name": "get_relations_by_pattern", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "unique_id": "macro.dbt_utils.get_relations_by_pattern", "macro_sql": "{% macro get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {{ return(adapter.dispatch('get_relations_by_pattern', 'dbt_utils')(schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.200758, "supported_languages": null}, "macro.dbt_utils.default__get_relations_by_pattern": {"name": "default__get_relations_by_pattern", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "unique_id": "macro.dbt_utils.default__get_relations_by_pattern", "macro_sql": "{% macro default__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n    {%- call statement('get_tables', fetch_result=True) %}\n\n      {{ dbt_utils.get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude, database) }}\n\n    {%- endcall -%}\n\n    {%- set table_list = load_result('get_tables') -%}\n\n    {%- if table_list and table_list['table'] -%}\n        {%- set tbl_relations = [] -%}\n        {%- for row in table_list['table'] -%}\n            {%- set tbl_relation = api.Relation.create(\n                database=database,\n                schema=row.table_schema,\n                identifier=row.table_name,\n                type=row.table_type\n            ) -%}\n            {%- do tbl_relations.append(tbl_relation) -%}\n        {%- endfor -%}\n\n        {{ return(tbl_relations) }}\n    {%- else -%}\n        {{ return([]) }}\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.201691, "supported_languages": null}, "macro.dbt_utils.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n    {{ return(adapter.dispatch('get_powers_of_two', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.202538, "supported_languages": null}, "macro.dbt_utils.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n    {% if upper_bound <= 0 %}\n    {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n    {% endif %}\n\n    {% for _ in range(1, 100) %}\n       {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n    {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2029629, "supported_languages": null}, "macro.dbt_utils.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n    {{ return(adapter.dispatch('generate_series', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.203159, "supported_languages": null}, "macro.dbt_utils.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n    {% set n = dbt_utils.get_powers_of_two(upper_bound) %}\n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    {% for i in range(n) %}\n    p{{i}}.generated_number * power(2, {{i}})\n    {% if not loop.last %} + {% endif %}\n    {% endfor %}\n    + 1\n    as generated_number\n\n    from\n\n    {% for i in range(n) %}\n    p as p{{i}}\n    {% if not loop.last %} cross join {% endif %}\n    {% endfor %}\n\n    )\n\n    select *\n    from unioned\n    where generated_number <= {{upper_bound}}\n    order by generated_number\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.203687, "supported_languages": null}, "macro.dbt_utils.get_relations_by_prefix": {"name": "get_relations_by_prefix", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "unique_id": "macro.dbt_utils.get_relations_by_prefix", "macro_sql": "{% macro get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n    {{ return(adapter.dispatch('get_relations_by_prefix', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.204375, "supported_languages": null}, "macro.dbt_utils.default__get_relations_by_prefix": {"name": "default__get_relations_by_prefix", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "unique_id": "macro.dbt_utils.default__get_relations_by_prefix", "macro_sql": "{% macro default__get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n\n    {%- call statement('get_tables', fetch_result=True) %}\n\n      {{ dbt_utils.get_tables_by_prefix_sql(schema, prefix, exclude, database) }}\n\n    {%- endcall -%}\n\n    {%- set table_list = load_result('get_tables') -%}\n\n    {%- if table_list and table_list['table'] -%}\n        {%- set tbl_relations = [] -%}\n        {%- for row in table_list['table'] -%}\n            {%- set tbl_relation = api.Relation.create(\n                database=database,\n                schema=row.table_schema,\n                identifier=row.table_name,\n                type=row.table_type\n            ) -%}\n            {%- do tbl_relations.append(tbl_relation) -%}\n        {%- endfor -%}\n\n        {{ return(tbl_relations) }}\n    {%- else -%}\n        {{ return([]) }}\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.205238, "supported_languages": null}, "macro.dbt_utils.get_tables_by_prefix_sql": {"name": "get_tables_by_prefix_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "unique_id": "macro.dbt_utils.get_tables_by_prefix_sql", "macro_sql": "{% macro get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n    {{ return(adapter.dispatch('get_tables_by_prefix_sql', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.205657, "supported_languages": null}, "macro.dbt_utils.default__get_tables_by_prefix_sql": {"name": "default__get_tables_by_prefix_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "unique_id": "macro.dbt_utils.default__get_tables_by_prefix_sql", "macro_sql": "{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n\n    {{ dbt_utils.get_tables_by_pattern_sql(\n        schema_pattern = schema,\n        table_pattern = prefix ~ '%',\n        exclude = exclude,\n        database = database\n    ) }}\n    \n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.205947, "supported_languages": null}, "macro.dbt_utils.star": {"name": "star", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "unique_id": "macro.dbt_utils.star", "macro_sql": "{% macro star(from, relation_alias=False, except=[], prefix='', suffix='', quote_identifiers=True) -%}\r\n    {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix, quote_identifiers)) }}\r\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__star"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.207226, "supported_languages": null}, "macro.dbt_utils.default__star": {"name": "default__star", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "unique_id": "macro.dbt_utils.default__star", "macro_sql": "{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='', quote_identifiers=True) -%}\r\n    {%- do dbt_utils._is_relation(from, 'star') -%}\r\n    {%- do dbt_utils._is_ephemeral(from, 'star') -%}\r\n\r\n    {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\r\n    {%- if not execute -%}\r\n        {% do return('*') %}\r\n    {%- endif -%}\r\n\r\n    {% set cols = dbt_utils.get_filtered_columns_in_relation(from, except) %}\r\n\r\n    {%- if cols|length <= 0 -%}\r\n        {% if flags.WHICH == 'compile' %}\r\n            {% set response %}\r\n*\r\n/* No columns were returned. Maybe the relation doesn't exist yet \r\nor all columns were excluded. This star is only output during  \r\ndbt compile, and exists to keep SQLFluff happy. */\r\n            {% endset %}\r\n            {% do return(response) %}\r\n        {% else %}\r\n            {% do return(\"/* no columns returned from star() macro */\") %}\r\n        {% endif %}\r\n    {%- else -%}\r\n        {%- for col in cols %}\r\n            {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%}\r\n                {%- if quote_identifiers -%}\r\n                    {{ adapter.quote(col)|trim }} {%- if prefix!='' or suffix!='' %} as {{ adapter.quote(prefix ~ col ~ suffix)|trim }} {%- endif -%}\r\n                {%- else -%}\r\n                    {{ col|trim }} {%- if prefix!='' or suffix!='' %} as {{ (prefix ~ col ~ suffix)|trim }} {%- endif -%}\r\n                {% endif %}\r\n            {%- if not loop.last %},{{ '\\n  ' }}{%- endif -%}\r\n        {%- endfor -%}\r\n    {% endif %}\r\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.208668, "supported_languages": null}, "macro.dbt_utils.unpivot": {"name": "unpivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "unique_id": "macro.dbt_utils.unpivot", "macro_sql": "{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value') -%}\n    {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__unpivot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.21002, "supported_languages": null}, "macro.dbt_utils.default__unpivot": {"name": "default__unpivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "unique_id": "macro.dbt_utils.default__unpivot", "macro_sql": "{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value') -%}\n\n    {% if not relation %}\n        {{ exceptions.raise_compiler_error(\"Error: argument `relation` is required for `unpivot` macro.\") }}\n    {% endif %}\n\n  {%- set exclude = exclude if exclude is not none else [] %}\n  {%- set remove = remove if remove is not none else [] %}\n\n  {%- set include_cols = [] %}\n\n  {%- set table_columns = {} %}\n\n  {%- do table_columns.update({relation: []}) %}\n\n  {%- do dbt_utils._is_relation(relation, 'unpivot') -%}\n  {%- do dbt_utils._is_ephemeral(relation, 'unpivot') -%}\n  {%- set cols = adapter.get_columns_in_relation(relation) %}\n\n  {%- for col in cols -%}\n    {%- if col.column.lower() not in remove|map('lower') and col.column.lower() not in exclude|map('lower') -%}\n      {% do include_cols.append(col) %}\n    {%- endif %}\n  {%- endfor %}\n\n\n  {%- for col in include_cols -%}\n    select\n      {%- for exclude_col in exclude %}\n        {{ exclude_col }},\n      {%- endfor %}\n\n      cast('{{ col.column }}' as {{ dbt.type_string() }}) as {{ field_name }},\n      cast(  {% if col.data_type == 'boolean' %}\n           {{ dbt.cast_bool_to_text(col.column) }}\n             {% else %}\n           {{ col.column }}\n             {% endif %}\n           as {{ cast_to }}) as {{ value_name }}\n\n    from {{ relation }}\n\n    {% if not loop.last -%}\n      union all\n    {% endif -%}\n  {%- endfor -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.type_string", "macro.dbt.cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.211705, "supported_languages": null}, "macro.dbt_utils.safe_divide": {"name": "safe_divide", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_divide.sql", "original_file_path": "macros/sql/safe_divide.sql", "unique_id": "macro.dbt_utils.safe_divide", "macro_sql": "{% macro safe_divide(numerator, denominator) -%}\n  {{ return(adapter.dispatch('safe_divide', 'dbt_utils')(numerator, denominator)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_divide"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2120051, "supported_languages": null}, "macro.dbt_utils.default__safe_divide": {"name": "default__safe_divide", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_divide.sql", "original_file_path": "macros/sql/safe_divide.sql", "unique_id": "macro.dbt_utils.default__safe_divide", "macro_sql": "{% macro default__safe_divide(numerator, denominator) %}\n    ( {{ numerator }} ) / nullif( ( {{ denominator }} ), 0)\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.212142, "supported_languages": null}, "macro.dbt_utils.union_relations": {"name": "union_relations", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "unique_id": "macro.dbt_utils.union_relations", "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n    {{ return(adapter.dispatch('union_relations', 'dbt_utils')(relations, column_override, include, exclude, source_column_name, where)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__union_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.21537, "supported_languages": null}, "macro.dbt_utils.default__union_relations": {"name": "default__union_relations", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "unique_id": "macro.dbt_utils.default__union_relations", "macro_sql": "\n\n{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n\n    {%- if exclude and include -%}\n        {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n    {%- endif -%}\n\n    {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n    {%- if not execute %}\n        {{ return('') }}\n    {% endif -%}\n\n    {%- set column_override = column_override if column_override is not none else {} -%}\n\n    {%- set relation_columns = {} -%}\n    {%- set column_superset = {} -%}\n    {%- set all_excludes = [] -%}\n    {%- set all_includes = [] -%}\n\n    {%- if exclude -%}\n        {%- for exc in exclude -%}\n            {%- do all_excludes.append(exc | lower) -%}\n        {%- endfor -%}\n    {%- endif -%}\n\n    {%- if include -%}\n        {%- for inc in include -%}\n            {%- do all_includes.append(inc | lower) -%}\n        {%- endfor -%}\n    {%- endif -%}\n\n    {%- for relation in relations -%}\n\n        {%- do relation_columns.update({relation: []}) -%}\n\n        {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n        {%- do dbt_utils._is_ephemeral(relation, 'union_relations') -%}\n        {%- set cols = adapter.get_columns_in_relation(relation) -%}\n        {%- for col in cols -%}\n\n        {#- If an exclude list was provided and the column is in the list, do nothing -#}\n        {%- if exclude and col.column | lower in all_excludes -%}\n\n        {#- If an include list was provided and the column is not in the list, do nothing -#}\n        {%- elif include and col.column | lower not in all_includes -%}\n\n        {#- Otherwise add the column to the column superset -#}\n        {%- else -%}\n\n            {#- update the list of columns in this relation -#}\n            {%- do relation_columns[relation].append(col.column) -%}\n\n            {%- if col.column in column_superset -%}\n\n                {%- set stored = column_superset[col.column] -%}\n                {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n                    {%- do column_superset.update({col.column: col}) -%}\n\n                {%- endif %}\n\n            {%- else -%}\n\n                {%- do column_superset.update({col.column: col}) -%}\n\n            {%- endif -%}\n\n        {%- endif -%}\n\n        {%- endfor -%}\n    {%- endfor -%}\n\n    {%- set ordered_column_names = column_superset.keys() -%}\n    {%- set dbt_command = flags.WHICH -%}\n\n\n    {% if dbt_command in ['run', 'build'] %}\n    {% if (include | length > 0 or exclude | length > 0) and not column_superset.keys() %}\n        {%- set relations_string -%}\n            {%- for relation in relations -%}\n                {{ relation.name }}\n            {%- if not loop.last %}, {% endif -%}\n            {%- endfor -%}\n        {%- endset -%}\n\n        {%- set error_message -%}\n            There were no columns found to union for relations {{ relations_string }}\n        {%- endset -%}\n\n        {{ exceptions.raise_compiler_error(error_message) }}\n    {%- endif -%}\n    {%- endif -%}\n\n    {%- for relation in relations %}\n\n        (\n            select\n\n                {%- if source_column_name is not none %}\n                cast({{ dbt.string_literal(relation) }} as {{ dbt.type_string() }}) as {{ source_column_name }},\n                {%- endif %}\n\n                {% for col_name in ordered_column_names -%}\n\n                    {%- set col = column_superset[col_name] %}\n                    {%- set col_type = column_override.get(col.column, col.data_type) %}\n                    {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n                    cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n                {%- endfor %}\n\n            from {{ relation }}\n\n            {% if where -%}\n            where {{ where }}\n            {%- endif %}\n        )\n\n        {% if not loop.last -%}\n            union all\n        {% endif -%}\n\n    {%- endfor -%}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.string_literal", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.21891, "supported_languages": null}, "macro.dbt_utils.group_by": {"name": "group_by", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "unique_id": "macro.dbt_utils.group_by", "macro_sql": "{%- macro group_by(n) -%}\n    {{ return(adapter.dispatch('group_by', 'dbt_utils')(n)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__group_by"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.219218, "supported_languages": null}, "macro.dbt_utils.default__group_by": {"name": "default__group_by", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "unique_id": "macro.dbt_utils.default__group_by", "macro_sql": "\n\n{%- macro default__group_by(n) -%}\n\n  group by {% for i in range(1, n + 1) -%}\n      {{ i }}{{ ',' if not loop.last }}   \n   {%- endfor -%}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.219476, "supported_languages": null}, "macro.dbt_utils.deduplicate": {"name": "deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.deduplicate", "macro_sql": "{%- macro deduplicate(relation, partition_by, order_by) -%}\n    {{ return(adapter.dispatch('deduplicate', 'dbt_utils')(relation, partition_by, order_by)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.snowflake__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.220244, "supported_languages": null}, "macro.dbt_utils.default__deduplicate": {"name": "default__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.default__deduplicate", "macro_sql": "\n\n{%- macro default__deduplicate(relation, partition_by, order_by) -%}\n\n    with row_numbered as (\n        select\n            _inner.*,\n            row_number() over (\n                partition by {{ partition_by }}\n                order by {{ order_by }}\n            ) as rn\n        from {{ relation }} as _inner\n    )\n\n    select\n        distinct data.*\n    from {{ relation }} as data\n    {#\n    -- Not all DBs will support natural joins but the ones that do include:\n    -- Oracle, MySQL, SQLite, Redshift, Teradata, Materialize, Databricks\n    -- Apache Spark, SingleStore, Vertica\n    -- Those that do not appear to support natural joins include:\n    -- SQLServer, Trino, Presto, Rockset, Athena\n    #}\n    natural join row_numbered\n    where row_numbered.rn = 1\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.220463, "supported_languages": null}, "macro.dbt_utils.redshift__deduplicate": {"name": "redshift__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.redshift__deduplicate", "macro_sql": "{% macro redshift__deduplicate(relation, partition_by, order_by) -%}\n\n    {{ return(dbt_utils.default__deduplicate(relation, partition_by, order_by=order_by)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.220672, "supported_languages": null}, "macro.dbt_utils.postgres__deduplicate": {"name": "postgres__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.postgres__deduplicate", "macro_sql": "\n{%- macro postgres__deduplicate(relation, partition_by, order_by) -%}\n\n    select\n        distinct on ({{ partition_by }}) *\n    from {{ relation }}\n    order by {{ partition_by }}{{ ',' ~ order_by }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.220872, "supported_languages": null}, "macro.dbt_utils.snowflake__deduplicate": {"name": "snowflake__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.snowflake__deduplicate", "macro_sql": "\n{%- macro snowflake__deduplicate(relation, partition_by, order_by) -%}\n\n    select *\n    from {{ relation }}\n    qualify\n        row_number() over (\n            partition by {{ partition_by }}\n            order by {{ order_by }}\n        ) = 1\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.221045, "supported_languages": null}, "macro.dbt_utils.bigquery__deduplicate": {"name": "bigquery__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.bigquery__deduplicate", "macro_sql": "\n{%- macro bigquery__deduplicate(relation, partition_by, order_by) -%}\n\n    select unique.*\n    from (\n        select\n            array_agg (\n                original\n                order by {{ order_by }}\n                limit 1\n            )[offset(0)] unique\n        from {{ relation }} original\n        group by {{ partition_by }}\n    )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2212212, "supported_languages": null}, "macro.dbt_utils.surrogate_key": {"name": "surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "unique_id": "macro.dbt_utils.surrogate_key", "macro_sql": "{%- macro surrogate_key(field_list) -%}\n    {% set frustrating_jinja_feature = varargs %}\n    {{ return(adapter.dispatch('surrogate_key', 'dbt_utils')(field_list, *varargs)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.22161, "supported_languages": null}, "macro.dbt_utils.default__surrogate_key": {"name": "default__surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "unique_id": "macro.dbt_utils.default__surrogate_key", "macro_sql": "\n\n{%- macro default__surrogate_key(field_list) -%}\n\n{%- set error_message = '\nWarning: `dbt_utils.surrogate_key` has been replaced by \\\n`dbt_utils.generate_surrogate_key`. The new macro treats null values \\\ndifferently to empty strings. To restore the behaviour of the original \\\nmacro, add a global variable in dbt_project.yml called \\\n`surrogate_key_treat_nulls_as_empty_strings` to your \\\ndbt_project.yml file with a value of True. \\\nThe {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.raise_compiler_error(error_message) -%}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.221848, "supported_languages": null}, "macro.dbt_utils.safe_add": {"name": "safe_add", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "unique_id": "macro.dbt_utils.safe_add", "macro_sql": "{%- macro safe_add(field_list) -%}\n    {{ return(adapter.dispatch('safe_add', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_add"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2222269, "supported_languages": null}, "macro.dbt_utils.default__safe_add": {"name": "default__safe_add", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "unique_id": "macro.dbt_utils.default__safe_add", "macro_sql": "\n\n{%- macro default__safe_add(field_list) -%}\n\n{%- if field_list is not iterable or field_list is string or field_list is mapping -%}\n\n{%- set error_message = '\nWarning: the `safe_add` macro now takes a single list argument instead of \\\nstring arguments. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.warn(error_message) -%}\n\n{%- endif -%}\n\n{% set fields = [] %}\n\n{%- for field in field_list -%}\n\n    {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' +\\n  ') }}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.222775, "supported_languages": null}, "macro.dbt_utils.nullcheck": {"name": "nullcheck", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "unique_id": "macro.dbt_utils.nullcheck", "macro_sql": "{% macro nullcheck(cols) %}\n    {{ return(adapter.dispatch('nullcheck', 'dbt_utils')(cols)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.223116, "supported_languages": null}, "macro.dbt_utils.default__nullcheck": {"name": "default__nullcheck", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "unique_id": "macro.dbt_utils.default__nullcheck", "macro_sql": "{% macro default__nullcheck(cols) %}\n{%- for col in cols %}\n\n    {% if col.is_string() -%}\n\n    nullif({{col.name}},'') as {{col.name}}\n\n    {%- else -%}\n\n    {{col.name}}\n\n    {%- endif -%}\n\n{%- if not loop.last -%} , {%- endif -%}\n\n{%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.223455, "supported_languages": null}, "macro.dbt_utils.get_tables_by_pattern_sql": {"name": "get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.get_tables_by_pattern_sql", "macro_sql": "{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {{ return(adapter.dispatch('get_tables_by_pattern_sql', 'dbt_utils')\n        (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.225209, "supported_languages": null}, "macro.dbt_utils.default__get_tables_by_pattern_sql": {"name": "default__get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.default__get_tables_by_pattern_sql", "macro_sql": "{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n        select distinct\n            table_schema as {{ adapter.quote('table_schema') }},\n            table_name as {{ adapter.quote('table_name') }},\n            {{ dbt_utils.get_table_types_sql() }}\n        from {{ database }}.information_schema.tables\n        where table_schema ilike '{{ schema_pattern }}'\n        and table_name ilike '{{ table_pattern }}'\n        and table_name not ilike '{{ exclude }}'\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.225583, "supported_languages": null}, "macro.dbt_utils.bigquery__get_tables_by_pattern_sql": {"name": "bigquery__get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.bigquery__get_tables_by_pattern_sql", "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n    {% if '%' in schema_pattern %}\n        {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n    {% else %}\n        {% set schemata=[schema_pattern] %}\n    {% endif %}\n\n    {% set sql %}\n        {% for schema in schemata %}\n            select distinct\n                table_schema,\n                table_name,\n                {{ dbt_utils.get_table_types_sql() }}\n\n            from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES\n            where lower(table_name) like lower ('{{ table_pattern }}')\n                and lower(table_name) not like lower ('{{ exclude }}')\n\n            {% if not loop.last %} union all {% endif %}\n\n        {% endfor %}\n    {% endset %}\n\n    {{ return(sql) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._bigquery__get_matching_schemata", "macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.226378, "supported_languages": null}, "macro.dbt_utils._bigquery__get_matching_schemata": {"name": "_bigquery__get_matching_schemata", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils._bigquery__get_matching_schemata", "macro_sql": "{% macro _bigquery__get_matching_schemata(schema_pattern, database) %}\n    {% if execute %}\n\n        {% set sql %}\n        select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA\n        where lower(schema_name) like lower('{{ schema_pattern }}')\n        {% endset %}\n\n        {% set results=run_query(sql) %}\n\n        {% set schemata=results.columns['schema_name'].values() %}\n\n        {{ return(schemata) }}\n\n    {% else %}\n\n        {{ return([]) }}\n\n    {% endif %}\n\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.226895, "supported_languages": null}, "macro.dbt_utils.get_column_values": {"name": "get_column_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "unique_id": "macro.dbt_utils.get_column_values", "macro_sql": "{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n    {{ return(adapter.dispatch('get_column_values', 'dbt_utils')(table, column, order_by, max_records, default, where)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_column_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.228037, "supported_languages": null}, "macro.dbt_utils.default__get_column_values": {"name": "default__get_column_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "unique_id": "macro.dbt_utils.default__get_column_values", "macro_sql": "{% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n    {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n    {%- if not execute -%}\n        {% set default = [] if not default %}\n        {{ return(default) }}\n    {% endif %}\n\n    {%- do dbt_utils._is_ephemeral(table, 'get_column_values') -%}\n\n    {# Not all relations are tables. Renaming for internal clarity without breaking functionality for anyone using named arguments #}\n    {# TODO: Change the method signature in a future 0.x.0 release #}\n    {%- set target_relation = table -%}\n\n    {# adapter.load_relation is a convenience wrapper to avoid building a Relation when we already have one #}\n    {% set relation_exists = (load_relation(target_relation)) is not none %}\n\n    {%- call statement('get_column_values', fetch_result=true) %}\n\n        {%- if not relation_exists and default is none -%}\n\n          {{ exceptions.raise_compiler_error(\"In get_column_values(): relation \" ~ target_relation ~ \" does not exist and no default value was provided.\") }}\n\n        {%- elif not relation_exists and default is not none -%}\n\n          {{ log(\"Relation \" ~ target_relation ~ \" does not exist. Returning the default value: \" ~ default) }}\n\n          {{ return(default) }}\n\n        {%- else -%}\n\n\n            select\n                {{ column }} as value\n\n            from {{ target_relation }}\n\n            {% if where is not none %}\n            where {{ where }}\n            {% endif %}\n\n            group by {{ column }}\n            order by {{ order_by }}\n\n            {% if max_records is not none %}\n            limit {{ max_records }}\n            {% endif %}\n\n        {% endif %}\n\n    {%- endcall -%}\n\n    {%- set value_list = load_result('get_column_values') -%}\n\n    {%- if value_list and value_list['data'] -%}\n        {%- set values = value_list['data'] | map(attribute=0) | list %}\n        {{ return(values) }}\n    {%- else -%}\n        {{ return(default) }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_ephemeral", "macro.dbt.load_relation", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.229571, "supported_languages": null}, "macro.dbt_utils.pivot": {"name": "pivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "unique_id": "macro.dbt_utils.pivot", "macro_sql": "{% macro pivot(column,\n               values,\n               alias=True,\n               agg='sum',\n               cmp='=',\n               prefix='',\n               suffix='',\n               then_value=1,\n               else_value=0,\n               quote_identifiers=True,\n               distinct=False) %}\n    {{ return(adapter.dispatch('pivot', 'dbt_utils')(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pivot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.230655, "supported_languages": null}, "macro.dbt_utils.default__pivot": {"name": "default__pivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "unique_id": "macro.dbt_utils.default__pivot", "macro_sql": "{% macro default__pivot(column,\n               values,\n               alias=True,\n               agg='sum',\n               cmp='=',\n               prefix='',\n               suffix='',\n               then_value=1,\n               else_value=0,\n               quote_identifiers=True,\n               distinct=False) %}\n  {% for value in values %}\n    {{ agg }}(\n      {% if distinct %} distinct {% endif %}\n      case\n      when {{ column }} {{ cmp }} '{{ dbt.escape_single_quotes(value) }}'\n        then {{ then_value }}\n      else {{ else_value }}\n      end\n    )\n    {% if alias %}\n      {% if quote_identifiers %}\n            as {{ adapter.quote(prefix ~ value ~ suffix) }}\n      {% else %}\n        as {{ dbt_utils.slugify(prefix ~ value ~ suffix) }}\n      {% endif %}\n    {% endif %}\n    {% if not loop.last %},{% endif %}\n  {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.escape_single_quotes", "macro.dbt_utils.slugify"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.23152, "supported_languages": null}, "macro.dbt_utils.get_filtered_columns_in_relation": {"name": "get_filtered_columns_in_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "unique_id": "macro.dbt_utils.get_filtered_columns_in_relation", "macro_sql": "{% macro get_filtered_columns_in_relation(from, except=[]) -%}\n    {{ return(adapter.dispatch('get_filtered_columns_in_relation', 'dbt_utils')(from, except)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.23199, "supported_languages": null}, "macro.dbt_utils.default__get_filtered_columns_in_relation": {"name": "default__get_filtered_columns_in_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "unique_id": "macro.dbt_utils.default__get_filtered_columns_in_relation", "macro_sql": "{% macro default__get_filtered_columns_in_relation(from, except=[]) -%}\n    {%- do dbt_utils._is_relation(from, 'get_filtered_columns_in_relation') -%}\n    {%- do dbt_utils._is_ephemeral(from, 'get_filtered_columns_in_relation') -%}\n\n    {# -- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n    {%- if not execute -%}\n        {{ return('') }}\n    {% endif %}\n\n    {%- set include_cols = [] %}\n    {%- set cols = adapter.get_columns_in_relation(from) -%}\n    {%- set except = except | map(\"lower\") | list %}\n    {%- for col in cols -%}\n        {%- if col.column|lower not in except -%}\n            {% do include_cols.append(col.column) %}\n        {%- endif %}\n    {%- endfor %}\n\n    {{ return(include_cols) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2327302, "supported_languages": null}, "macro.dbt_utils.width_bucket": {"name": "width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.width_bucket", "macro_sql": "{% macro width_bucket(expr, min_value, max_value, num_buckets) %}\n  {{ return(adapter.dispatch('width_bucket', 'dbt_utils') (expr, min_value, max_value, num_buckets)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.snowflake__width_bucket"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.233523, "supported_languages": null}, "macro.dbt_utils.default__width_bucket": {"name": "default__width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.default__width_bucket", "macro_sql": "{% macro default__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n    {% set bin_size -%}\n    (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n    {%- endset %}\n    (\n        -- to break ties when the amount is eaxtly at the bucket egde\n        case\n            when\n                mod(\n                    {{ dbt.safe_cast(expr, dbt.type_numeric() ) }},\n                    {{ dbt.safe_cast(bin_size, dbt.type_numeric() ) }}\n                ) = 0\n            then 1\n            else 0\n        end\n    ) +\n      -- Anything over max_value goes the N+1 bucket\n    least(\n        ceil(\n            ({{ expr }} - {{ min_value }})/{{ bin_size }}\n        ),\n        {{ num_buckets }} + 1\n    )\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.safe_cast", "macro.dbt.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.233996, "supported_languages": null}, "macro.dbt_utils.snowflake__width_bucket": {"name": "snowflake__width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.snowflake__width_bucket", "macro_sql": "{% macro snowflake__width_bucket(expr, min_value, max_value, num_buckets) %}\n    width_bucket({{ expr }}, {{ min_value }}, {{ max_value }}, {{ num_buckets }} )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2341928, "supported_languages": null}, "macro.dbt_utils.get_query_results_as_dict": {"name": "get_query_results_as_dict", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "unique_id": "macro.dbt_utils.get_query_results_as_dict", "macro_sql": "{% macro get_query_results_as_dict(query) %}\n    {{ return(adapter.dispatch('get_query_results_as_dict', 'dbt_utils')(query)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_query_results_as_dict"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.234584, "supported_languages": null}, "macro.dbt_utils.default__get_query_results_as_dict": {"name": "default__get_query_results_as_dict", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "unique_id": "macro.dbt_utils.default__get_query_results_as_dict", "macro_sql": "{% macro default__get_query_results_as_dict(query) %}\n\n{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #}\n\n    {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%}\n\n        {{ query }}\n\n    {%- endcall -%}\n\n    {% set sql_results={} %}\n\n    {%- if execute -%}\n        {% set sql_results_table = load_result('get_query_results').table.columns %}\n        {% for column_name, column in sql_results_table.items() %}\n            {% do sql_results.update({column_name: column.values()}) %}\n        {% endfor %}\n    {%- endif -%}\n\n    {{ return(sql_results) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.235189, "supported_languages": null}, "macro.dbt_utils.generate_surrogate_key": {"name": "generate_surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_surrogate_key.sql", "original_file_path": "macros/sql/generate_surrogate_key.sql", "unique_id": "macro.dbt_utils.generate_surrogate_key", "macro_sql": "{%- macro generate_surrogate_key(field_list) -%}\n    {{ return(adapter.dispatch('generate_surrogate_key', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__generate_surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2356539, "supported_languages": null}, "macro.dbt_utils.default__generate_surrogate_key": {"name": "default__generate_surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_surrogate_key.sql", "original_file_path": "macros/sql/generate_surrogate_key.sql", "unique_id": "macro.dbt_utils.default__generate_surrogate_key", "macro_sql": "\n\n{%- macro default__generate_surrogate_key(field_list) -%}\n\n{%- if var('surrogate_key_treat_nulls_as_empty_strings', False) -%}\n    {%- set default_null_value = \"\" -%}\n{%- else -%}\n    {%- set default_null_value = '_dbt_utils_surrogate_key_null_' -%}\n{%- endif -%}\n\n{%- set fields = [] -%}\n\n{%- for field in field_list -%}\n\n    {%- do fields.append(\n        \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt.type_string() ~ \"), '\" ~ default_null_value  ~\"')\"\n    ) -%}\n\n    {%- if not loop.last %}\n        {%- do fields.append(\"'-'\") -%}\n    {%- endif -%}\n\n{%- endfor -%}\n\n{{ dbt.hash(dbt.concat(fields)) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.hash", "macro.dbt.concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.236297, "supported_languages": null}, "macro.dbt_utils.get_table_types_sql": {"name": "get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.get_table_types_sql", "macro_sql": "{%- macro get_table_types_sql() -%}\n  {{ return(adapter.dispatch('get_table_types_sql', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_utils.default__get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.236842, "supported_languages": null}, "macro.dbt_utils.default__get_table_types_sql": {"name": "default__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.default__get_table_types_sql", "macro_sql": "{% macro default__get_table_types_sql() %}\n            case table_type\n                when 'BASE TABLE' then 'table'\n                when 'EXTERNAL TABLE' then 'external'\n                when 'MATERIALIZED VIEW' then 'materializedview'\n                else lower(table_type)\n            end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2369869, "supported_languages": null}, "macro.dbt_utils.postgres__get_table_types_sql": {"name": "postgres__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.postgres__get_table_types_sql", "macro_sql": "{% macro postgres__get_table_types_sql() %}\n            case table_type\n                when 'BASE TABLE' then 'table'\n                when 'FOREIGN' then 'external'\n                when 'MATERIALIZED VIEW' then 'materializedview'\n                else lower(table_type)\n            end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2371268, "supported_languages": null}, "macro.dbt_utils.databricks__get_table_types_sql": {"name": "databricks__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.databricks__get_table_types_sql", "macro_sql": "{% macro databricks__get_table_types_sql() %}\n            case table_type\n                when 'MANAGED' then 'table'\n                when 'BASE TABLE' then 'table'\n                when 'MATERIALIZED VIEW' then 'materializedview'\n                else lower(table_type)\n            end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2372658, "supported_languages": null}, "macro.dbt_utils.get_single_value": {"name": "get_single_value", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_single_value.sql", "original_file_path": "macros/sql/get_single_value.sql", "unique_id": "macro.dbt_utils.get_single_value", "macro_sql": "{% macro get_single_value(query, default=none) %}\n    {{ return(adapter.dispatch('get_single_value', 'dbt_utils')(query, default)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_single_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2377841, "supported_languages": null}, "macro.dbt_utils.default__get_single_value": {"name": "default__get_single_value", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_single_value.sql", "original_file_path": "macros/sql/get_single_value.sql", "unique_id": "macro.dbt_utils.default__get_single_value", "macro_sql": "{% macro default__get_single_value(query, default) %}\n\n{# This macro returns the (0, 0) record in a query, i.e. the first row of the first column #}\n\n    {%- call statement('get_query_result', fetch_result=True, auto_begin=false) -%}\n\n        {{ query }}\n\n    {%- endcall -%}\n\n    {%- if execute -%}\n\n        {% set r = load_result('get_query_result').table.columns[0].values() %}\n        {% if r | length == 0 %}\n            {% do print('Query `' ~ query ~ '` returned no rows. Using the default value: ' ~ default) %}\n            {% set sql_result = default %}\n        {% else %}\n            {% set sql_result = r[0] %}\n        {% endif %}\n        \n    {%- else -%}\n    \n        {% set sql_result = default %}\n    \n    {%- endif -%}\n\n    {% do return(sql_result) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.238595, "supported_languages": null}, "macro.dbt_utils.degrees_to_radians": {"name": "degrees_to_radians", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.degrees_to_radians", "macro_sql": "{% macro degrees_to_radians(degrees) -%}\n    acos(-1) * {{degrees}} / 180\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.239687, "supported_languages": null}, "macro.dbt_utils.haversine_distance": {"name": "haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.haversine_distance", "macro_sql": "{% macro haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n    {{ return(adapter.dispatch('haversine_distance', 'dbt_utils')(lat1,lon1,lat2,lon2,unit)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__haversine_distance"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.239976, "supported_languages": null}, "macro.dbt_utils.default__haversine_distance": {"name": "default__haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{%- if unit == 'mi' %}\n    {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n    {% set conversion_rate = 1.60934 %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n\n    2 * 3961 * asin(sqrt(power((sin(radians(({{ lat2 }} - {{ lat1 }}) / 2))), 2) +\n    cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n    power((sin(radians(({{ lon2 }} - {{ lon1 }}) / 2))), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.240546, "supported_languages": null}, "macro.dbt_utils.bigquery__haversine_distance": {"name": "bigquery__haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.bigquery__haversine_distance", "macro_sql": "{% macro bigquery__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{% set radians_lat1 = dbt_utils.degrees_to_radians(lat1) %}\n{% set radians_lat2 = dbt_utils.degrees_to_radians(lat2) %}\n{% set radians_lon1 = dbt_utils.degrees_to_radians(lon1) %}\n{% set radians_lon2 = dbt_utils.degrees_to_radians(lon2) %}\n{%- if unit == 'mi' %}\n    {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n    {% set conversion_rate = 1.60934 %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n    2 * 3961 * asin(sqrt(power(sin(({{ radians_lat2 }} - {{ radians_lat1 }}) / 2), 2) +\n    cos({{ radians_lat1 }}) * cos({{ radians_lat2 }}) *\n    power(sin(({{ radians_lon2 }} - {{ radians_lon1 }}) / 2), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.degrees_to_radians"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2413702, "supported_languages": null}, "macro.spark_utils.get_tables": {"name": "get_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.get_tables", "macro_sql": "{% macro get_tables(table_regex_pattern='.*') %}\n\n  {% set tables = [] %}\n  {% for database in spark__list_schemas('not_used') %}\n    {% for table in spark__list_relations_without_caching(database[0]) %}\n      {% set db_tablename = database[0] ~ \".\" ~ table[1] %}\n      {% set is_match = modules.re.match(table_regex_pattern, db_tablename) %}\n      {% if is_match %}\n        {% call statement('table_detail', fetch_result=True) -%}\n          describe extended {{ db_tablename }}\n        {% endcall %}\n\n        {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('type', 'TYPE', 'Type'))|first %}\n        {% if table_type[1]|lower != 'view' %}\n          {{ tables.append(db_tablename) }}\n        {% endif %}\n      {% endif %}\n    {% endfor %}\n  {% endfor %}\n  {{ return(tables) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2467022, "supported_languages": null}, "macro.spark_utils.get_delta_tables": {"name": "get_delta_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.get_delta_tables", "macro_sql": "{% macro get_delta_tables(table_regex_pattern='.*') %}\n\n  {% set delta_tables = [] %}\n  {% for db_tablename in get_tables(table_regex_pattern) %}\n    {% call statement('table_detail', fetch_result=True) -%}\n      describe extended {{ db_tablename }}\n    {% endcall %}\n\n    {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('provider', 'PROVIDER', 'Provider'))|first %}\n    {% if table_type[1]|lower == 'delta' %}\n      {{ delta_tables.append(db_tablename) }}\n    {% endif %}\n  {% endfor %}\n  {{ return(delta_tables) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.247423, "supported_languages": null}, "macro.spark_utils.get_statistic_columns": {"name": "get_statistic_columns", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.get_statistic_columns", "macro_sql": "{% macro get_statistic_columns(table) %}\n\n  {% call statement('input_columns', fetch_result=True) %}\n    SHOW COLUMNS IN {{ table }}\n  {% endcall %}\n  {% set input_columns = load_result('input_columns').table %}\n\n  {% set output_columns = [] %}\n  {% for column in input_columns %}\n    {% call statement('column_information', fetch_result=True) %}\n      DESCRIBE TABLE {{ table }} `{{ column[0] }}`\n    {% endcall %}\n    {% if not load_result('column_information').table[1][1].startswith('struct') and not load_result('column_information').table[1][1].startswith('array')  %}\n      {{ output_columns.append('`' ~ column[0] ~ '`') }}\n    {% endif %}\n  {% endfor %}\n  {{ return(output_columns) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.248327, "supported_languages": null}, "macro.spark_utils.spark_optimize_delta_tables": {"name": "spark_optimize_delta_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.spark_optimize_delta_tables", "macro_sql": "{% macro spark_optimize_delta_tables(table_regex_pattern='.*') %}\n\n  {% for table in get_delta_tables(table_regex_pattern) %}\n    {% set start=modules.datetime.datetime.now() %}\n    {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Optimizing \" ~ table) }}\n    {% do run_query(\"optimize \" ~ table) %}\n    {% set end=modules.datetime.datetime.now() %}\n    {% set total_seconds = (end - start).total_seconds() | round(2)  %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n  {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.249076, "supported_languages": null}, "macro.spark_utils.spark_vacuum_delta_tables": {"name": "spark_vacuum_delta_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.spark_vacuum_delta_tables", "macro_sql": "{% macro spark_vacuum_delta_tables(table_regex_pattern='.*') %}\n\n  {% for table in get_delta_tables(table_regex_pattern) %}\n    {% set start=modules.datetime.datetime.now() %}\n    {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Vacuuming \" ~ table) }}\n    {% do run_query(\"vacuum \" ~ table) %}\n    {% set end=modules.datetime.datetime.now() %}\n    {% set total_seconds = (end - start).total_seconds() | round(2)  %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n  {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.249822, "supported_languages": null}, "macro.spark_utils.spark_analyze_tables": {"name": "spark_analyze_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.spark_analyze_tables", "macro_sql": "{% macro spark_analyze_tables(table_regex_pattern='.*') %}\n\n  {% for table in get_tables(table_regex_pattern) %}\n    {% set start=modules.datetime.datetime.now() %}\n    {% set columns = get_statistic_columns(table) | join(',') %}\n    {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Analyzing \" ~ table) }}\n    {% if columns != '' %}\n      {% do run_query(\"analyze table \" ~ table ~ \" compute statistics for columns \" ~ columns) %}\n    {% endif %}\n    {% set end=modules.datetime.datetime.now() %}\n    {% set total_seconds = (end - start).total_seconds() | round(2)  %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n  {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.spark_utils.get_statistic_columns", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.250798, "supported_languages": null}, "macro.spark_utils.spark__concat": {"name": "spark__concat", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/concat.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/concat.sql", "unique_id": "macro.spark_utils.spark__concat", "macro_sql": "{% macro spark__concat(fields) -%}\n    concat({{ fields|join(', ') }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.250978, "supported_languages": null}, "macro.spark_utils.spark__type_numeric": {"name": "spark__type_numeric", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "unique_id": "macro.spark_utils.spark__type_numeric", "macro_sql": "{% macro spark__type_numeric() %}\n    decimal(28, 6)\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2510898, "supported_languages": null}, "macro.spark_utils.spark__dateadd": {"name": "spark__dateadd", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "unique_id": "macro.spark_utils.spark__dateadd", "macro_sql": "{% macro spark__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n    {%- set clock_component -%}\n        {# make sure the dates + timestamps are real, otherwise raise an error asap #}\n        to_unix_timestamp({{ spark_utils.assert_not_null('to_timestamp', from_date_or_timestamp) }})\n        - to_unix_timestamp({{ spark_utils.assert_not_null('date', from_date_or_timestamp) }})\n    {%- endset -%}\n\n    {%- if datepart in ['day', 'week'] -%}\n        \n        {%- set multiplier = 7 if datepart == 'week' else 1 -%}\n\n        to_timestamp(\n            to_unix_timestamp(\n                date_add(\n                    {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n                    cast({{interval}} * {{multiplier}} as int)\n                )\n            ) + {{clock_component}}\n        )\n\n    {%- elif datepart in ['month', 'quarter', 'year'] -%}\n    \n        {%- set multiplier -%} \n            {%- if datepart == 'month' -%} 1\n            {%- elif datepart == 'quarter' -%} 3\n            {%- elif datepart == 'year' -%} 12\n            {%- endif -%}\n        {%- endset -%}\n\n        to_timestamp(\n            to_unix_timestamp(\n                add_months(\n                    {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n                    cast({{interval}} * {{multiplier}} as int)\n                )\n            ) + {{clock_component}}\n        )\n\n    {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n    \n        {%- set multiplier -%} \n            {%- if datepart == 'hour' -%} 3600\n            {%- elif datepart == 'minute' -%} 60\n            {%- elif datepart == 'second' -%} 1\n            {%- elif datepart == 'millisecond' -%} (1/1000000)\n            {%- elif datepart == 'microsecond' -%} (1/1000000)\n            {%- endif -%}\n        {%- endset -%}\n\n        to_timestamp(\n            {{ spark_utils.assert_not_null('to_unix_timestamp', from_date_or_timestamp) }}\n            + cast({{interval}} * {{multiplier}} as int)\n        )\n\n    {%- else -%}\n\n        {{ exceptions.raise_compiler_error(\"macro dateadd not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.254011, "supported_languages": null}, "macro.spark_utils.spark__datediff": {"name": "spark__datediff", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/datediff.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datediff.sql", "unique_id": "macro.spark_utils.spark__datediff", "macro_sql": "{% macro spark__datediff(first_date, second_date, datepart) %}\n\n    {%- if datepart in ['day', 'week', 'month', 'quarter', 'year'] -%}\n    \n        {# make sure the dates are real, otherwise raise an error asap #}\n        {% set first_date = spark_utils.assert_not_null('date', first_date) %}\n        {% set second_date = spark_utils.assert_not_null('date', second_date) %}\n    \n    {%- endif -%}\n    \n    {%- if datepart == 'day' -%}\n    \n        datediff({{second_date}}, {{first_date}})\n    \n    {%- elif datepart == 'week' -%}\n    \n        case when {{first_date}} < {{second_date}}\n            then floor(datediff({{second_date}}, {{first_date}})/7)\n            else ceil(datediff({{second_date}}, {{first_date}})/7)\n            end\n        \n        -- did we cross a week boundary (Sunday)?\n        + case\n            when {{first_date}} < {{second_date}} and dayofweek({{second_date}}) < dayofweek({{first_date}}) then 1\n            when {{first_date}} > {{second_date}} and dayofweek({{second_date}}) > dayofweek({{first_date}}) then -1\n            else 0 end\n\n    {%- elif datepart == 'month' -%}\n\n        case when {{first_date}} < {{second_date}}\n            then floor(months_between(date({{second_date}}), date({{first_date}})))\n            else ceil(months_between(date({{second_date}}), date({{first_date}})))\n            end\n        \n        -- did we cross a month boundary?\n        + case\n            when {{first_date}} < {{second_date}} and dayofmonth({{second_date}}) < dayofmonth({{first_date}}) then 1\n            when {{first_date}} > {{second_date}} and dayofmonth({{second_date}}) > dayofmonth({{first_date}}) then -1\n            else 0 end\n        \n    {%- elif datepart == 'quarter' -%}\n    \n        case when {{first_date}} < {{second_date}}\n            then floor(months_between(date({{second_date}}), date({{first_date}}))/3)\n            else ceil(months_between(date({{second_date}}), date({{first_date}}))/3)\n            end\n        \n        -- did we cross a quarter boundary?\n        + case\n            when {{first_date}} < {{second_date}} and (\n                (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n                < (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n            ) then 1\n            when {{first_date}} > {{second_date}} and (\n                (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n                > (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n            ) then -1\n            else 0 end\n\n    {%- elif datepart == 'year' -%}\n    \n        year({{second_date}}) - year({{first_date}})\n\n    {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n    \n        {%- set divisor -%} \n            {%- if datepart == 'hour' -%} 3600\n            {%- elif datepart == 'minute' -%} 60\n            {%- elif datepart == 'second' -%} 1\n            {%- elif datepart == 'millisecond' -%} (1/1000)\n            {%- elif datepart == 'microsecond' -%} (1/1000000)\n            {%- endif -%}\n        {%- endset -%}\n\n        case when {{first_date}} < {{second_date}}\n            then ceil((\n                {# make sure the timestamps are real, otherwise raise an error asap #}\n                {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n                - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n            ) / {{divisor}})\n            else floor((\n                {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n                - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n            ) / {{divisor}})\n            end\n            \n            {% if datepart == 'millisecond' %}\n                + cast(date_format({{second_date}}, 'SSS') as int)\n                - cast(date_format({{first_date}}, 'SSS') as int)\n            {% endif %}\n            \n            {% if datepart == 'microsecond' %}    \n                {% set capture_str = '[0-9]{4}-[0-9]{2}-[0-9]{2}.[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]{6})' %}\n                -- Spark doesn't really support microseconds, so this is a massive hack!\n                -- It will only work if the timestamp-string is of the format\n                -- 'yyyy-MM-dd-HH mm.ss.SSSSSS'\n                + cast(regexp_extract({{second_date}}, '{{capture_str}}', 1) as int)\n                - cast(regexp_extract({{first_date}}, '{{capture_str}}', 1) as int)    \n            {% endif %}\n\n    {%- else -%}\n\n        {{ exceptions.raise_compiler_error(\"macro datediff not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.261755, "supported_languages": null}, "macro.spark_utils.spark__current_timestamp": {"name": "spark__current_timestamp", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "unique_id": "macro.spark_utils.spark__current_timestamp", "macro_sql": "{% macro spark__current_timestamp() %}\n    current_timestamp()\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.261896, "supported_languages": null}, "macro.spark_utils.spark__current_timestamp_in_utc": {"name": "spark__current_timestamp_in_utc", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "unique_id": "macro.spark_utils.spark__current_timestamp_in_utc", "macro_sql": "{% macro spark__current_timestamp_in_utc() %}\n    unix_timestamp()\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.261973, "supported_languages": null}, "macro.spark_utils.spark__split_part": {"name": "spark__split_part", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/split_part.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/split_part.sql", "unique_id": "macro.spark_utils.spark__split_part", "macro_sql": "{% macro spark__split_part(string_text, delimiter_text, part_number) %}\n\n    {% set delimiter_expr %}\n    \n        -- escape if starts with a special character\n        case when regexp_extract({{ delimiter_text }}, '([^A-Za-z0-9])(.*)', 1) != '_'\n            then concat('\\\\', {{ delimiter_text }})\n            else {{ delimiter_text }} end\n    \n    {% endset %}\n\n    {% set split_part_expr %}\n    \n    split(\n        {{ string_text }},\n        {{ delimiter_expr }}\n        )[({{ part_number - 1 }})]\n    \n    {% endset %}\n    \n    {{ return(split_part_expr) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.262557, "supported_languages": null}, "macro.spark_utils.spark__get_relations_by_pattern": {"name": "spark__get_relations_by_pattern", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "unique_id": "macro.spark_utils.spark__get_relations_by_pattern", "macro_sql": "{% macro spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n    {%- call statement('get_tables', fetch_result=True) %}\n\n        show table extended in {{ schema_pattern }} like '{{ table_pattern }}'\n\n    {%- endcall -%}\n\n    {%- set table_list = load_result('get_tables') -%}\n\n    {%- if table_list and table_list['table'] -%}\n    {%- set tbl_relations = [] -%}\n    {%- for row in table_list['table'] -%}\n        {%- set tbl_relation = api.Relation.create(\n            database=None,\n            schema=row[0],\n            identifier=row[1],\n            type=('view' if 'Type: VIEW' in row[3] else 'table')\n        ) -%}\n        {%- do tbl_relations.append(tbl_relation) -%}\n    {%- endfor -%}\n\n    {{ return(tbl_relations) }}\n    {%- else -%}\n    {{ return([]) }}\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.264178, "supported_languages": null}, "macro.spark_utils.spark__get_relations_by_prefix": {"name": "spark__get_relations_by_prefix", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "unique_id": "macro.spark_utils.spark__get_relations_by_prefix", "macro_sql": "{% macro spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {% set table_pattern = table_pattern ~ '*' %}\n    {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.26453, "supported_languages": null}, "macro.spark_utils.spark__get_tables_by_pattern": {"name": "spark__get_tables_by_pattern", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "unique_id": "macro.spark_utils.spark__get_tables_by_pattern", "macro_sql": "{% macro spark__get_tables_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.26481, "supported_languages": null}, "macro.spark_utils.spark__get_tables_by_prefix": {"name": "spark__get_tables_by_prefix", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "unique_id": "macro.spark_utils.spark__get_tables_by_prefix", "macro_sql": "{% macro spark__get_tables_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {{ return(spark_utils.spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.265089, "supported_languages": null}, "macro.spark_utils.assert_not_null": {"name": "assert_not_null", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "unique_id": "macro.spark_utils.assert_not_null", "macro_sql": "{% macro assert_not_null(function, arg) -%}\n  {{ return(adapter.dispatch('assert_not_null', 'spark_utils')(function, arg)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.spark_utils.default__assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.265416, "supported_languages": null}, "macro.spark_utils.default__assert_not_null": {"name": "default__assert_not_null", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "unique_id": "macro.spark_utils.default__assert_not_null", "macro_sql": "{% macro default__assert_not_null(function, arg) %}\n\n    coalesce({{function}}({{arg}}), nvl2({{function}}({{arg}}), assert_true({{function}}({{arg}}) is not null), null))\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.265624, "supported_languages": null}, "macro.spark_utils.spark__convert_timezone": {"name": "spark__convert_timezone", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/snowplow/convert_timezone.sql", "original_file_path": "macros/snowplow/convert_timezone.sql", "unique_id": "macro.spark_utils.spark__convert_timezone", "macro_sql": "{% macro spark__convert_timezone(in_tz, out_tz, in_timestamp) %}\n    from_utc_timestamp(to_utc_timestamp({{in_timestamp}}, {{in_tz}}), {{out_tz}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2658281, "supported_languages": null}, "macro.dbt_date.get_date_dimension": {"name": "get_date_dimension", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_date_dimension.sql", "original_file_path": "macros/get_date_dimension.sql", "unique_id": "macro.dbt_date.get_date_dimension", "macro_sql": "{% macro get_date_dimension(start_date, end_date) %}\n    {{ adapter.dispatch('get_date_dimension', 'dbt_date') (start_date, end_date) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__get_date_dimension"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2749681, "supported_languages": null}, "macro.dbt_date.default__get_date_dimension": {"name": "default__get_date_dimension", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_date_dimension.sql", "original_file_path": "macros/get_date_dimension.sql", "unique_id": "macro.dbt_date.default__get_date_dimension", "macro_sql": "{% macro default__get_date_dimension(start_date, end_date) %}\nwith base_dates as (\n    {{ dbt_date.get_base_dates(start_date, end_date) }}\n),\ndates_with_prior_year_dates as (\n\n    select\n        cast(d.date_day as date) as date_day,\n        cast({{ dbt.dateadd('year', -1 , 'd.date_day') }} as date) as prior_year_date_day,\n        cast({{ dbt.dateadd('day', -364 , 'd.date_day') }} as date) as prior_year_over_year_date_day\n    from\n    \tbase_dates d\n\n)\nselect\n    d.date_day,\n    {{ dbt_date.yesterday('d.date_day') }} as prior_date_day,\n    {{ dbt_date.tomorrow('d.date_day') }} as next_date_day,\n    d.prior_year_date_day as prior_year_date_day,\n    d.prior_year_over_year_date_day,\n    {{ dbt_date.day_of_week('d.date_day', isoweek=false) }} as day_of_week,\n    {{ dbt_date.day_of_week('d.date_day', isoweek=true) }} as day_of_week_iso,\n    {{ dbt_date.day_name('d.date_day', short=false) }} as day_of_week_name,\n    {{ dbt_date.day_name('d.date_day', short=true) }} as day_of_week_name_short,\n    {{ dbt_date.day_of_month('d.date_day') }} as day_of_month,\n    {{ dbt_date.day_of_year('d.date_day') }} as day_of_year,\n\n    {{ dbt_date.week_start('d.date_day') }} as week_start_date,\n    {{ dbt_date.week_end('d.date_day') }} as week_end_date,\n    {{ dbt_date.week_start('d.prior_year_over_year_date_day') }} as prior_year_week_start_date,\n    {{ dbt_date.week_end('d.prior_year_over_year_date_day') }} as prior_year_week_end_date,\n    {{ dbt_date.week_of_year('d.date_day') }} as week_of_year,\n\n    {{ dbt_date.iso_week_start('d.date_day') }} as iso_week_start_date,\n    {{ dbt_date.iso_week_end('d.date_day') }} as iso_week_end_date,\n    {{ dbt_date.iso_week_start('d.prior_year_over_year_date_day') }} as prior_year_iso_week_start_date,\n    {{ dbt_date.iso_week_end('d.prior_year_over_year_date_day') }} as prior_year_iso_week_end_date,\n    {{ dbt_date.iso_week_of_year('d.date_day') }} as iso_week_of_year,\n\n    {{ dbt_date.week_of_year('d.prior_year_over_year_date_day') }} as prior_year_week_of_year,\n    {{ dbt_date.iso_week_of_year('d.prior_year_over_year_date_day') }} as prior_year_iso_week_of_year,\n\n    cast({{ dbt_date.date_part('month', 'd.date_day') }} as {{ dbt.type_int() }}) as month_of_year,\n    {{ dbt_date.month_name('d.date_day', short=false) }}  as month_name,\n    {{ dbt_date.month_name('d.date_day', short=true) }}  as month_name_short,\n\n    cast({{ dbt.date_trunc('month', 'd.date_day') }} as date) as month_start_date,\n    cast({{ last_day('d.date_day', 'month') }} as date) as month_end_date,\n\n    cast({{ dbt.date_trunc('month', 'd.prior_year_date_day') }} as date) as prior_year_month_start_date,\n    cast({{ last_day('d.prior_year_date_day', 'month') }} as date) as prior_year_month_end_date,\n\n    cast({{ dbt_date.date_part('quarter', 'd.date_day') }} as {{ dbt.type_int() }}) as quarter_of_year,\n    cast({{ dbt.date_trunc('quarter', 'd.date_day') }} as date) as quarter_start_date,\n    cast({{ last_day('d.date_day', 'quarter') }} as date) as quarter_end_date,\n\n    cast({{ dbt_date.date_part('year', 'd.date_day') }} as {{ dbt.type_int() }}) as year_number,\n    cast({{ dbt.date_trunc('year', 'd.date_day') }} as date) as year_start_date,\n    cast({{ last_day('d.date_day', 'year') }} as date) as year_end_date\nfrom\n    dates_with_prior_year_dates d\norder by 1\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.get_base_dates", "macro.dbt.dateadd", "macro.dbt_date.yesterday", "macro.dbt_date.tomorrow", "macro.dbt_date.day_of_week", "macro.dbt_date.day_name", "macro.dbt_date.day_of_month", "macro.dbt_date.day_of_year", "macro.dbt_date.week_start", "macro.dbt_date.week_end", "macro.dbt_date.week_of_year", "macro.dbt_date.iso_week_start", "macro.dbt_date.iso_week_end", "macro.dbt_date.iso_week_of_year", "macro.dbt_date.date_part", "macro.dbt.type_int", "macro.dbt_date.month_name", "macro.dbt.date_trunc", "macro.dbt.last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.277302, "supported_languages": null}, "macro.dbt_date.postgres__get_date_dimension": {"name": "postgres__get_date_dimension", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_date_dimension.sql", "original_file_path": "macros/get_date_dimension.sql", "unique_id": "macro.dbt_date.postgres__get_date_dimension", "macro_sql": "{% macro postgres__get_date_dimension(start_date, end_date) %}\nwith base_dates as (\n    {{ dbt_date.get_base_dates(start_date, end_date) }}\n),\ndates_with_prior_year_dates as (\n\n    select\n        cast(d.date_day as date) as date_day,\n        cast({{ dbt.dateadd('year', -1 , 'd.date_day') }} as date) as prior_year_date_day,\n        cast({{ dbt.dateadd('day', -364 , 'd.date_day') }} as date) as prior_year_over_year_date_day\n    from\n    \tbase_dates d\n\n)\nselect\n    d.date_day,\n    {{ dbt_date.yesterday('d.date_day') }} as prior_date_day,\n    {{ dbt_date.tomorrow('d.date_day') }} as next_date_day,\n    d.prior_year_date_day as prior_year_date_day,\n    d.prior_year_over_year_date_day,\n    {{ dbt_date.day_of_week('d.date_day', isoweek=true) }} as day_of_week,\n\n    {{ dbt_date.day_name('d.date_day', short=false) }} as day_of_week_name,\n    {{ dbt_date.day_name('d.date_day', short=true) }} as day_of_week_name_short,\n    {{ dbt_date.day_of_month('d.date_day') }} as day_of_month,\n    {{ dbt_date.day_of_year('d.date_day') }} as day_of_year,\n\n    {{ dbt_date.week_start('d.date_day') }} as week_start_date,\n    {{ dbt_date.week_end('d.date_day') }} as week_end_date,\n    {{ dbt_date.week_start('d.prior_year_over_year_date_day') }} as prior_year_week_start_date,\n    {{ dbt_date.week_end('d.prior_year_over_year_date_day') }} as prior_year_week_end_date,\n    {{ dbt_date.week_of_year('d.date_day') }} as week_of_year,\n\n    {{ dbt_date.iso_week_start('d.date_day') }} as iso_week_start_date,\n    {{ dbt_date.iso_week_end('d.date_day') }} as iso_week_end_date,\n    {{ dbt_date.iso_week_start('d.prior_year_over_year_date_day') }} as prior_year_iso_week_start_date,\n    {{ dbt_date.iso_week_end('d.prior_year_over_year_date_day') }} as prior_year_iso_week_end_date,\n    {{ dbt_date.iso_week_of_year('d.date_day') }} as iso_week_of_year,\n\n    {{ dbt_date.week_of_year('d.prior_year_over_year_date_day') }} as prior_year_week_of_year,\n    {{ dbt_date.iso_week_of_year('d.prior_year_over_year_date_day') }} as prior_year_iso_week_of_year,\n\n    cast({{ dbt_date.date_part('month', 'd.date_day') }} as {{ dbt.type_int() }}) as month_of_year,\n    {{ dbt_date.month_name('d.date_day', short=false) }}  as month_name,\n    {{ dbt_date.month_name('d.date_day', short=true) }}  as month_name_short,\n\n    cast({{ dbt.date_trunc('month', 'd.date_day') }} as date) as month_start_date,\n    cast({{ last_day('d.date_day', 'month') }} as date) as month_end_date,\n\n    cast({{ dbt.date_trunc('month', 'd.prior_year_date_day') }} as date) as prior_year_month_start_date,\n    cast({{ last_day('d.prior_year_date_day', 'month') }} as date) as prior_year_month_end_date,\n\n    cast({{ dbt_date.date_part('quarter', 'd.date_day') }} as {{ dbt.type_int() }}) as quarter_of_year,\n    cast({{ dbt.date_trunc('quarter', 'd.date_day') }} as date) as quarter_start_date,\n    {# last_day does not support quarter because postgresql does not support quarter interval. #}\n    cast({{dbt.dateadd('day', '-1', dbt.dateadd('month', '3', dbt.date_trunc('quarter', 'd.date_day')))}} as date) as quarter_end_date,\n\n    cast({{ dbt_date.date_part('year', 'd.date_day') }} as {{ dbt.type_int() }}) as year_number,\n    cast({{ dbt.date_trunc('year', 'd.date_day') }} as date) as year_start_date,\n    cast({{ last_day('d.date_day', 'year') }} as date) as year_end_date\nfrom\n    dates_with_prior_year_dates d\norder by 1\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.get_base_dates", "macro.dbt.dateadd", "macro.dbt_date.yesterday", "macro.dbt_date.tomorrow", "macro.dbt_date.day_of_week", "macro.dbt_date.day_name", "macro.dbt_date.day_of_month", "macro.dbt_date.day_of_year", "macro.dbt_date.week_start", "macro.dbt_date.week_end", "macro.dbt_date.week_of_year", "macro.dbt_date.iso_week_start", "macro.dbt_date.iso_week_end", "macro.dbt_date.iso_week_of_year", "macro.dbt_date.date_part", "macro.dbt.type_int", "macro.dbt_date.month_name", "macro.dbt.date_trunc", "macro.dbt.last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.279658, "supported_languages": null}, "macro.dbt_date.get_base_dates": {"name": "get_base_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "unique_id": "macro.dbt_date.get_base_dates", "macro_sql": "{% macro get_base_dates(start_date=None, end_date=None, n_dateparts=None, datepart=\"day\") %}\n    {{ adapter.dispatch('get_base_dates', 'dbt_date') (start_date, end_date, n_dateparts, datepart) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__get_base_dates"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2813141, "supported_languages": null}, "macro.dbt_date.default__get_base_dates": {"name": "default__get_base_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "unique_id": "macro.dbt_date.default__get_base_dates", "macro_sql": "{% macro default__get_base_dates(start_date, end_date, n_dateparts, datepart) %}\n\n{%- if start_date and end_date -%}\n{%- set start_date=\"cast('\" ~ start_date ~ \"' as \" ~ dbt.type_timestamp() ~ \")\" -%}\n{%- set end_date=\"cast('\" ~ end_date ~ \"' as \" ~ dbt.type_timestamp() ~ \")\"  -%}\n\n{%- elif n_dateparts and datepart -%}\n\n{%- set start_date = dbt.dateadd(datepart, -1 * n_dateparts, dbt_date.today()) -%}\n{%- set end_date = dbt_date.tomorrow() -%}\n{%- endif -%}\n\nwith date_spine as\n(\n\n    {{ dbt_date.date_spine(\n        datepart=datepart,\n        start_date=start_date,\n        end_date=end_date,\n       )\n    }}\n\n)\nselect\n    cast(d.date_{{ datepart }} as {{ dbt.type_timestamp() }}) as date_{{ datepart }}\nfrom\n    date_spine d\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp", "macro.dbt.dateadd", "macro.dbt_date.today", "macro.dbt_date.tomorrow", "macro.dbt_date.date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.282076, "supported_languages": null}, "macro.dbt_date.bigquery__get_base_dates": {"name": "bigquery__get_base_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "unique_id": "macro.dbt_date.bigquery__get_base_dates", "macro_sql": "{% macro bigquery__get_base_dates(start_date, end_date, n_dateparts, datepart) %}\n\n{%- if start_date and end_date -%}\n{%- set start_date=\"cast('\" ~ start_date ~ \"' as datetime )\" -%}\n{%- set end_date=\"cast('\" ~ end_date ~ \"' as datetime )\" -%}\n\n{%- elif n_dateparts and datepart -%}\n\n{%- set start_date = dbt.dateadd(datepart, -1 * n_dateparts, dbt_date.today()) -%}\n{%- set end_date = dbt_date.tomorrow() -%}\n{%- endif -%}\n\nwith date_spine as\n(\n\n    {{ dbt_date.date_spine(\n        datepart=datepart,\n        start_date=start_date,\n        end_date=end_date,\n       )\n    }}\n\n)\nselect\n    cast(d.date_{{ datepart }} as {{ dbt.type_timestamp() }}) as date_{{ datepart }}\nfrom\n    date_spine d\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt_date.today", "macro.dbt_date.tomorrow", "macro.dbt_date.date_spine", "macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2827652, "supported_languages": null}, "macro.dbt_date.trino__get_base_dates": {"name": "trino__get_base_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "unique_id": "macro.dbt_date.trino__get_base_dates", "macro_sql": "{% macro trino__get_base_dates(start_date, end_date, n_dateparts, datepart) %}\n\n{%- if start_date and end_date -%}\n{%- set start_date=\"cast('\" ~ start_date ~ \"' as \" ~ dbt.type_timestamp() ~ \")\" -%}\n{%- set end_date=\"cast('\" ~ end_date ~ \"' as \" ~ dbt.type_timestamp() ~ \")\"  -%}\n\n{%- elif n_dateparts and datepart -%}\n\n{%- set start_date = dbt.dateadd(datepart, -1 * n_dateparts, dbt_date.now()) -%}\n{%- set end_date = dbt_date.tomorrow() -%}\n{%- endif -%}\n\nwith date_spine as\n(\n\n    {{ dbt_date.date_spine(\n        datepart=datepart,\n        start_date=start_date,\n        end_date=end_date,\n       )\n    }}\n\n)\nselect\n    cast(d.date_{{ datepart }} as {{ dbt.type_timestamp() }}) as date_{{ datepart }}\nfrom\n    date_spine d\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp", "macro.dbt.dateadd", "macro.dbt_date.now", "macro.dbt_date.tomorrow", "macro.dbt_date.date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.283515, "supported_languages": null}, "macro.dbt_date.get_intervals_between": {"name": "get_intervals_between", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/date_spine.sql", "original_file_path": "macros/_utils/date_spine.sql", "unique_id": "macro.dbt_date.get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n    {{ return(adapter.dispatch('get_intervals_between', 'dbt_date')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.284232, "supported_languages": null}, "macro.dbt_date.default__get_intervals_between": {"name": "default__get_intervals_between", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/date_spine.sql", "original_file_path": "macros/_utils/date_spine.sql", "unique_id": "macro.dbt_date.default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n    {%- call statement('get_intervals_between', fetch_result=True) %}\n\n        select {{ dbt.datediff(start_date, end_date, datepart) }}\n\n    {%- endcall -%}\n\n    {%- set value_list = load_result('get_intervals_between') -%}\n\n    {%- if value_list and value_list['data'] -%}\n        {%- set values = value_list['data'] | map(attribute=0) | list %}\n        {{ return(values[0]) }}\n    {%- else -%}\n        {{ return(1) }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.284828, "supported_languages": null}, "macro.dbt_date.date_spine": {"name": "date_spine", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/date_spine.sql", "original_file_path": "macros/_utils/date_spine.sql", "unique_id": "macro.dbt_date.date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n    {{ return(adapter.dispatch('date_spine', 'dbt_date')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2850611, "supported_languages": null}, "macro.dbt_date.default__date_spine": {"name": "default__date_spine", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/date_spine.sql", "original_file_path": "macros/_utils/date_spine.sql", "unique_id": "macro.dbt_date.default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n{# call as follows:\n\ndate_spine(\n    \"day\",\n    \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n    \"dbt.dateadd(week, 1, current_date)\"\n) #}\n\n\nwith rawdata as (\n\n    {{\n        dbt_date.generate_series(\n            dbt_date.get_intervals_between(start_date, end_date, datepart)\n        )\n    }}\n\n),\n\nall_periods as (\n\n    select (\n        {{\n            dbt.dateadd(\n                datepart,\n                \"(row_number() over (order by 1) - 1)\",\n                start_date\n            )\n        }}\n    ) as date_{{datepart}}\n    from rawdata\n\n),\n\nfiltered as (\n\n    select *\n    from all_periods\n    where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.generate_series", "macro.dbt_date.get_intervals_between", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.285429, "supported_languages": null}, "macro.dbt_date.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/generate_series.sql", "original_file_path": "macros/_utils/generate_series.sql", "unique_id": "macro.dbt_date.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n    {{ return(adapter.dispatch('get_powers_of_two', 'dbt_date')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.286268, "supported_languages": null}, "macro.dbt_date.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/generate_series.sql", "original_file_path": "macros/_utils/generate_series.sql", "unique_id": "macro.dbt_date.default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n    {% if upper_bound <= 0 %}\n    {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n    {% endif %}\n\n    {% for _ in range(1, 100) %}\n       {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n    {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.28669, "supported_languages": null}, "macro.dbt_date.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/generate_series.sql", "original_file_path": "macros/_utils/generate_series.sql", "unique_id": "macro.dbt_date.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n    {{ return(adapter.dispatch('generate_series', 'dbt_date')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2868779, "supported_languages": null}, "macro.dbt_date.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/generate_series.sql", "original_file_path": "macros/_utils/generate_series.sql", "unique_id": "macro.dbt_date.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n    {% set n = dbt_date.get_powers_of_two(upper_bound) %}\n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    {% for i in range(n) %}\n    p{{i}}.generated_number * power(2, {{i}})\n    {% if not loop.last %} + {% endif %}\n    {% endfor %}\n    + 1\n    as generated_number\n\n    from\n\n    {% for i in range(n) %}\n    p as p{{i}}\n    {% if not loop.last %} cross join {% endif %}\n    {% endfor %}\n\n    )\n\n    select *\n    from unioned\n    where generated_number <= {{upper_bound}}\n    order by generated_number\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.287403, "supported_languages": null}, "macro.dbt_date.date": {"name": "date", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/modules_datetime.sql", "original_file_path": "macros/_utils/modules_datetime.sql", "unique_id": "macro.dbt_date.date", "macro_sql": "{% macro date(year, month, day) %}\n    {{ return(modules.datetime.date(year, month, day)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.287743, "supported_languages": null}, "macro.dbt_date.datetime": {"name": "datetime", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/modules_datetime.sql", "original_file_path": "macros/_utils/modules_datetime.sql", "unique_id": "macro.dbt_date.datetime", "macro_sql": "{% macro datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tz=None) %}\n    {% set tz = tz if tz else var(\"dbt_date:time_zone\") %}\n    {{ return(\n        modules.datetime.datetime(\n            year=year, month=month, day=day, hour=hour,\n            minute=minute, second=second, microsecond=microsecond,\n            tzinfo=modules.pytz.timezone(tz)\n        )\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.288306, "supported_languages": null}, "macro.dbt_date.get_fiscal_year_dates": {"name": "get_fiscal_year_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/fiscal_date/get_fiscal_year_dates.sql", "original_file_path": "macros/fiscal_date/get_fiscal_year_dates.sql", "unique_id": "macro.dbt_date.get_fiscal_year_dates", "macro_sql": "{% macro get_fiscal_year_dates(dates, year_end_month=12, week_start_day=1, shift_year=1) %}\n{{ adapter.dispatch('get_fiscal_year_dates', 'dbt_date') (dates, year_end_month, week_start_day, shift_year) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__get_fiscal_year_dates"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2901492, "supported_languages": null}, "macro.dbt_date.default__get_fiscal_year_dates": {"name": "default__get_fiscal_year_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/fiscal_date/get_fiscal_year_dates.sql", "original_file_path": "macros/fiscal_date/get_fiscal_year_dates.sql", "unique_id": "macro.dbt_date.default__get_fiscal_year_dates", "macro_sql": "{% macro default__get_fiscal_year_dates(dates, year_end_month, week_start_day, shift_year) %}\n-- this gets all the dates within a fiscal year\n-- determined by the given year-end-month\n-- ending on the saturday closest to that month's end date\nwith fsc_date_dimension as (\n    select * from {{ dates }}\n),\nyear_month_end as (\n\n    select\n       d.year_number - {{ shift_year }} as fiscal_year_number,\n       d.month_end_date\n    from\n        fsc_date_dimension d\n    where\n        d.month_of_year = {{ year_end_month }}\n    group by 1,2\n\n),\nweeks as (\n\n    select\n        d.year_number,\n        d.month_of_year,\n        d.date_day as week_start_date,\n        cast({{ dbt.dateadd('day', 6, 'd.date_day') }} as date) as week_end_date\n    from\n        fsc_date_dimension d\n    where\n        d.day_of_week = {{ week_start_day }}\n\n),\n-- get all the weeks that start in the month the year ends\nyear_week_ends as (\n\n    select\n        d.year_number - {{ shift_year }} as fiscal_year_number,\n        d.week_end_date\n    from\n        weeks d\n    where\n        d.month_of_year = {{ year_end_month }}\n    group by\n        1,2\n\n),\n-- then calculate which Saturday is closest to month end\nweeks_at_month_end as (\n\n    select\n        d.fiscal_year_number,\n        d.week_end_date,\n        m.month_end_date,\n        rank() over\n            (partition by d.fiscal_year_number\n                order by\n                abs({{ dbt.datediff('d.week_end_date', 'm.month_end_date', 'day') }})\n\n            ) as closest_to_month_end\n    from\n        year_week_ends d\n        join\n        year_month_end m on d.fiscal_year_number = m.fiscal_year_number\n),\nfiscal_year_range as (\n\n    select\n        w.fiscal_year_number,\n        cast(\n            {{ dbt.dateadd('day', 1,\n            'lag(w.week_end_date) over(order by w.week_end_date)') }}\n            as date) as fiscal_year_start_date,\n        w.week_end_date as fiscal_year_end_date\n    from\n        weeks_at_month_end w\n    where\n        w.closest_to_month_end = 1\n\n),\nfiscal_year_dates as (\n\n    select\n        d.date_day,\n        m.fiscal_year_number,\n        m.fiscal_year_start_date,\n        m.fiscal_year_end_date,\n        w.week_start_date,\n        w.week_end_date,\n        -- we reset the weeks of the year starting with the merch year start date\n        dense_rank()\n            over(\n                partition by m.fiscal_year_number\n                order by w.week_start_date\n                ) as fiscal_week_of_year\n    from\n        fsc_date_dimension d\n        join\n        fiscal_year_range m on d.date_day between m.fiscal_year_start_date and m.fiscal_year_end_date\n        join\n        weeks w on d.date_day between w.week_start_date and w.week_end_date\n\n)\nselect * from fiscal_year_dates order by 1\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.290764, "supported_languages": null}, "macro.dbt_date.get_fiscal_periods": {"name": "get_fiscal_periods", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/fiscal_date/get_fiscal_periods.sql", "original_file_path": "macros/fiscal_date/get_fiscal_periods.sql", "unique_id": "macro.dbt_date.get_fiscal_periods", "macro_sql": "{% macro get_fiscal_periods(dates, year_end_month, week_start_day, shift_year=1) %}\n{#\nThis macro requires you to pass in a ref to a date dimension, created via\ndbt_date.get_date_dimension()s\n#}\nwith fscl_year_dates_for_periods as (\n    {{ dbt_date.get_fiscal_year_dates(dates, year_end_month, week_start_day, shift_year) }}\n),\nfscl_year_w13 as (\n\n    select\n        f.*,\n        -- We count the weeks in a 13 week period\n        -- and separate the 4-5-4 week sequences\n        mod(cast(\n            (f.fiscal_week_of_year-1) as {{ dbt.type_int() }}\n            ), 13) as w13_number,\n        -- Chop weeks into 13 week merch quarters\n        cast(\n            least(\n                floor((f.fiscal_week_of_year-1)/13.0)\n                , 3)\n            as {{ dbt.type_int() }}) as quarter_number\n    from\n        fscl_year_dates_for_periods f\n\n),\nfscl_periods as (\n\n    select\n        f.date_day,\n        f.fiscal_year_number,\n        f.week_start_date,\n        f.week_end_date,\n        f.fiscal_week_of_year,\n        case\n            -- we move week 53 into the 3rd period of the quarter\n            when f.fiscal_week_of_year = 53 then 3\n            when f.w13_number between 0 and 3 then 1\n            when f.w13_number between 4 and 8 then 2\n            when f.w13_number between 9 and 12 then 3\n        end as period_of_quarter,\n        f.quarter_number\n    from\n        fscl_year_w13 f\n\n),\nfscl_periods_quarters as (\n\n    select\n        f.*,\n        cast((\n            (f.quarter_number * 3) + f.period_of_quarter\n         ) as {{ dbt.type_int() }}) as fiscal_period_number\n    from\n        fscl_periods f\n\n)\nselect\n    date_day,\n    fiscal_year_number,\n    week_start_date,\n    week_end_date,\n    fiscal_week_of_year,\n    dense_rank() over(partition by fiscal_period_number order by fiscal_week_of_year) as fiscal_week_of_period,\n    fiscal_period_number,\n    quarter_number+1 as fiscal_quarter_number,\n    period_of_quarter as fiscal_period_of_quarter\nfrom\n    fscl_periods_quarters\norder by 1,2\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.get_fiscal_year_dates", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.291737, "supported_languages": null}, "macro.dbt_date.tomorrow": {"name": "tomorrow", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/tomorrow.sql", "original_file_path": "macros/calendar_date/tomorrow.sql", "unique_id": "macro.dbt_date.tomorrow", "macro_sql": "{%- macro tomorrow(date=None, tz=None) -%}\n{{ dbt_date.n_days_away(1, date, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.291958, "supported_languages": null}, "macro.dbt_date.next_week": {"name": "next_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/next_week.sql", "original_file_path": "macros/calendar_date/next_week.sql", "unique_id": "macro.dbt_date.next_week", "macro_sql": "{%- macro next_week(tz=None) -%}\n{{ dbt_date.n_weeks_away(1, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_weeks_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2921422, "supported_languages": null}, "macro.dbt_date.next_month_name": {"name": "next_month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/next_month_name.sql", "original_file_path": "macros/calendar_date/next_month_name.sql", "unique_id": "macro.dbt_date.next_month_name", "macro_sql": "{%- macro next_month_name(short=True, tz=None) -%}\n{{ dbt_date.month_name(dbt_date.next_month(tz), short=short) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.month_name", "macro.dbt_date.next_month"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.292446, "supported_languages": null}, "macro.dbt_date.next_month": {"name": "next_month", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/next_month.sql", "original_file_path": "macros/calendar_date/next_month.sql", "unique_id": "macro.dbt_date.next_month", "macro_sql": "{%- macro next_month(tz=None) -%}\n{{ dbt_date.n_months_away(1, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_months_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2926311, "supported_languages": null}, "macro.dbt_date.day_name": {"name": "day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.day_name", "macro_sql": "{%- macro day_name(date, short=True) -%}\n    {{ adapter.dispatch('day_name', 'dbt_date') (date, short) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.snowflake__day_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.293464, "supported_languages": null}, "macro.dbt_date.default__day_name": {"name": "default__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.default__day_name", "macro_sql": "\n\n{%- macro default__day_name(date, short) -%}\n{%- set f = 'Dy' if short else 'Day' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2936692, "supported_languages": null}, "macro.dbt_date.snowflake__day_name": {"name": "snowflake__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.snowflake__day_name", "macro_sql": "\n\n{%- macro snowflake__day_name(date, short) -%}\n    {%- if short -%}\n    dayname({{ date }})\n    {%- else -%}\n    -- long version not implemented on Snowflake so we're doing it manually :/\n    case dayname({{ date }})\n        when 'Mon' then 'Monday'\n        when 'Tue' then 'Tuesday'\n        when 'Wed' then 'Wednesday'\n        when 'Thu' then 'Thursday'\n        when 'Fri' then 'Friday'\n        when 'Sat' then 'Saturday'\n        when 'Sun' then 'Sunday'\n    end\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2938821, "supported_languages": null}, "macro.dbt_date.bigquery__day_name": {"name": "bigquery__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.bigquery__day_name", "macro_sql": "\n\n{%- macro bigquery__day_name(date, short) -%}\n{%- set f = '%a' if short else '%A' -%}\n    format_date('{{ f }}', cast({{ date }} as date))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.294087, "supported_languages": null}, "macro.dbt_date.postgres__day_name": {"name": "postgres__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.postgres__day_name", "macro_sql": "\n\n{%- macro postgres__day_name(date, short) -%}\n{# FM = Fill mode, which suppresses padding blanks #}\n{%- set f = 'FMDy' if short else 'FMDay' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.294299, "supported_languages": null}, "macro.dbt_date.duckdb__day_name": {"name": "duckdb__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.duckdb__day_name", "macro_sql": "\n\n{%- macro duckdb__day_name(date, short) -%}\n    {%- if short -%}\n    substr(dayname({{ date }}), 1, 3)\n    {%- else -%}\n    dayname({{ date }})\n    {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.29449, "supported_languages": null}, "macro.dbt_date.spark__day_name": {"name": "spark__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.spark__day_name", "macro_sql": "\n\n{%- macro spark__day_name(date, short) -%}\n{%- set f = 'E' if short else 'EEEE' -%}\n    date_format({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.294691, "supported_languages": null}, "macro.dbt_date.trino__day_name": {"name": "trino__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.trino__day_name", "macro_sql": "\n\n{%- macro trino__day_name(date, short) -%}\n{%- set f = 'a' if short else 'W' -%}\n    date_format({{ date }}, '%{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.29489, "supported_languages": null}, "macro.dbt_date.to_unixtimestamp": {"name": "to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.to_unixtimestamp", "macro_sql": "{%- macro to_unixtimestamp(timestamp) -%}\n    {{ adapter.dispatch('to_unixtimestamp', 'dbt_date') (timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.snowflake__to_unixtimestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.295299, "supported_languages": null}, "macro.dbt_date.default__to_unixtimestamp": {"name": "default__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.default__to_unixtimestamp", "macro_sql": "\n\n{%- macro default__to_unixtimestamp(timestamp) -%}\n    {{ dbt_date.date_part('epoch', timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.295439, "supported_languages": null}, "macro.dbt_date.snowflake__to_unixtimestamp": {"name": "snowflake__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.snowflake__to_unixtimestamp", "macro_sql": "\n\n{%- macro snowflake__to_unixtimestamp(timestamp) -%}\n    {{ dbt_date.date_part('epoch_seconds', timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.295582, "supported_languages": null}, "macro.dbt_date.bigquery__to_unixtimestamp": {"name": "bigquery__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.bigquery__to_unixtimestamp", "macro_sql": "\n\n{%- macro bigquery__to_unixtimestamp(timestamp) -%}\n    unix_seconds({{ timestamp }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.295685, "supported_languages": null}, "macro.dbt_date.spark__to_unixtimestamp": {"name": "spark__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.spark__to_unixtimestamp", "macro_sql": "\n\n{%- macro spark__to_unixtimestamp(timestamp) -%}\n    unix_timestamp({{ timestamp }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.295786, "supported_languages": null}, "macro.dbt_date.trino__to_unixtimestamp": {"name": "trino__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.trino__to_unixtimestamp", "macro_sql": "\n\n{%- macro trino__to_unixtimestamp(timestamp) -%}\n    to_unixtime({{ timestamp }} AT TIME ZONE 'UTC')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.295888, "supported_languages": null}, "macro.dbt_date.n_days_away": {"name": "n_days_away", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_days_away.sql", "original_file_path": "macros/calendar_date/n_days_away.sql", "unique_id": "macro.dbt_date.n_days_away", "macro_sql": "{%- macro n_days_away(n, date=None, tz=None) -%}\n{{ dbt_date.n_days_ago(-1 * n, date, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_days_ago"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.296132, "supported_languages": null}, "macro.dbt_date.week_start": {"name": "week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.week_start", "macro_sql": "{%- macro week_start(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('week_start', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.snowflake__week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.296629, "supported_languages": null}, "macro.dbt_date.default__week_start": {"name": "default__week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.default__week_start", "macro_sql": "{%- macro default__week_start(date) -%}\ncast({{ dbt.date_trunc('week', date) }} as date)\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2967858, "supported_languages": null}, "macro.dbt_date.snowflake__week_start": {"name": "snowflake__week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.snowflake__week_start", "macro_sql": "\n\n{%- macro snowflake__week_start(date) -%}\n    {#\n        Get the day of week offset: e.g. if the date is a Sunday,\n        dbt_date.day_of_week returns 1, so we subtract 1 to get a 0 offset\n    #}\n    {% set off_set = dbt_date.day_of_week(date, isoweek=False) ~ \" - 1\" %}\n    cast({{ dbt.dateadd(\"day\", \"-1 * (\" ~ off_set ~ \")\", date) }} as date)\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.day_of_week", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.297139, "supported_languages": null}, "macro.dbt_date.postgres__week_start": {"name": "postgres__week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.postgres__week_start", "macro_sql": "\n\n{%- macro postgres__week_start(date) -%}\n-- Sunday as week start date\ncast({{ dbt.dateadd('day', -1, dbt.date_trunc('week', dbt.dateadd('day', 1, date))) }} as date)\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2974, "supported_languages": null}, "macro.dbt_date.duckdb__week_start": {"name": "duckdb__week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.duckdb__week_start", "macro_sql": "\n\n{%- macro duckdb__week_start(date) -%}\n{{ return(dbt_date.postgres__week_start(date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2975512, "supported_languages": null}, "macro.dbt_date.iso_week_start": {"name": "iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.iso_week_start", "macro_sql": "{%- macro iso_week_start(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('iso_week_start', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.snowflake__iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.298212, "supported_languages": null}, "macro.dbt_date._iso_week_start": {"name": "_iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date._iso_week_start", "macro_sql": "{%- macro _iso_week_start(date, week_type) -%}\ncast({{ dbt.date_trunc(week_type, date) }} as date)\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.298369, "supported_languages": null}, "macro.dbt_date.default__iso_week_start": {"name": "default__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.default__iso_week_start", "macro_sql": "\n\n{%- macro default__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'isoweek') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.298511, "supported_languages": null}, "macro.dbt_date.snowflake__iso_week_start": {"name": "snowflake__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.snowflake__iso_week_start", "macro_sql": "\n\n{%- macro snowflake__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.298651, "supported_languages": null}, "macro.dbt_date.postgres__iso_week_start": {"name": "postgres__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.postgres__iso_week_start", "macro_sql": "\n\n{%- macro postgres__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.298788, "supported_languages": null}, "macro.dbt_date.duckdb__iso_week_start": {"name": "duckdb__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.duckdb__iso_week_start", "macro_sql": "\n\n{%- macro duckdb__iso_week_start(date) -%}\n{{ return(dbt_date.postgres__iso_week_start(date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.298931, "supported_languages": null}, "macro.dbt_date.spark__iso_week_start": {"name": "spark__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.spark__iso_week_start", "macro_sql": "\n\n{%- macro spark__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.299071, "supported_languages": null}, "macro.dbt_date.trino__iso_week_start": {"name": "trino__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.trino__iso_week_start", "macro_sql": "\n\n{%- macro trino__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.29921, "supported_languages": null}, "macro.dbt_date.n_days_ago": {"name": "n_days_ago", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_days_ago.sql", "original_file_path": "macros/calendar_date/n_days_ago.sql", "unique_id": "macro.dbt_date.n_days_ago", "macro_sql": "{%- macro n_days_ago(n, date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{%- set n = n|int -%}\ncast({{ dbt.dateadd('day', -1 * n, dt) }} as date)\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.299619, "supported_languages": null}, "macro.dbt_date.last_week": {"name": "last_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/last_week.sql", "original_file_path": "macros/calendar_date/last_week.sql", "unique_id": "macro.dbt_date.last_week", "macro_sql": "{%- macro last_week(tz=None) -%}\n{{ dbt_date.n_weeks_ago(1, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_weeks_ago"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2998028, "supported_languages": null}, "macro.dbt_date.now": {"name": "now", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/now.sql", "original_file_path": "macros/calendar_date/now.sql", "unique_id": "macro.dbt_date.now", "macro_sql": "{%- macro now(tz=None) -%}\n{{ dbt_date.convert_timezone(dbt.current_timestamp(), tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.convert_timezone", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.300006, "supported_languages": null}, "macro.dbt_date.periods_since": {"name": "periods_since", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/periods_since.sql", "original_file_path": "macros/calendar_date/periods_since.sql", "unique_id": "macro.dbt_date.periods_since", "macro_sql": "{%- macro periods_since(date_col, period_name='day', tz=None) -%}\n{{ dbt.datediff(date_col, dbt_date.now(tz), period_name) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt_date.now"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.300266, "supported_languages": null}, "macro.dbt_date.today": {"name": "today", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/today.sql", "original_file_path": "macros/calendar_date/today.sql", "unique_id": "macro.dbt_date.today", "macro_sql": "{%- macro today(tz=None) -%}\ncast({{ dbt_date.now(tz) }} as date)\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.now"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.300441, "supported_languages": null}, "macro.dbt_date.last_month": {"name": "last_month", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/last_month.sql", "original_file_path": "macros/calendar_date/last_month.sql", "unique_id": "macro.dbt_date.last_month", "macro_sql": "{%- macro last_month(tz=None) -%}\n{{ dbt_date.n_months_ago(1, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_months_ago"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.30062, "supported_languages": null}, "macro.dbt_date.day_of_year": {"name": "day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.day_of_year", "macro_sql": "{%- macro day_of_year(date) -%}\n{{ adapter.dispatch('day_of_year', 'dbt_date') (date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__day_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.301025, "supported_languages": null}, "macro.dbt_date.default__day_of_year": {"name": "default__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.default__day_of_year", "macro_sql": "\n\n{%- macro default__day_of_year(date) -%}\n    {{ dbt_date.date_part('dayofyear', date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.301226, "supported_languages": null}, "macro.dbt_date.postgres__day_of_year": {"name": "postgres__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.postgres__day_of_year", "macro_sql": "\n\n{%- macro postgres__day_of_year(date) -%}\n    {{ dbt_date.date_part('doy', date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.301366, "supported_languages": null}, "macro.dbt_date.redshift__day_of_year": {"name": "redshift__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.redshift__day_of_year", "macro_sql": "\n\n{%- macro redshift__day_of_year(date) -%}\n    cast({{ dbt_date.date_part('dayofyear', date) }} as {{ dbt.type_bigint() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.301547, "supported_languages": null}, "macro.dbt_date.spark__day_of_year": {"name": "spark__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.spark__day_of_year", "macro_sql": "\n\n{%- macro spark__day_of_year(date) -%}\n    dayofyear({{ date }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.301822, "supported_languages": null}, "macro.dbt_date.trino__day_of_year": {"name": "trino__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.trino__day_of_year", "macro_sql": "\n\n{%- macro trino__day_of_year(date) -%}\n    {{ dbt_date.date_part('day_of_year', date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.301965, "supported_languages": null}, "macro.dbt_date.round_timestamp": {"name": "round_timestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/round_timestamp.sql", "original_file_path": "macros/calendar_date/round_timestamp.sql", "unique_id": "macro.dbt_date.round_timestamp", "macro_sql": "{% macro round_timestamp(timestamp) %}\n    {{ dbt.date_trunc(\"day\", dbt.dateadd(\"hour\", 12, timestamp)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.30221, "supported_languages": null}, "macro.dbt_date.from_unixtimestamp": {"name": "from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.from_unixtimestamp", "macro_sql": "{%- macro from_unixtimestamp(epochs, format=\"seconds\") -%}\n    {{ adapter.dispatch('from_unixtimestamp', 'dbt_date') (epochs, format) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.snowflake__from_unixtimestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.304384, "supported_languages": null}, "macro.dbt_date.default__from_unixtimestamp": {"name": "default__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.default__from_unixtimestamp", "macro_sql": "\n\n{%- macro default__from_unixtimestamp(epochs, format=\"seconds\") -%}\n    {%- if format != \"seconds\" -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n    to_timestamp({{ epochs }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3046489, "supported_languages": null}, "macro.dbt_date.postgres__from_unixtimestamp": {"name": "postgres__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.postgres__from_unixtimestamp", "macro_sql": "\n\n{%- macro postgres__from_unixtimestamp(epochs, format=\"seconds\") -%}\n    {%- if format != \"seconds\" -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n    cast(to_timestamp({{ epochs }}) at time zone 'UTC' as timestamp)\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.304914, "supported_languages": null}, "macro.dbt_date.snowflake__from_unixtimestamp": {"name": "snowflake__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.snowflake__from_unixtimestamp", "macro_sql": "\n\n{%- macro snowflake__from_unixtimestamp(epochs, format) -%}\n    {%- if format == \"seconds\" -%}\n    {%- set scale = 0 -%}\n    {%- elif format == \"milliseconds\" -%}\n    {%- set scale = 3 -%}\n    {%- elif format == \"microseconds\" -%}\n    {%- set scale = 6 -%}\n    {%- else -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n    to_timestamp_ntz({{ epochs }}, {{ scale }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.305384, "supported_languages": null}, "macro.dbt_date.bigquery__from_unixtimestamp": {"name": "bigquery__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.bigquery__from_unixtimestamp", "macro_sql": "\n\n{%- macro bigquery__from_unixtimestamp(epochs, format) -%}\n    {%- if format == \"seconds\" -%}\n        timestamp_seconds({{ epochs }})\n    {%- elif format == \"milliseconds\" -%}\n        timestamp_millis({{ epochs }})\n    {%- elif format == \"microseconds\" -%}\n        timestamp_micros({{ epochs }})\n    {%- else -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.305781, "supported_languages": null}, "macro.dbt_date.trino__from_unixtimestamp": {"name": "trino__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.trino__from_unixtimestamp", "macro_sql": "\n\n{%- macro trino__from_unixtimestamp(epochs, format) -%}\n    {%- if format == \"seconds\" -%}\n        cast(from_unixtime({{ epochs }}) AT TIME ZONE 'UTC' as {{ dbt.type_timestamp() }})\n    {%- elif format == \"milliseconds\" -%}\n        cast(from_unixtime_nanos({{ epochs }} * pow(10, 6)) AT TIME ZONE 'UTC' as {{ dbt.type_timestamp() }})\n    {%- elif format == \"microseconds\" -%}\n        cast(from_unixtime_nanos({{ epochs }} * pow(10, 3)) AT TIME ZONE 'UTC' as {{ dbt.type_timestamp() }})\n    {%- elif format == \"nanoseconds\" -%}\n        cast(from_unixtime_nanos({{ epochs }}) AT TIME ZONE 'UTC' as {{ dbt.type_timestamp() }})\n    {%- else -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.306391, "supported_languages": null}, "macro.dbt_date.n_months_ago": {"name": "n_months_ago", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_months_ago.sql", "original_file_path": "macros/calendar_date/n_months_ago.sql", "unique_id": "macro.dbt_date.n_months_ago", "macro_sql": "{%- macro n_months_ago(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt.date_trunc('month',\n    dbt.dateadd('month', -1 * n,\n        dbt_date.today(tz)\n        )\n    ) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.306768, "supported_languages": null}, "macro.dbt_date.date_part": {"name": "date_part", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "unique_id": "macro.dbt_date.date_part", "macro_sql": "{% macro date_part(datepart, date) -%}\n    {{ adapter.dispatch('date_part', 'dbt_date') (datepart, date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.307115, "supported_languages": null}, "macro.dbt_date.default__date_part": {"name": "default__date_part", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "unique_id": "macro.dbt_date.default__date_part", "macro_sql": "{% macro default__date_part(datepart, date) -%}\n    date_part('{{ datepart }}', {{  date }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3072488, "supported_languages": null}, "macro.dbt_date.bigquery__date_part": {"name": "bigquery__date_part", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "unique_id": "macro.dbt_date.bigquery__date_part", "macro_sql": "{% macro bigquery__date_part(datepart, date) -%}\n    extract({{ datepart }} from {{ date }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3073778, "supported_languages": null}, "macro.dbt_date.trino__date_part": {"name": "trino__date_part", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "unique_id": "macro.dbt_date.trino__date_part", "macro_sql": "{% macro trino__date_part(datepart, date) -%}\n    extract({{ datepart }} from {{ date }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.307509, "supported_languages": null}, "macro.dbt_date.n_weeks_away": {"name": "n_weeks_away", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_weeks_away.sql", "original_file_path": "macros/calendar_date/n_weeks_away.sql", "unique_id": "macro.dbt_date.n_weeks_away", "macro_sql": "{%- macro n_weeks_away(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt.date_trunc('week',\n    dbt.dateadd('week', n,\n        dbt_date.today(tz)\n        )\n    ) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.30786, "supported_languages": null}, "macro.dbt_date.day_of_month": {"name": "day_of_month", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_month.sql", "original_file_path": "macros/calendar_date/day_of_month.sql", "unique_id": "macro.dbt_date.day_of_month", "macro_sql": "{%- macro day_of_month(date) -%}\n{{ dbt_date.date_part('day', date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.308073, "supported_languages": null}, "macro.dbt_date.redshift__day_of_month": {"name": "redshift__day_of_month", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_month.sql", "original_file_path": "macros/calendar_date/day_of_month.sql", "unique_id": "macro.dbt_date.redshift__day_of_month", "macro_sql": "\n\n{%- macro redshift__day_of_month(date) -%}\ncast({{ dbt_date.date_part('day', date) }} as {{ dbt.type_bigint() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.308256, "supported_languages": null}, "macro.dbt_date.yesterday": {"name": "yesterday", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/yesterday.sql", "original_file_path": "macros/calendar_date/yesterday.sql", "unique_id": "macro.dbt_date.yesterday", "macro_sql": "{%- macro yesterday(date=None, tz=None) -%}\n{{ dbt_date.n_days_ago(1, date, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_days_ago"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.308473, "supported_languages": null}, "macro.dbt_date.day_of_week": {"name": "day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.day_of_week", "macro_sql": "{%- macro day_of_week(date, isoweek=true) -%}\n{{ adapter.dispatch('day_of_week', 'dbt_date') (date, isoweek) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.snowflake__day_of_week"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.311222, "supported_languages": null}, "macro.dbt_date.default__day_of_week": {"name": "default__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.default__day_of_week", "macro_sql": "\n\n{%- macro default__day_of_week(date, isoweek) -%}\n\n    {%- set dow = dbt_date.date_part('dayofweek', date) -%}\n\n    {%- if isoweek -%}\n    case\n        -- Shift start of week from Sunday (0) to Monday (1)\n        when {{ dow }} = 0 then 7\n        else {{ dow }}\n    end\n    {%- else -%}\n    {{ dow }} + 1\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.311578, "supported_languages": null}, "macro.dbt_date.snowflake__day_of_week": {"name": "snowflake__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.snowflake__day_of_week", "macro_sql": "\n\n{%- macro snowflake__day_of_week(date, isoweek) -%}\n\n    {%- if isoweek -%}\n        {%- set dow_part = 'dayofweekiso' -%}\n        {{ dbt_date.date_part(dow_part, date) }}\n    {%- else -%}\n        {%- set dow_part = 'dayofweek' -%}\n        case\n            when {{ dbt_date.date_part(dow_part, date) }} = 7 then 1\n            else {{ dbt_date.date_part(dow_part, date) }} + 1\n        end\n    {%- endif -%}\n\n\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.311994, "supported_languages": null}, "macro.dbt_date.bigquery__day_of_week": {"name": "bigquery__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.bigquery__day_of_week", "macro_sql": "\n\n{%- macro bigquery__day_of_week(date, isoweek) -%}\n\n    {%- set dow = dbt_date.date_part('dayofweek', date) -%}\n\n    {%- if isoweek -%}\n    case\n        -- Shift start of week from Sunday (1) to Monday (2)\n        when {{ dow }} = 1 then 7\n        else {{ dow }} - 1\n    end\n    {%- else -%}\n    {{ dow }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.312287, "supported_languages": null}, "macro.dbt_date.postgres__day_of_week": {"name": "postgres__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.postgres__day_of_week", "macro_sql": "\n\n\n{%- macro postgres__day_of_week(date, isoweek) -%}\n\n    {%- if isoweek -%}\n        {%- set dow_part = 'isodow' -%}\n        -- Monday(1) to Sunday (7)\n        cast({{ dbt_date.date_part(dow_part, date) }} as {{ dbt.type_int() }})\n    {%- else -%}\n        {%- set dow_part = 'dow' -%}\n        -- Sunday(1) to Saturday (7)\n        cast({{ dbt_date.date_part(dow_part, date) }} + 1 as {{ dbt.type_int() }})\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.312713, "supported_languages": null}, "macro.dbt_date.redshift__day_of_week": {"name": "redshift__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.redshift__day_of_week", "macro_sql": "\n\n\n{%- macro redshift__day_of_week(date, isoweek) -%}\n\n    {%- set dow = dbt_date.date_part('dayofweek', date) -%}\n\n    {%- if isoweek -%}\n    case\n        -- Shift start of week from Sunday (0) to Monday (1)\n        when {{ dow }} = 0 then 7\n        else cast({{ dow }} as {{ dbt.type_bigint() }})\n    end\n    {%- else -%}\n    cast({{ dow }} + 1 as {{ dbt.type_bigint() }})\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.313081, "supported_languages": null}, "macro.dbt_date.duckdb__day_of_week": {"name": "duckdb__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.duckdb__day_of_week", "macro_sql": "\n\n{%- macro duckdb__day_of_week(date, isoweek) -%}\n{{ return(dbt_date.postgres__day_of_week(date, isoweek)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__day_of_week"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3132548, "supported_languages": null}, "macro.dbt_date.spark__day_of_week": {"name": "spark__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.spark__day_of_week", "macro_sql": "\n\n\n{%- macro spark__day_of_week(date, isoweek) -%}\n\n    {%- set dow = \"dayofweek_iso\" if isoweek else \"dayofweek\" -%}\n\n    {{ dbt_date.date_part(dow, date) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.313471, "supported_languages": null}, "macro.dbt_date.trino__day_of_week": {"name": "trino__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.trino__day_of_week", "macro_sql": "\n\n\n{%- macro trino__day_of_week(date, isoweek) -%}\n\n    {%- set dow = dbt_date.date_part('day_of_week', date) -%}\n\n    {%- if isoweek -%}\n        {{ dow }}\n    {%- else -%}\n        case\n            when {{ dow }} = 7 then 1\n            else {{ dow }} + 1\n        end\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.313758, "supported_languages": null}, "macro.dbt_date.iso_week_end": {"name": "iso_week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "unique_id": "macro.dbt_date.iso_week_end", "macro_sql": "{%- macro iso_week_end(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('iso_week_end', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.snowflake__iso_week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.314214, "supported_languages": null}, "macro.dbt_date._iso_week_end": {"name": "_iso_week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "unique_id": "macro.dbt_date._iso_week_end", "macro_sql": "{%- macro _iso_week_end(date, week_type) -%}\n{%- set dt = dbt_date.iso_week_start(date) -%}\n{{ dbt_date.n_days_away(6, dt) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.iso_week_start", "macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3144279, "supported_languages": null}, "macro.dbt_date.default__iso_week_end": {"name": "default__iso_week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "unique_id": "macro.dbt_date.default__iso_week_end", "macro_sql": "\n\n{%- macro default__iso_week_end(date) -%}\n{{ dbt_date._iso_week_end(date, 'isoweek') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3145669, "supported_languages": null}, "macro.dbt_date.snowflake__iso_week_end": {"name": "snowflake__iso_week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "unique_id": "macro.dbt_date.snowflake__iso_week_end", "macro_sql": "\n\n{%- macro snowflake__iso_week_end(date) -%}\n{{ dbt_date._iso_week_end(date, 'weekiso') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.314708, "supported_languages": null}, "macro.dbt_date.n_weeks_ago": {"name": "n_weeks_ago", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_weeks_ago.sql", "original_file_path": "macros/calendar_date/n_weeks_ago.sql", "unique_id": "macro.dbt_date.n_weeks_ago", "macro_sql": "{%- macro n_weeks_ago(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt.date_trunc('week',\n    dbt.dateadd('week', -1 * n,\n        dbt_date.today(tz)\n        )\n    ) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.315097, "supported_languages": null}, "macro.dbt_date.month_name": {"name": "month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.month_name", "macro_sql": "{%- macro month_name(date, short=True) -%}\n    {{ adapter.dispatch('month_name', 'dbt_date') (date, short) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.snowflake__month_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3157802, "supported_languages": null}, "macro.dbt_date.default__month_name": {"name": "default__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.default__month_name", "macro_sql": "\n\n{%- macro default__month_name(date, short) -%}\n{%- set f = 'MON' if short else 'MONTH' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.315993, "supported_languages": null}, "macro.dbt_date.bigquery__month_name": {"name": "bigquery__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.bigquery__month_name", "macro_sql": "\n\n{%- macro bigquery__month_name(date, short) -%}\n{%- set f = '%b' if short else '%B' -%}\n    format_date('{{ f }}', cast({{ date }} as date))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.316202, "supported_languages": null}, "macro.dbt_date.snowflake__month_name": {"name": "snowflake__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.snowflake__month_name", "macro_sql": "\n\n{%- macro snowflake__month_name(date, short) -%}\n{%- set f = 'MON' if short else 'MMMM' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3164039, "supported_languages": null}, "macro.dbt_date.postgres__month_name": {"name": "postgres__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.postgres__month_name", "macro_sql": "\n\n{%- macro postgres__month_name(date, short) -%}\n{# FM = Fill mode, which suppresses padding blanks #}\n{%- set f = 'FMMon' if short else 'FMMonth' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.316612, "supported_languages": null}, "macro.dbt_date.duckdb__month_name": {"name": "duckdb__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.duckdb__month_name", "macro_sql": "\n\n\n{%- macro duckdb__month_name(date, short) -%}\n    {%- if short -%}\n    substr(monthname({{ date }}), 1, 3)\n    {%- else -%}\n    monthname({{ date }})\n    {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3168042, "supported_languages": null}, "macro.dbt_date.spark__month_name": {"name": "spark__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.spark__month_name", "macro_sql": "\n\n{%- macro spark__month_name(date, short) -%}\n{%- set f = 'LLL' if short else 'LLLL' -%}\n    date_format({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3170052, "supported_languages": null}, "macro.dbt_date.trino__month_name": {"name": "trino__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.trino__month_name", "macro_sql": "\n\n{%- macro trino__month_name(date, short) -%}\n{%- set f = 'b' if short else 'M' -%}\n    date_format({{ date }}, '%{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.317269, "supported_languages": null}, "macro.dbt_date.last_month_name": {"name": "last_month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/last_month_name.sql", "original_file_path": "macros/calendar_date/last_month_name.sql", "unique_id": "macro.dbt_date.last_month_name", "macro_sql": "{%- macro last_month_name(short=True, tz=None) -%}\n{{ dbt_date.month_name(dbt_date.last_month(tz), short=short) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.month_name", "macro.dbt_date.last_month"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.317512, "supported_languages": null}, "macro.dbt_date.week_of_year": {"name": "week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "unique_id": "macro.dbt_date.week_of_year", "macro_sql": "{%- macro week_of_year(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('week_of_year', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3179631, "supported_languages": null}, "macro.dbt_date.default__week_of_year": {"name": "default__week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "unique_id": "macro.dbt_date.default__week_of_year", "macro_sql": "{%- macro default__week_of_year(date) -%}\ncast({{ dbt_date.date_part('week', date) }} as {{ dbt.type_int() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.318153, "supported_languages": null}, "macro.dbt_date.postgres__week_of_year": {"name": "postgres__week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "unique_id": "macro.dbt_date.postgres__week_of_year", "macro_sql": "\n\n{%- macro postgres__week_of_year(date) -%}\n{# postgresql 'week' returns isoweek. Use to_char instead.\n   WW = the first week starts on the first day of the year #}\ncast(to_char({{ date }}, 'WW') as {{ dbt.type_int() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.318306, "supported_languages": null}, "macro.dbt_date.duckdb__week_of_year": {"name": "duckdb__week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "unique_id": "macro.dbt_date.duckdb__week_of_year", "macro_sql": "\n\n{%- macro duckdb__week_of_year(date) -%}\ncast(ceil(dayofyear({{ date }}) / 7) as int)\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.318409, "supported_languages": null}, "macro.dbt_date.convert_timezone": {"name": "convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.convert_timezone", "macro_sql": "{%- macro convert_timezone(column, target_tz=None, source_tz=None) -%}\n{%- set source_tz = \"UTC\" if not source_tz else source_tz -%}\n{%- set target_tz = var(\"dbt_date:time_zone\") if not target_tz else target_tz -%}\n{{ adapter.dispatch('convert_timezone', 'dbt_date') (column, target_tz, source_tz) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.default__convert_timezone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.319679, "supported_languages": null}, "macro.dbt_date.default__convert_timezone": {"name": "default__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.default__convert_timezone", "macro_sql": "{% macro default__convert_timezone(column, target_tz, source_tz) -%}\nconvert_timezone('{{ source_tz }}', '{{ target_tz }}',\n    cast({{ column }} as {{ dbt.type_timestamp() }})\n)\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.319886, "supported_languages": null}, "macro.dbt_date.bigquery__convert_timezone": {"name": "bigquery__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.bigquery__convert_timezone", "macro_sql": "{%- macro bigquery__convert_timezone(column, target_tz, source_tz=None) -%}\ntimestamp(datetime({{ column }}, '{{ target_tz}}'))\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.320043, "supported_languages": null}, "macro.dbt_date.postgres__convert_timezone": {"name": "postgres__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.postgres__convert_timezone", "macro_sql": "{% macro postgres__convert_timezone(column, target_tz, source_tz) -%}\ncast(\n    cast({{ column }} as {{ dbt.type_timestamp() }})\n        at time zone '{{ source_tz }}' at time zone '{{ target_tz }}' as {{ dbt.type_timestamp() }}\n)\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.320298, "supported_languages": null}, "macro.dbt_date.redshift__convert_timezone": {"name": "redshift__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.redshift__convert_timezone", "macro_sql": "{%- macro redshift__convert_timezone(column, target_tz, source_tz) -%}\n{{ return(dbt_date.default__convert_timezone(column, target_tz, source_tz)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.default__convert_timezone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.320488, "supported_languages": null}, "macro.dbt_date.duckdb__convert_timezone": {"name": "duckdb__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.duckdb__convert_timezone", "macro_sql": "{% macro duckdb__convert_timezone(column, target_tz, source_tz) -%}\n{{ return(dbt_date.postgres__convert_timezone(column, target_tz, source_tz)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.postgres__convert_timezone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.320678, "supported_languages": null}, "macro.dbt_date.spark__convert_timezone": {"name": "spark__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.spark__convert_timezone", "macro_sql": "{%- macro spark__convert_timezone(column, target_tz, source_tz) -%}\nfrom_utc_timestamp(\n        to_utc_timestamp({{ column }}, '{{ source_tz }}'),\n        '{{ target_tz }}'\n        )\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.320846, "supported_languages": null}, "macro.dbt_date.trino__convert_timezone": {"name": "trino__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.trino__convert_timezone", "macro_sql": "{%- macro trino__convert_timezone(column, target_tz, source_tz) -%}\n    cast((at_timezone(with_timezone(cast({{ column }} as {{ dbt.type_timestamp() }}), '{{ source_tz }}'), '{{ target_tz }}')) as {{ dbt.type_timestamp() }})\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.321082, "supported_languages": null}, "macro.dbt_date.n_months_away": {"name": "n_months_away", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_months_away.sql", "original_file_path": "macros/calendar_date/n_months_away.sql", "unique_id": "macro.dbt_date.n_months_away", "macro_sql": "{%- macro n_months_away(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt.date_trunc('month',\n    dbt.dateadd('month', n,\n        dbt_date.today(tz)\n        )\n    ) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.321437, "supported_languages": null}, "macro.dbt_date.iso_week_of_year": {"name": "iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.iso_week_of_year", "macro_sql": "{%- macro iso_week_of_year(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('iso_week_of_year', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.snowflake__iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3221672, "supported_languages": null}, "macro.dbt_date._iso_week_of_year": {"name": "_iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date._iso_week_of_year", "macro_sql": "{%- macro _iso_week_of_year(date, week_type) -%}\ncast({{ dbt_date.date_part(week_type, date) }} as {{ dbt.type_int() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.322366, "supported_languages": null}, "macro.dbt_date.default__iso_week_of_year": {"name": "default__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.default__iso_week_of_year", "macro_sql": "\n\n{%- macro default__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'isoweek') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.322509, "supported_languages": null}, "macro.dbt_date.snowflake__iso_week_of_year": {"name": "snowflake__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.snowflake__iso_week_of_year", "macro_sql": "\n\n{%- macro snowflake__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'weekiso') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.322657, "supported_languages": null}, "macro.dbt_date.postgres__iso_week_of_year": {"name": "postgres__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.postgres__iso_week_of_year", "macro_sql": "\n\n{%- macro postgres__iso_week_of_year(date) -%}\n-- postgresql week is isoweek, the first week of a year containing January 4 of that year.\n{{ dbt_date._iso_week_of_year(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.322865, "supported_languages": null}, "macro.dbt_date.duckdb__iso_week_of_year": {"name": "duckdb__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.duckdb__iso_week_of_year", "macro_sql": "\n\n{%- macro duckdb__iso_week_of_year(date) -%}\n{{ return(dbt_date.postgres__iso_week_of_year(date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3230138, "supported_languages": null}, "macro.dbt_date.spark__iso_week_of_year": {"name": "spark__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.spark__iso_week_of_year", "macro_sql": "\n\n{%- macro spark__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.323155, "supported_languages": null}, "macro.dbt_date.trino__iso_week_of_year": {"name": "trino__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.trino__iso_week_of_year", "macro_sql": "\n\n{%- macro trino__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.323297, "supported_languages": null}, "macro.dbt_date.week_end": {"name": "week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.week_end", "macro_sql": "{%- macro week_end(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('week_end', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.snowflake__week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.323806, "supported_languages": null}, "macro.dbt_date.default__week_end": {"name": "default__week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.default__week_end", "macro_sql": "{%- macro default__week_end(date) -%}\n{{ last_day(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3239412, "supported_languages": null}, "macro.dbt_date.snowflake__week_end": {"name": "snowflake__week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.snowflake__week_end", "macro_sql": "\n\n{%- macro snowflake__week_end(date) -%}\n{%- set dt = dbt_date.week_start(date) -%}\n{{ dbt_date.n_days_away(6, dt) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.week_start", "macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3241441, "supported_languages": null}, "macro.dbt_date.postgres__week_end": {"name": "postgres__week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.postgres__week_end", "macro_sql": "\n\n{%- macro postgres__week_end(date) -%}\n{%- set dt = dbt_date.week_start(date) -%}\n{{ dbt_date.n_days_away(6, dt) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.week_start", "macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3243499, "supported_languages": null}, "macro.dbt_date.duckdb__week_end": {"name": "duckdb__week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.duckdb__week_end", "macro_sql": "\n\n{%- macro duckdb__week_end(date) -%}\n{{ return(dbt_date.postgres__week_end(date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.324497, "supported_languages": null}, "macro.dbt_date.next_month_number": {"name": "next_month_number", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/next_month_number.sql", "original_file_path": "macros/calendar_date/next_month_number.sql", "unique_id": "macro.dbt_date.next_month_number", "macro_sql": "{%- macro next_month_number(tz=None) -%}\n{{ dbt_date.date_part('month', dbt_date.next_month(tz)) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_date.next_month"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.324714, "supported_languages": null}, "macro.dbt_date.last_month_number": {"name": "last_month_number", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/last_month_number.sql", "original_file_path": "macros/calendar_date/last_month_number.sql", "unique_id": "macro.dbt_date.last_month_number", "macro_sql": "{%- macro last_month_number(tz=None) -%}\n{{ dbt_date.date_part('month', dbt_date.last_month(tz)) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_date.last_month"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.324929, "supported_languages": null}, "macro.fivetran_utils.enabled_vars": {"name": "enabled_vars", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/enabled_vars.sql", "original_file_path": "macros/enabled_vars.sql", "unique_id": "macro.fivetran_utils.enabled_vars", "macro_sql": "{% macro enabled_vars(vars) %}\n\n{% for v in vars %}\n    \n    {% if var(v, True) == False %}\n    {{ return(False) }}\n    {% endif %}\n\n{% endfor %}\n\n{{ return(True) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3253279, "supported_languages": null}, "macro.fivetran_utils.percentile": {"name": "percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.percentile", "macro_sql": "{% macro percentile(percentile_field, partition_field, percent) -%}\n\n{{ adapter.dispatch('percentile', 'fivetran_utils') (percentile_field, partition_field, percent) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__percentile"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.326276, "supported_languages": null}, "macro.fivetran_utils.default__percentile": {"name": "default__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.default__percentile", "macro_sql": "{% macro default__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile_cont( \n        {{ percent }} )\n        within group ( order by {{ percentile_field }} )\n        over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.326447, "supported_languages": null}, "macro.fivetran_utils.redshift__percentile": {"name": "redshift__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.redshift__percentile", "macro_sql": "{% macro redshift__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile_cont( \n        {{ percent }} )\n        within group ( order by {{ percentile_field }} )\n        over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.326617, "supported_languages": null}, "macro.fivetran_utils.bigquery__percentile": {"name": "bigquery__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.bigquery__percentile", "macro_sql": "{% macro bigquery__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile_cont( \n        {{ percentile_field }}, \n        {{ percent }}) \n        over (partition by {{ partition_field }}    \n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.326782, "supported_languages": null}, "macro.fivetran_utils.postgres__percentile": {"name": "postgres__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.postgres__percentile", "macro_sql": "{% macro postgres__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile_cont( \n        {{ percent }} )\n        within group ( order by {{ percentile_field }} )\n    /* have to group by partition field */\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.326926, "supported_languages": null}, "macro.fivetran_utils.spark__percentile": {"name": "spark__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.spark__percentile", "macro_sql": "{% macro spark__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile( \n        {{ percentile_field }}, \n        {{ percent }}) \n        over (partition by {{ partition_field }}    \n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.327093, "supported_languages": null}, "macro.fivetran_utils.pivot_json_extract": {"name": "pivot_json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/pivot_json_extract.sql", "original_file_path": "macros/pivot_json_extract.sql", "unique_id": "macro.fivetran_utils.pivot_json_extract", "macro_sql": "{% macro pivot_json_extract(string, list_of_properties) %}\n\n{%- for property in list_of_properties -%}\n{%- if property is mapping -%}\nreplace( {{ fivetran_utils.json_extract(string, property.name) }}, '\"', '') as {{ property.alias if property.alias else property.name | replace(' ', '_') | replace('.', '_') | lower }}\n\n{%- else -%}\nreplace( {{ fivetran_utils.json_extract(string, property) }}, '\"', '') as {{ property | replace(' ', '_') | lower }}\n\n{%- endif -%}\n{%- if not loop.last -%},{%- endif %}\n{% endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.json_extract"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.32789, "supported_languages": null}, "macro.fivetran_utils.persist_pass_through_columns": {"name": "persist_pass_through_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/persist_pass_through_columns.sql", "original_file_path": "macros/persist_pass_through_columns.sql", "unique_id": "macro.fivetran_utils.persist_pass_through_columns", "macro_sql": "{% macro persist_pass_through_columns(pass_through_variable, identifier=none, transform='') %}\n\n{% if var(pass_through_variable, none) %}\n    {% for field in var(pass_through_variable) %}\n        , {{ transform ~ '(' ~ (identifier ~ '.' if identifier else '') ~ (field.alias if field.alias else field.name) ~ ')' }} as {{ field.alias if field.alias else field.name }}\n    {% endfor %}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.328602, "supported_languages": null}, "macro.fivetran_utils.json_parse": {"name": "json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.json_parse", "macro_sql": "{% macro json_parse(string, string_path) -%}\n\n{{ adapter.dispatch('json_parse', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.snowflake__json_parse"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.329955, "supported_languages": null}, "macro.fivetran_utils.default__json_parse": {"name": "default__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.default__json_parse", "macro_sql": "{% macro default__json_parse(string, string_path) %}\n\n  json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3302112, "supported_languages": null}, "macro.fivetran_utils.redshift__json_parse": {"name": "redshift__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.redshift__json_parse", "macro_sql": "{% macro redshift__json_parse(string, string_path) %}\n\n  json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3304598, "supported_languages": null}, "macro.fivetran_utils.bigquery__json_parse": {"name": "bigquery__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.bigquery__json_parse", "macro_sql": "{% macro bigquery__json_parse(string, string_path) %}\n\n \n  json_extract_scalar({{string}}, '$.{%- for s in string_path -%}{{ s }}{%- if not loop.last -%}.{%- endif -%}{%- endfor -%} ')\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.330705, "supported_languages": null}, "macro.fivetran_utils.postgres__json_parse": {"name": "postgres__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.postgres__json_parse", "macro_sql": "{% macro postgres__json_parse(string, string_path) %}\n\n  {{string}}::json #>> '{ {%- for s in string_path -%}{{ s }}{%- if not loop.last -%},{%- endif -%}{%- endfor -%} }'\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.330946, "supported_languages": null}, "macro.fivetran_utils.snowflake__json_parse": {"name": "snowflake__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.snowflake__json_parse", "macro_sql": "{% macro snowflake__json_parse(string, string_path) %}\n\n  parse_json( {{string}} ) {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.331213, "supported_languages": null}, "macro.fivetran_utils.spark__json_parse": {"name": "spark__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.spark__json_parse", "macro_sql": "{% macro spark__json_parse(string, string_path) %}\n\n  {{string}} : {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3314838, "supported_languages": null}, "macro.fivetran_utils.sqlserver__json_parse": {"name": "sqlserver__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.sqlserver__json_parse", "macro_sql": "{% macro sqlserver__json_parse(string, string_path) %}\n\n  json_value({{string}}, '$.{%- for s in string_path -%}{{ s }}{%- if not loop.last -%}.{%- endif -%}{%- endfor -%} ')\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.33173, "supported_languages": null}, "macro.fivetran_utils.max_bool": {"name": "max_bool", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "unique_id": "macro.fivetran_utils.max_bool", "macro_sql": "{% macro max_bool(boolean_field) -%}\n\n{{ adapter.dispatch('max_bool', 'fivetran_utils') (boolean_field) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.snowflake__max_bool"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.332053, "supported_languages": null}, "macro.fivetran_utils.default__max_bool": {"name": "default__max_bool", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "unique_id": "macro.fivetran_utils.default__max_bool", "macro_sql": "{% macro default__max_bool(boolean_field)  %}\n\n    bool_or( {{ boolean_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.332157, "supported_languages": null}, "macro.fivetran_utils.snowflake__max_bool": {"name": "snowflake__max_bool", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "unique_id": "macro.fivetran_utils.snowflake__max_bool", "macro_sql": "{% macro snowflake__max_bool(boolean_field)  %}\n\n    max( {{ boolean_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3322592, "supported_languages": null}, "macro.fivetran_utils.bigquery__max_bool": {"name": "bigquery__max_bool", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "unique_id": "macro.fivetran_utils.bigquery__max_bool", "macro_sql": "{% macro bigquery__max_bool(boolean_field)  %}\n\n    max( {{ boolean_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.332363, "supported_languages": null}, "macro.fivetran_utils.calculated_fields": {"name": "calculated_fields", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/calculated_fields.sql", "original_file_path": "macros/calculated_fields.sql", "unique_id": "macro.fivetran_utils.calculated_fields", "macro_sql": "{% macro calculated_fields(variable) -%}\n\n{% if var(variable, none) %}\n    {% for field in var(variable) %}\n        , {{ field.transform_sql }} as {{ field.name }} \n    {% endfor %}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.332733, "supported_languages": null}, "macro.fivetran_utils.drop_schemas_automation": {"name": "drop_schemas_automation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/drop_schemas_automation.sql", "original_file_path": "macros/drop_schemas_automation.sql", "unique_id": "macro.fivetran_utils.drop_schemas_automation", "macro_sql": "{% macro drop_schemas_automation(drop_target_schema=true) %}\n    {{ return(adapter.dispatch('drop_schemas_automation', 'fivetran_utils')(drop_target_schema)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__drop_schemas_automation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.333424, "supported_languages": null}, "macro.fivetran_utils.default__drop_schemas_automation": {"name": "default__drop_schemas_automation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/drop_schemas_automation.sql", "original_file_path": "macros/drop_schemas_automation.sql", "unique_id": "macro.fivetran_utils.default__drop_schemas_automation", "macro_sql": "{% macro default__drop_schemas_automation(drop_target_schema=true) %}\n\n{% set fetch_list_sql %}\n    {% if target.type not in ('databricks', 'spark') %}\n        select schema_name\n        from \n        {{ wrap_in_quotes(target.database) }}.INFORMATION_SCHEMA.SCHEMATA\n        where lower(schema_name) like '{{ target.schema | lower }}{%- if not drop_target_schema -%}_{%- endif -%}%'\n    {% else %}\n        SHOW SCHEMAS LIKE '{{ target.schema }}{%- if not drop_target_schema -%}_{%- endif -%}*'\n    {% endif %}\n{% endset %}\n\n{% set results = run_query(fetch_list_sql) %}\n\n{% if execute %}\n    {% set results_list = results.columns[0].values() %}\n{% else %}\n    {% set results_list = [] %}\n{% endif %}\n\n{% for schema_to_drop in results_list %}\n    {% do adapter.drop_schema(api.Relation.create(database=target.database, schema=schema_to_drop)) %}\n    {{ print('Schema ' ~ schema_to_drop ~ ' successfully dropped from the ' ~ target.database ~ ' database.\\n')}}\n{% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.wrap_in_quotes", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3345191, "supported_languages": null}, "macro.fivetran_utils.seed_data_helper": {"name": "seed_data_helper", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/seed_data_helper.sql", "original_file_path": "macros/seed_data_helper.sql", "unique_id": "macro.fivetran_utils.seed_data_helper", "macro_sql": "{% macro seed_data_helper(seed_name, warehouses) %}\n\n{% if target.type in warehouses %}\n    {% for w in warehouses %}\n        {% if target.type == w %}\n            {{ return(ref(seed_name ~ \"_\" ~ w ~ \"\")) }}\n        {% endif %}\n    {% endfor %}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.335111, "supported_languages": null}, "macro.fivetran_utils.fill_pass_through_columns": {"name": "fill_pass_through_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fill_pass_through_columns.sql", "original_file_path": "macros/fill_pass_through_columns.sql", "unique_id": "macro.fivetran_utils.fill_pass_through_columns", "macro_sql": "{% macro fill_pass_through_columns(pass_through_variable) %}\n\n{% if var(pass_through_variable) %}\n    {% for field in var(pass_through_variable) %}\n        {% if field is mapping %}\n            {% if field.transform_sql %}\n                , {{ field.transform_sql }} as {{ field.alias if field.alias else field.name }}\n            {% else %}\n                , {{ field.alias if field.alias else field.name }}\n            {% endif %}\n        {% else %}\n        , {{ field }}\n        {% endif %}\n    {% endfor %}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.335912, "supported_languages": null}, "macro.fivetran_utils.string_agg": {"name": "string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.string_agg", "macro_sql": "{% macro string_agg(field_to_agg, delimiter) -%}\n\n{{ adapter.dispatch('string_agg', 'fivetran_utils') (field_to_agg, delimiter) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.snowflake__string_agg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.336389, "supported_languages": null}, "macro.fivetran_utils.default__string_agg": {"name": "default__string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.default__string_agg", "macro_sql": "{% macro default__string_agg(field_to_agg, delimiter) %}\n    string_agg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.336527, "supported_languages": null}, "macro.fivetran_utils.snowflake__string_agg": {"name": "snowflake__string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.snowflake__string_agg", "macro_sql": "{% macro snowflake__string_agg(field_to_agg, delimiter) %}\n    listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3366568, "supported_languages": null}, "macro.fivetran_utils.redshift__string_agg": {"name": "redshift__string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.redshift__string_agg", "macro_sql": "{% macro redshift__string_agg(field_to_agg, delimiter) %}\n    listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.33679, "supported_languages": null}, "macro.fivetran_utils.spark__string_agg": {"name": "spark__string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.spark__string_agg", "macro_sql": "{% macro spark__string_agg(field_to_agg, delimiter) %}\n    -- collect set will remove duplicates\n    replace(replace(replace(cast( collect_set({{ field_to_agg }}) as string), '[', ''), ']', ''), ', ', {{ delimiter }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.336929, "supported_languages": null}, "macro.fivetran_utils.timestamp_diff": {"name": "timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.timestamp_diff", "macro_sql": "{% macro timestamp_diff(first_date, second_date, datepart) %}\n  {{ adapter.dispatch('timestamp_diff', 'fivetran_utils')(first_date, second_date, datepart) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__timestamp_diff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.339944, "supported_languages": null}, "macro.fivetran_utils.default__timestamp_diff": {"name": "default__timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.default__timestamp_diff", "macro_sql": "{% macro default__timestamp_diff(first_date, second_date, datepart) %}\n\n    datediff(\n        {{ datepart }},\n        {{ first_date }},\n        {{ second_date }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3401139, "supported_languages": null}, "macro.fivetran_utils.redshift__timestamp_diff": {"name": "redshift__timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.redshift__timestamp_diff", "macro_sql": "{% macro redshift__timestamp_diff(first_date, second_date, datepart) %}\n\n    datediff(\n        {{ datepart }},\n        {{ first_date }},\n        {{ second_date }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3402822, "supported_languages": null}, "macro.fivetran_utils.bigquery__timestamp_diff": {"name": "bigquery__timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.bigquery__timestamp_diff", "macro_sql": "{% macro bigquery__timestamp_diff(first_date, second_date, datepart) %}\n\n    timestamp_diff(\n        {{second_date}},\n        {{first_date}},\n        {{datepart}}\n    )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3404422, "supported_languages": null}, "macro.fivetran_utils.postgres__timestamp_diff": {"name": "postgres__timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.postgres__timestamp_diff", "macro_sql": "{% macro postgres__timestamp_diff(first_date, second_date, datepart) %}\n\n    {% if datepart == 'year' %}\n        (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n    {% elif datepart == 'quarter' %}\n        ({{ dbt.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n    {% elif datepart == 'month' %}\n        ({{ dbt.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n    {% elif datepart == 'day' %}\n        (({{second_date}})::date - ({{first_date}})::date)\n    {% elif datepart == 'week' %}\n        ({{ dbt.datediff(first_date, second_date, 'day') }} / 7 + case\n            when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n                case when {{first_date}} <= {{second_date}} then 0 else -1 end\n            else\n                case when {{first_date}} <= {{second_date}} then 1 else 0 end\n        end)\n    {% elif datepart == 'hour' %}\n        ({{ dbt.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n    {% elif datepart == 'minute' %}\n        ({{ dbt.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n    {% elif datepart == 'second' %}\n        ({{ dbt.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n    {% elif datepart == 'millisecond' %}\n        ({{ dbt.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n    {% elif datepart == 'microsecond' %}\n        ({{ dbt.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n    {% else %}\n        {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3422348, "supported_languages": null}, "macro.fivetran_utils.try_cast": {"name": "try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.try_cast", "macro_sql": "{% macro try_cast(field, type) %}\n    {{ adapter.dispatch('try_cast', 'fivetran_utils') (field, type) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.snowflake__try_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.343193, "supported_languages": null}, "macro.fivetran_utils.default__try_cast": {"name": "default__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.default__try_cast", "macro_sql": "{% macro default__try_cast(field, type) %}\n    {# most databases don't support this function yet\n    so we just need to use cast #}\n    cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.343333, "supported_languages": null}, "macro.fivetran_utils.redshift__try_cast": {"name": "redshift__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.redshift__try_cast", "macro_sql": "{% macro redshift__try_cast(field, type) %}\n{%- if type == 'numeric' -%}\n\n    case\n        when trim({{field}}) ~ '^(0|[1-9][0-9]*)$' then trim({{field}})\n        else null\n    end::{{type}}\n\n{% else %}\n    {{ exceptions.raise_compiler_error(\n            \"non-numeric datatypes are not currently supported\") }}\n\n{% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.343612, "supported_languages": null}, "macro.fivetran_utils.postgres__try_cast": {"name": "postgres__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.postgres__try_cast", "macro_sql": "{% macro postgres__try_cast(field, type) %}\n{%- if type == 'numeric' -%}\n\n    case\n        when replace(cast({{field}} as varchar),cast(' ' as varchar),cast('' as varchar)) ~ '^(0|[1-9][0-9]*)$' \n        then replace(cast({{field}} as varchar),cast(' ' as varchar),cast('' as varchar))\n        else null\n    end::{{type}}\n\n{% else %}\n    {{ exceptions.raise_compiler_error(\n            \"non-numeric datatypes are not currently supported\") }}\n\n{% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3439062, "supported_languages": null}, "macro.fivetran_utils.snowflake__try_cast": {"name": "snowflake__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.snowflake__try_cast", "macro_sql": "{% macro snowflake__try_cast(field, type) %}\n    try_cast(cast({{field}} as varchar) as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3440378, "supported_languages": null}, "macro.fivetran_utils.bigquery__try_cast": {"name": "bigquery__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.bigquery__try_cast", "macro_sql": "{% macro bigquery__try_cast(field, type) %}\n    safe_cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.344165, "supported_languages": null}, "macro.fivetran_utils.spark__try_cast": {"name": "spark__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.spark__try_cast", "macro_sql": "{% macro spark__try_cast(field, type) %}\n    try_cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.344296, "supported_languages": null}, "macro.fivetran_utils.sqlserver__try_cast": {"name": "sqlserver__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.sqlserver__try_cast", "macro_sql": "{% macro sqlserver__try_cast(field, type) %}\n    try_cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.344425, "supported_languages": null}, "macro.fivetran_utils.source_relation": {"name": "source_relation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "unique_id": "macro.fivetran_utils.source_relation", "macro_sql": "{% macro source_relation(union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('source_relation', 'fivetran_utils') (union_schema_variable, union_database_variable) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__source_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.344915, "supported_languages": null}, "macro.fivetran_utils.default__source_relation": {"name": "default__source_relation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "unique_id": "macro.fivetran_utils.default__source_relation", "macro_sql": "{% macro default__source_relation(union_schema_variable, union_database_variable) %}\n\n{% if var(union_schema_variable, none)  %}\n, case\n    {% for schema in var(union_schema_variable) %}\n    when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%.{{ schema|lower }}.%' then '{{ schema|lower }}'\n    {% endfor %}\n  end as source_relation\n{% elif var(union_database_variable, none) %}\n, case\n    {% for database in var(union_database_variable) %}\n    when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%{{ database|lower }}.%' then '{{ database|lower }}'\n    {% endfor %}\n  end as source_relation\n{% else %}\n, cast('' as {{ dbt.type_string() }}) as source_relation\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3455, "supported_languages": null}, "macro.fivetran_utils.first_value": {"name": "first_value", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "unique_id": "macro.fivetran_utils.first_value", "macro_sql": "{% macro first_value(first_value_field, partition_field, order_by_field, order=\"asc\") -%}\n\n{{ adapter.dispatch('first_value', 'fivetran_utils') (first_value_field, partition_field, order_by_field, order) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__first_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.346, "supported_languages": null}, "macro.fivetran_utils.default__first_value": {"name": "default__first_value", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "unique_id": "macro.fivetran_utils.default__first_value", "macro_sql": "{% macro default__first_value(first_value_field, partition_field, order_by_field, order=\"asc\")  %}\n\n    first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.346205, "supported_languages": null}, "macro.fivetran_utils.redshift__first_value": {"name": "redshift__first_value", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "unique_id": "macro.fivetran_utils.redshift__first_value", "macro_sql": "{% macro redshift__first_value(first_value_field, partition_field, order_by_field, order=\"asc\") %}\n\n    first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} , {{ partition_field }} rows unbounded preceding )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.34643, "supported_languages": null}, "macro.fivetran_utils.add_dbt_source_relation": {"name": "add_dbt_source_relation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/add_dbt_source_relation.sql", "original_file_path": "macros/add_dbt_source_relation.sql", "unique_id": "macro.fivetran_utils.add_dbt_source_relation", "macro_sql": "{% macro add_dbt_source_relation() %}\n\n{% if var('union_schemas', none) or var('union_databases', none) %}\n, _dbt_source_relation\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.346687, "supported_languages": null}, "macro.fivetran_utils.add_pass_through_columns": {"name": "add_pass_through_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/add_pass_through_columns.sql", "original_file_path": "macros/add_pass_through_columns.sql", "unique_id": "macro.fivetran_utils.add_pass_through_columns", "macro_sql": "{% macro add_pass_through_columns(base_columns, pass_through_var) %}\n\n  {% if pass_through_var %}\n\n    {% for column in pass_through_var %}\n\n    {% if column is mapping %}\n\n      {% if column.alias %}\n\n        {% do base_columns.append({ \"name\": column.name, \"alias\": column.alias, \"datatype\": column.datatype if column.datatype else dbt.type_string()}) %}\n\n      {% else %}\n\n        {% do base_columns.append({ \"name\": column.name, \"datatype\": column.datatype if column.datatype else dbt.type_string()}) %}\n        \n      {% endif %}\n\n    {% else %}\n\n      {% do base_columns.append({ \"name\": column, \"datatype\": dbt.type_string()}) %}\n\n    {% endif %}\n\n    {% endfor %}\n\n  {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.347858, "supported_languages": null}, "macro.fivetran_utils.union_relations": {"name": "union_relations", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "unique_id": "macro.fivetran_utils.union_relations", "macro_sql": "{%- macro union_relations(relations, aliases=none, column_override=none, include=[], exclude=[], source_column_name=none) -%}\n\n    {%- if exclude and include -%}\n        {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n    {%- endif -%}\n\n    {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n    {%- if not execute %}\n        {{ return('') }}\n    {% endif -%}\n\n    {%- set column_override = column_override if column_override is not none else {} -%}\n    {%- set source_column_name = source_column_name if source_column_name is not none else '_dbt_source_relation' -%}\n\n    {%- set relation_columns = {} -%}\n    {%- set column_superset = {} -%}\n\n    {%- for relation in relations -%}\n\n        {%- do relation_columns.update({relation: []}) -%}\n\n        {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n        {%- set cols = adapter.get_columns_in_relation(relation) -%}\n        {%- for col in cols -%}\n\n        {#- If an exclude list was provided and the column is in the list, do nothing -#}\n        {%- if exclude and col.column in exclude -%}\n\n        {#- If an include list was provided and the column is not in the list, do nothing -#}\n        {%- elif include and col.column not in include -%}\n\n        {#- Otherwise add the column to the column superset -#}\n        {%- else -%}\n\n            {#- update the list of columns in this relation -#}\n            {%- do relation_columns[relation].append(col.column) -%}\n\n            {%- if col.column in column_superset -%}\n\n                {%- set stored = column_superset[col.column] -%}\n                {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n                    {%- do column_superset.update({col.column: col}) -%}\n\n                {%- endif %}\n\n            {%- else -%}\n\n                {%- do column_superset.update({col.column: col}) -%}\n\n            {%- endif -%}\n\n        {%- endif -%}\n\n        {%- endfor -%}\n    {%- endfor -%}\n\n    {%- set ordered_column_names = column_superset.keys() -%}\n\n    {%- for relation in relations %}\n\n        (\n            select\n\n                cast({{ dbt.string_literal(relation) }} as {{ dbt.type_string() }}) as {{ source_column_name }},\n                {% for col_name in ordered_column_names -%}\n\n                    {%- set col = column_superset[col_name] %}\n                    {%- set col_type = column_override.get(col.column, col.data_type) %}\n                    {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n                    cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n                {%- endfor %}\n\n            from {{ aliases[loop.index0] if aliases else relation }}\n        )\n\n        {% if not loop.last -%}\n            union all\n        {% endif -%}\n\n    {%- endfor -%}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt.string_literal", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.351892, "supported_languages": null}, "macro.fivetran_utils.union_tables": {"name": "union_tables", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "unique_id": "macro.fivetran_utils.union_tables", "macro_sql": "{%- macro union_tables(tables, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_table') -%}\n\n    {%- do exceptions.warn(\"Warning: the `union_tables` macro is no longer supported and will be deprecated in a future release of dbt-utils. Use the `union_relations` macro instead\") -%}\n\n    {{ return(dbt_utils.union_relations(tables, column_override, include, exclude, source_column_name)) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_utils.union_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.352268, "supported_languages": null}, "macro.fivetran_utils.snowflake_seed_data": {"name": "snowflake_seed_data", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/snowflake_seed_data.sql", "original_file_path": "macros/snowflake_seed_data.sql", "unique_id": "macro.fivetran_utils.snowflake_seed_data", "macro_sql": "{% macro snowflake_seed_data(seed_name) %}\n\n{% if target.type == 'snowflake' %}\n{{ return(ref(seed_name ~ '_snowflake')) }}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.352649, "supported_languages": null}, "macro.fivetran_utils.fill_staging_columns": {"name": "fill_staging_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "unique_id": "macro.fivetran_utils.fill_staging_columns", "macro_sql": "{% macro fill_staging_columns(source_columns, staging_columns) -%}\n\n{%- set source_column_names = source_columns|map(attribute='name')|map('lower')|list -%}\n\n{%- for column in staging_columns %}\n    {% if column.name|lower in source_column_names -%}\n        {{ fivetran_utils.quote_column(column) }} as \n        {%- if 'alias' in column %} {{ column.alias }} {% else %} {{ fivetran_utils.quote_column(column) }} {%- endif -%}\n    {%- else -%}\n        cast(null as {{ column.datatype }})\n        {%- if 'alias' in column %} as {{ column.alias }} {% else %} as {{ fivetran_utils.quote_column(column) }} {% endif -%}\n    {%- endif -%}\n    {%- if not loop.last -%} , {% endif -%}\n{% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.quote_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.354248, "supported_languages": null}, "macro.fivetran_utils.quote_column": {"name": "quote_column", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "unique_id": "macro.fivetran_utils.quote_column", "macro_sql": "{% macro quote_column(column) %}\n    {% if 'quote' in column %}\n        {% if column.quote %}\n            {% if target.type in ('bigquery', 'spark', 'databricks') %}\n            `{{ column.name }}`\n            {% elif target.type == 'snowflake' %}\n            \"{{ column.name | upper }}\"\n            {% else %}\n            \"{{ column.name }}\"\n            {% endif %}\n        {% else %}\n        {{ column.name }}\n        {% endif %}\n    {% else %}\n    {{ column.name }}\n    {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.354826, "supported_languages": null}, "macro.fivetran_utils.json_extract": {"name": "json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.json_extract", "macro_sql": "{% macro json_extract(string, string_path) -%}\n\n{{ adapter.dispatch('json_extract', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.snowflake__json_extract"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.355405, "supported_languages": null}, "macro.fivetran_utils.default__json_extract": {"name": "default__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.default__json_extract", "macro_sql": "{% macro default__json_extract(string, string_path) %}\n\n  json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} )\n \n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.355562, "supported_languages": null}, "macro.fivetran_utils.snowflake__json_extract": {"name": "snowflake__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.snowflake__json_extract", "macro_sql": "{% macro snowflake__json_extract(string, string_path) %}\n\n  json_extract_path_text(try_parse_json( {{string}} ), {{ \"'\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3557189, "supported_languages": null}, "macro.fivetran_utils.redshift__json_extract": {"name": "redshift__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.redshift__json_extract", "macro_sql": "{% macro redshift__json_extract(string, string_path) %}\n\n  case when is_valid_json( {{string}} ) then json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} ) else null end\n \n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.355893, "supported_languages": null}, "macro.fivetran_utils.bigquery__json_extract": {"name": "bigquery__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.bigquery__json_extract", "macro_sql": "{% macro bigquery__json_extract(string, string_path) %}\n\n  json_extract_scalar({{string}}, {{ \"'$.\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.356043, "supported_languages": null}, "macro.fivetran_utils.postgres__json_extract": {"name": "postgres__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.postgres__json_extract", "macro_sql": "{% macro postgres__json_extract(string, string_path) %}\n\n  {{string}}::json->>{{\"'\" ~ string_path ~ \"'\" }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.356197, "supported_languages": null}, "macro.fivetran_utils.collect_freshness": {"name": "collect_freshness", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "unique_id": "macro.fivetran_utils.collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n  {{ return(adapter.dispatch('collect_freshness')(source, loaded_at_field, filter))}}\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3570318, "supported_languages": null}, "macro.fivetran_utils.default__collect_freshness": {"name": "default__collect_freshness", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "unique_id": "macro.fivetran_utils.default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n  {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n\n  {%- set enabled_array = [] -%}\n  {% for node in graph.sources.values() %}\n    {% if node.identifier == source.identifier %}\n      {% if (node.meta['is_enabled'] | default(true)) %}\n        {%- do enabled_array.append(1) -%}\n      {% endif %}\n    {% endif %}\n  {% endfor %}\n  {% set is_enabled = (enabled_array != []) %}\n\n    select\n      {% if is_enabled %}\n      max({{ loaded_at_field }})\n      {% else %} \n      {{ current_timestamp() }} {% endif %} as max_loaded_at,\n      {{ current_timestamp() }} as snapshotted_at\n\n    {% if is_enabled %}\n    from {{ source }}\n      {% if filter %}\n      where {{ filter }}\n      {% endif %}\n    {% endif %}\n\n  {% endcall %}\n\n  {% if dbt_version.split('.') | map('int') | list >= [1, 5, 0]  %}\n    {{ return(load_result('collect_freshness')) }}\n  {% else %}\n    {{ return(load_result('collect_freshness').table) }}\n  {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.358316, "supported_languages": null}, "macro.fivetran_utils.timestamp_add": {"name": "timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.timestamp_add", "macro_sql": "{% macro timestamp_add(datepart, interval, from_timestamp) -%}\n\n{{ adapter.dispatch('timestamp_add', 'fivetran_utils') (datepart, interval, from_timestamp) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__timestamp_add"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.359031, "supported_languages": null}, "macro.fivetran_utils.default__timestamp_add": {"name": "default__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.default__timestamp_add", "macro_sql": "{% macro default__timestamp_add(datepart, interval, from_timestamp) %}\n\n    timestampadd(\n        {{ datepart }},\n        {{ interval }},\n        {{ from_timestamp }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3592021, "supported_languages": null}, "macro.fivetran_utils.bigquery__timestamp_add": {"name": "bigquery__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.bigquery__timestamp_add", "macro_sql": "{% macro bigquery__timestamp_add(datepart, interval, from_timestamp) %}\n\n        timestamp_add({{ from_timestamp }}, interval  {{ interval }} {{ datepart }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.359367, "supported_languages": null}, "macro.fivetran_utils.redshift__timestamp_add": {"name": "redshift__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.redshift__timestamp_add", "macro_sql": "{% macro redshift__timestamp_add(datepart, interval, from_timestamp) %}\n\n        dateadd(\n        {{ datepart }},\n        {{ interval }},\n        {{ from_timestamp }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.35953, "supported_languages": null}, "macro.fivetran_utils.postgres__timestamp_add": {"name": "postgres__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.postgres__timestamp_add", "macro_sql": "{% macro postgres__timestamp_add(datepart, interval, from_timestamp) %}\n\n    {{ from_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.359692, "supported_languages": null}, "macro.fivetran_utils.spark__timestamp_add": {"name": "spark__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.spark__timestamp_add", "macro_sql": "{% macro spark__timestamp_add(datepart, interval, from_timestamp) %}\n\n    {{ dbt.dateadd(datepart, interval, from_timestamp) }}\n        \n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3598678, "supported_languages": null}, "macro.fivetran_utils.ceiling": {"name": "ceiling", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "unique_id": "macro.fivetran_utils.ceiling", "macro_sql": "{% macro ceiling(num) -%}\n\n{{ adapter.dispatch('ceiling', 'fivetran_utils') (num) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.snowflake__ceiling"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.36012, "supported_languages": null}, "macro.fivetran_utils.default__ceiling": {"name": "default__ceiling", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "unique_id": "macro.fivetran_utils.default__ceiling", "macro_sql": "{% macro default__ceiling(num) %}\n    ceiling({{ num }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3602262, "supported_languages": null}, "macro.fivetran_utils.snowflake__ceiling": {"name": "snowflake__ceiling", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "unique_id": "macro.fivetran_utils.snowflake__ceiling", "macro_sql": "{% macro snowflake__ceiling(num) %}\n    ceil({{ num }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.360331, "supported_languages": null}, "macro.fivetran_utils.remove_prefix_from_columns": {"name": "remove_prefix_from_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/remove_prefix_from_columns.sql", "original_file_path": "macros/remove_prefix_from_columns.sql", "unique_id": "macro.fivetran_utils.remove_prefix_from_columns", "macro_sql": "{% macro remove_prefix_from_columns(columns, prefix='', exclude=[]) %}\n\n        {%- for col in columns if col.name not in exclude -%}\n        {%- if col.name[:prefix|length]|lower == prefix -%}\n        {{ col.name }} as {{ col.name[prefix|length:] }}\n        {%- else -%}\n        {{ col.name }}\n        {%- endif -%}\n        {%- if not loop.last -%},{%- endif %}\n        {% endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.360967, "supported_languages": null}, "macro.fivetran_utils.fivetran_date_spine": {"name": "fivetran_date_spine", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fivetran_date_spine.sql", "original_file_path": "macros/fivetran_date_spine.sql", "unique_id": "macro.fivetran_utils.fivetran_date_spine", "macro_sql": "{% macro fivetran_date_spine(datepart, start_date, end_date) -%}\n\n{{ return(adapter.dispatch('fivetran_date_spine', 'fivetran_utils') (datepart, start_date, end_date)) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__fivetran_date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3623428, "supported_languages": null}, "macro.fivetran_utils.default__fivetran_date_spine": {"name": "default__fivetran_date_spine", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fivetran_date_spine.sql", "original_file_path": "macros/fivetran_date_spine.sql", "unique_id": "macro.fivetran_utils.default__fivetran_date_spine", "macro_sql": "{% macro default__fivetran_date_spine(datepart, start_date, end_date) %}\n\n    {{ dbt_utils.date_spine(datepart, start_date, end_date) }}\n        \n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3625238, "supported_languages": null}, "macro.fivetran_utils.sqlserver__fivetran_date_spine": {"name": "sqlserver__fivetran_date_spine", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fivetran_date_spine.sql", "original_file_path": "macros/fivetran_date_spine.sql", "unique_id": "macro.fivetran_utils.sqlserver__fivetran_date_spine", "macro_sql": "{% macro sqlserver__fivetran_date_spine(datepart, start_date, end_date) -%}\n\n    {% set date_spine_query %}\n        with\n\n        l0 as (\n\n            select c\n            from (select 1 union all select 1) as d(c)\n\n        ),\n        l1 as (\n\n            select\n                1 as c\n            from l0 as a\n            cross join l0 as b\n\n        ),\n\n        l2 as (\n\n            select 1 as c\n            from l1 as a\n            cross join l1 as b\n        ),\n\n        l3 as (\n\n            select 1 as c\n            from l2 as a\n            cross join l2 as b\n        ),\n\n        l4 as (\n\n            select 1 as c\n            from l3 as a\n            cross join l3 as b\n        ),\n\n        l5 as (\n\n            select 1 as c\n            from l4 as a\n            cross join l4 as b\n        ),\n\n        nums as (\n\n            select row_number() over (order by (select null)) as rownum\n            from l5\n        ),\n\n        rawdata as (\n\n            select top ({{dbt.datediff(start_date, end_date, datepart)}}) rownum -1 as n\n            from nums\n            order by rownum\n        ),\n\n        all_periods as (\n\n            select (\n                {{\n                    dbt.dateadd(\n                        datepart,\n                        'n',\n                        start_date\n                    )\n                }}\n            ) as date_{{datepart}}\n            from rawdata\n        ),\n\n        filtered as (\n\n            select *\n            from all_periods\n            where date_{{datepart}} <= {{ end_date }}\n\n        )\n\n        select * from filtered\n        order by 1\n\n    {% endset %}\n\n    {% set results = run_query(date_spine_query) %}\n\n    {% if execute %}\n\n        {% set results_list = results.columns[0].values() %}\n    \n    {% else %}\n\n        {% set results_list = [] %}\n\n    {% endif %}\n\n    {%- for date_field in results_list %}\n        select cast('{{ date_field }}' as date) as date_{{datepart}} {{ 'union all ' if not loop.last else '' }}\n    {% endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt.dateadd", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.363373, "supported_languages": null}, "macro.fivetran_utils.union_data": {"name": "union_data", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "unique_id": "macro.fivetran_utils.union_data", "macro_sql": "{%- macro union_data(table_identifier, database_variable, schema_variable, default_database, default_schema, default_variable, union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('union_data', 'fivetran_utils') (\n    table_identifier, \n    database_variable, \n    schema_variable, \n    default_database, \n    default_schema, \n    default_variable,\n    union_schema_variable,\n    union_database_variable\n    ) }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.fivetran_utils.default__union_data"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.366953, "supported_languages": null}, "macro.fivetran_utils.default__union_data": {"name": "default__union_data", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "unique_id": "macro.fivetran_utils.default__union_data", "macro_sql": "{%- macro default__union_data(\n    table_identifier, \n    database_variable, \n    schema_variable, \n    default_database, \n    default_schema, \n    default_variable,\n    union_schema_variable,\n    union_database_variable\n    ) -%}\n\n{%- if var(union_schema_variable, none) -%}\n\n    {%- set relations = [] -%}\n    \n    {%- if var(union_schema_variable) is string -%}\n    {%- set trimmed = var(union_schema_variable)|trim('[')|trim(']') -%}\n    {%- set schemas = trimmed.split(',')|map('trim',\" \")|map('trim','\"')|map('trim',\"'\") -%}\n    {%- else -%}\n    {%- set schemas = var(union_schema_variable) -%}\n    {%- endif -%}\n\n    {%- for schema in var(union_schema_variable) -%}\n    {%- set relation=adapter.get_relation(\n        database=source(schema, table_identifier).database if var('has_defined_sources', false) else var(database_variable, default_database),\n        schema=source(schema, table_identifier).schema if var('has_defined_sources', false) else schema,\n        identifier=source(schema, table_identifier).identifier if var('has_defined_sources', false) else table_identifier\n    ) -%}\n    \n    {%- set relation_exists=relation is not none -%}\n\n    {%- if relation_exists -%}\n        {%- do relations.append(relation) -%}\n    {%- endif -%}\n\n    {%- endfor -%}\n    \n    {%- if relations != [] -%}\n        {{ dbt_utils.union_relations(relations) }}\n    {%- else -%}\n    {% if execute and not var('fivetran__remove_empty_table_warnings', false) -%}\n    {{ exceptions.warn(\"\\n\\nPlease be aware: The \" ~ table_identifier|upper ~ \" table was not found in your \" ~ default_schema|upper ~ \" schema(s). The Fivetran dbt package will create a completely empty \" ~ table_identifier|upper ~ \" staging model as to not break downstream transformations. To turn off these warnings, set the `fivetran__remove_empty_table_warnings` variable to TRUE (see https://github.com/fivetran/dbt_fivetran_utils/tree/releases/v0.4.latest#union_data-source for details).\\n\") }}\n    {% endif -%}\n    select \n        cast(null as {{ dbt.type_string() }}) as _dbt_source_relation\n    limit 0\n    {%- endif -%}\n\n{%- elif var(union_database_variable, none) -%}\n\n    {%- set relations = [] -%}\n\n    {%- for database in var(union_database_variable) -%}\n    {%- set relation=adapter.get_relation(\n        database=source(schema, table_identifier).database if var('has_defined_sources', false) else database,\n        schema=source(schema, table_identifier).schema if var('has_defined_sources', false) else var(schema_variable, default_schema),\n        identifier=source(schema, table_identifier).identifier if var('has_defined_sources', false) else table_identifier\n    ) -%}\n\n    {%- set relation_exists=relation is not none -%}\n\n    {%- if relation_exists -%}\n        {%- do relations.append(relation) -%}\n    {%- endif -%}\n\n    {%- endfor -%}\n\n    {%- if relations != [] -%}\n        {{ dbt_utils.union_relations(relations) }}\n    {%- else -%}\n    {% if execute and not var('fivetran__remove_empty_table_warnings', false) -%}\n    {{ exceptions.warn(\"\\n\\nPlease be aware: The \" ~ table_identifier|upper ~ \" table was not found in your \" ~ default_schema|upper ~ \" schema(s). The Fivetran dbt package will create a completely empty \" ~ table_identifier|upper ~ \" staging model as to not break downstream transformations. To turn off these warnings, set the `fivetran__remove_empty_table_warnings` variable to TRUE (see https://github.com/fivetran/dbt_fivetran_utils/tree/releases/v0.4.latest#union_data-source for details).\\n\") }}\n    {% endif -%}\n    select \n        cast(null as {{ dbt.type_string() }}) as _dbt_source_relation\n    limit 0\n    {%- endif -%}\n\n{%- else -%}\n    {% set exception_schemas = {\"linkedin_company_pages\": \"linkedin_pages\", \"instagram_business_pages\": \"instagram_business\"} %}\n    {% set relation = namespace(value=\"\") %}\n    {% if default_schema in exception_schemas.keys() %}\n        {% for corrected_schema_name in exception_schemas.items() %}   \n            {% if default_schema in corrected_schema_name %}\n                {# In order for this macro to effectively work within upstream integration tests (mainly used by the Fivetran dbt package maintainers), this identifier variable selection is required to use the macro with different identifier names. #}\n                {% set identifier_var = corrected_schema_name[1] + \"_\" + table_identifier + \"_identifier\"  %}\n                {%- set relation.value=adapter.get_relation(\n                    database=source(corrected_schema_name[1], table_identifier).database,\n                    schema=source(corrected_schema_name[1], table_identifier).schema,\n                    identifier=var(identifier_var, table_identifier)\n                ) -%}\n            {% endif %}\n        {% endfor %}\n    {% else %}\n        {# In order for this macro to effectively work within upstream integration tests (mainly used by the Fivetran dbt package maintainers), this identifier variable selection is required to use the macro with different identifier names. #}\n        {% set identifier_var = default_schema + \"_\" + table_identifier + \"_identifier\"  %}\n        {# Unfortunately the Twitter Organic identifiers were misspelled. As such, we will need to account for this in the model. This will be adjusted in the Twitter Organic package, but to ensure backwards compatibility, this needs to be included. #}\n        {% if var(identifier_var, none) is none %} \n            {% set identifier_var = default_schema + \"_\" + table_identifier + \"_identifer\"  %}\n        {% endif %}\n        {%- set relation.value=adapter.get_relation(\n            database=source(default_schema, table_identifier).database,\n            schema=source(default_schema, table_identifier).schema,\n            identifier=var(identifier_var, table_identifier)\n        ) -%}\n    {% endif %}\n{%- set table_exists=relation.value is not none -%}\n\n{%- if table_exists -%}\n    select * \n    from {{ relation.value }}\n{%- else -%}\n    {% if execute and not var('fivetran__remove_empty_table_warnings', false) -%}\n    {{ exceptions.warn(\"\\n\\nPlease be aware: The \" ~ table_identifier|upper ~ \" table was not found in your \" ~ default_schema|upper ~ \" schema(s). The Fivetran dbt package will create a completely empty \" ~ table_identifier|upper ~ \" staging model as to not break downstream transformations. To turn off these warnings, set the `fivetran__remove_empty_table_warnings` variable to TRUE (see https://github.com/fivetran/dbt_fivetran_utils/tree/releases/v0.4.latest#union_data-source for details).\\n\") }}\n    {% endif -%}\n    select \n        cast(null as {{ dbt.type_string() }}) as _dbt_source_relation\n    limit 0\n{%- endif -%}\n{%- endif -%}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_utils.union_relations", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3716888, "supported_languages": null}, "macro.fivetran_utils.dummy_coalesce_value": {"name": "dummy_coalesce_value", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/dummy_coalesce_value.sql", "original_file_path": "macros/dummy_coalesce_value.sql", "unique_id": "macro.fivetran_utils.dummy_coalesce_value", "macro_sql": "{% macro dummy_coalesce_value(column) %}\n\n{% set coalesce_value = {\n 'STRING': \"'DUMMY_STRING'\",\n 'BOOLEAN': 'null',\n 'INT': 999999999,\n 'FLOAT': 999999999.99,\n 'TIMESTAMP': 'cast(\"2099-12-31\" as timestamp)',\n 'DATE': 'cast(\"2099-12-31\" as date)',\n} %}\n\n{% if column.is_float() %}\n{{ return(coalesce_value['FLOAT']) }}\n\n{% elif column.is_numeric() %}\n{{ return(coalesce_value['INT']) }}\n\n{% elif column.is_string() %}\n{{ return(coalesce_value['STRING']) }}\n\n{% elif column.data_type|lower == 'boolean' %}\n{{ return(coalesce_value['BOOLEAN']) }}\n\n{% elif 'timestamp' in column.data_type|lower %}\n{{ return(coalesce_value['TIMESTAMP']) }}\n\n{% elif 'date' in column.data_type|lower %}\n{{ return(coalesce_value['DATE']) }}\n\n{% elif 'int' in column.data_type|lower %}\n{{ return(coalesce_value['INT']) }}\n\n{% endif %}\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.373164, "supported_languages": null}, "macro.fivetran_utils.extract_url_parameter": {"name": "extract_url_parameter", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/extract_url_parameter.sql", "original_file_path": "macros/extract_url_parameter.sql", "unique_id": "macro.fivetran_utils.extract_url_parameter", "macro_sql": "{% macro extract_url_parameter(field, url_parameter) -%}\n\n{{ adapter.dispatch('extract_url_parameter', 'fivetran_utils') (field, url_parameter) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__extract_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.373513, "supported_languages": null}, "macro.fivetran_utils.default__extract_url_parameter": {"name": "default__extract_url_parameter", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/extract_url_parameter.sql", "original_file_path": "macros/extract_url_parameter.sql", "unique_id": "macro.fivetran_utils.default__extract_url_parameter", "macro_sql": "{% macro default__extract_url_parameter(field, url_parameter) -%}\n\n{{ dbt_utils.get_url_parameter(field, url_parameter) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.373667, "supported_languages": null}, "macro.fivetran_utils.spark__extract_url_parameter": {"name": "spark__extract_url_parameter", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/extract_url_parameter.sql", "original_file_path": "macros/extract_url_parameter.sql", "unique_id": "macro.fivetran_utils.spark__extract_url_parameter", "macro_sql": "{% macro spark__extract_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"=([^&]+)'\" -%}\nnullif(regexp_extract({{ field }}, {{ formatted_url_parameter }}, 1), '')\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.373866, "supported_languages": null}, "macro.fivetran_utils.wrap_in_quotes": {"name": "wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.wrap_in_quotes", "macro_sql": "{%- macro wrap_in_quotes(object_to_quote) -%}\n\n{{ return(adapter.dispatch('wrap_in_quotes', 'fivetran_utils')(object_to_quote)) }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.fivetran_utils.snowflake__wrap_in_quotes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.374208, "supported_languages": null}, "macro.fivetran_utils.default__wrap_in_quotes": {"name": "default__wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.default__wrap_in_quotes", "macro_sql": "{%- macro default__wrap_in_quotes(object_to_quote)  -%}\n{# bigquery, spark, databricks #}\n    `{{ object_to_quote }}`\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.374327, "supported_languages": null}, "macro.fivetran_utils.snowflake__wrap_in_quotes": {"name": "snowflake__wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.snowflake__wrap_in_quotes", "macro_sql": "{%- macro snowflake__wrap_in_quotes(object_to_quote)  -%}\n    \"{{ object_to_quote | upper }}\"\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.374444, "supported_languages": null}, "macro.fivetran_utils.redshift__wrap_in_quotes": {"name": "redshift__wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.redshift__wrap_in_quotes", "macro_sql": "{%- macro redshift__wrap_in_quotes(object_to_quote)  -%}\n    \"{{ object_to_quote }}\"\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3745458, "supported_languages": null}, "macro.fivetran_utils.postgres__wrap_in_quotes": {"name": "postgres__wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.postgres__wrap_in_quotes", "macro_sql": "{%- macro postgres__wrap_in_quotes(object_to_quote)  -%}\n    \"{{ object_to_quote }}\"\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.374646, "supported_languages": null}, "macro.fivetran_utils.array_agg": {"name": "array_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "unique_id": "macro.fivetran_utils.array_agg", "macro_sql": "{% macro array_agg(field_to_agg) -%}\n\n{{ adapter.dispatch('array_agg', 'fivetran_utils') (field_to_agg) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__array_agg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.374906, "supported_languages": null}, "macro.fivetran_utils.default__array_agg": {"name": "default__array_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "unique_id": "macro.fivetran_utils.default__array_agg", "macro_sql": "{% macro default__array_agg(field_to_agg) %}\n    array_agg({{ field_to_agg }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.375013, "supported_languages": null}, "macro.fivetran_utils.redshift__array_agg": {"name": "redshift__array_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "unique_id": "macro.fivetran_utils.redshift__array_agg", "macro_sql": "{% macro redshift__array_agg(field_to_agg) %}\n    listagg({{ field_to_agg }}, ',')\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3751192, "supported_languages": null}, "macro.fivetran_utils.empty_variable_warning": {"name": "empty_variable_warning", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/empty_variable_warning.sql", "original_file_path": "macros/empty_variable_warning.sql", "unique_id": "macro.fivetran_utils.empty_variable_warning", "macro_sql": "{% macro empty_variable_warning(variable, downstream_model) %}\n\n{% if not var(variable) %}\n{{ log(\n    \"\"\"\n    Warning: You have passed an empty list to the \"\"\" ~ variable ~ \"\"\".\n    As a result, you won't see the history of any columns in the \"\"\" ~ downstream_model ~ \"\"\" model.\n    \"\"\",\n    info=True\n) }}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.375521, "supported_languages": null}, "macro.fivetran_utils.enabled_vars_one_true": {"name": "enabled_vars_one_true", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/enabled_vars_one_true.sql", "original_file_path": "macros/enabled_vars_one_true.sql", "unique_id": "macro.fivetran_utils.enabled_vars_one_true", "macro_sql": "{% macro enabled_vars_one_true(vars) %}\n\n{% for v in vars %}\n    \n    {% if var(v, False) == True %}\n    {{ return(True) }}\n    {% endif %}\n\n{% endfor %}\n\n{{ return(False) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.375921, "supported_languages": null}, "macro.fivetran_log.get_log_columns": {"name": "get_log_columns", "resource_type": "macro", "package_name": "fivetran_log", "path": "macros/get_log_columns.sql", "original_file_path": "macros/get_log_columns.sql", "unique_id": "macro.fivetran_log.get_log_columns", "macro_sql": "{% macro get_log_columns() %}\n\n{% set columns = [\n    {\"name\": \"_fivetran_synced\", \"datatype\": dbt.type_timestamp()},\n    {\"name\": \"connector_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"event\", \"datatype\": dbt.type_string()},\n    {\"name\": \"id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"message_data\", \"datatype\": dbt.type_string()},\n    {\"name\": \"message_event\", \"datatype\": dbt.type_string()},\n    {\"name\": \"sync_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"time_stamp\", \"datatype\": dbt.type_timestamp()},\n    {\"name\": \"transformation_id\", \"datatype\": dbt.type_string()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3770618, "supported_languages": null}, "macro.fivetran_log.does_table_exist": {"name": "does_table_exist", "resource_type": "macro", "package_name": "fivetran_log", "path": "macros/does_table_exist.sql", "original_file_path": "macros/does_table_exist.sql", "unique_id": "macro.fivetran_log.does_table_exist", "macro_sql": "{%- macro does_table_exist(table_name) -%}\n    {%- if execute -%} -- returns true when dbt is in execute mode\n    {%- set ns = namespace(has_table=false) -%} -- declare boolean namespace and default value \n        {%- for node in graph.sources.values() -%} -- grab sources from the dictionary of nodes \n        -- call the database for the matching table\n            {%- if node.name | lower == table_name | lower -%} \n                {%- set source_relation = adapter.get_relation(\n                        database=node.database,\n                        schema=node.schema,\n                        identifier=node.identifier ) -%} \n            {% endif %}\n            {%- if source_relation == None -%} \n                {{ return(False) }} -- return false if relation identified by the database.schema.identifier does not exist for the given table name\n            {% endif %}\n        {%- endfor -%}\n        {{ return(True) }}\n    {%- endif -%} \n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.378027, "supported_languages": null}, "macro.fivetran_log.get_connector_columns": {"name": "get_connector_columns", "resource_type": "macro", "package_name": "fivetran_log", "path": "macros/get_brand_columns.sql", "original_file_path": "macros/get_brand_columns.sql", "unique_id": "macro.fivetran_log.get_connector_columns", "macro_sql": "{% macro get_connector_columns() %}\n\n{% set columns = [\n    {\"name\": \"_fivetran_deleted\", \"datatype\": dbt.type_boolean()},\n    {\"name\": \"_fivetran_synced\", \"datatype\": dbt.type_timestamp()},\n    {\"name\": \"connecting_user_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"connector_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"connector_name\", \"datatype\": dbt.type_string()},\n    {\"name\": \"connector_type\", \"datatype\": dbt.type_string()},\n    {\"name\": \"connector_type_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"destination_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"paused\", \"datatype\": dbt.type_boolean()},\n    {\"name\": \"service_version\", \"datatype\": dbt.type_int()},\n    {\"name\": \"signed_up\", \"datatype\": dbt.type_timestamp()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_boolean", "macro.dbt.type_timestamp", "macro.dbt.type_string", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3793228, "supported_languages": null}}, "docs": {"doc.dbt.__overview__": {"name": "__overview__", "resource_type": "doc", "package_name": "dbt", "path": "overview.md", "original_file_path": "docs/overview.md", "unique_id": "doc.dbt.__overview__", "block_contents": "### Welcome!\n\nWelcome to the auto-generated documentation for your dbt project!\n\n### Navigation\n\nYou can use the `Project` and `Database` navigation tabs on the left side of the window to explore the models\nin your project.\n\n#### Project Tab\nThe `Project` tab mirrors the directory structure of your dbt project. In this tab, you can see all of the\nmodels defined in your dbt project, as well as models imported from dbt packages.\n\n#### Database Tab\nThe `Database` tab also exposes your models, but in a format that looks more like a database explorer. This view\nshows relations (tables and views) grouped into database schemas. Note that ephemeral models are _not_ shown\nin this interface, as they do not exist in the database.\n\n### Graph Exploration\nYou can click the blue icon on the bottom-right corner of the page to view the lineage graph of your models.\n\nOn model pages, you'll see the immediate parents and children of the model you're exploring. By clicking the `Expand`\nbutton at the top-right of this lineage pane, you'll be able to see all of the models that are used to build,\nor are built from, the model you're exploring.\n\nOnce expanded, you'll be able to use the `--select` and `--exclude` model selection syntax to filter the\nmodels in the graph. For more information on model selection, check out the [dbt docs](https://docs.getdbt.com/docs/model-selection-syntax).\n\nNote that you can also right-click on models to interactively filter and explore the graph.\n\n---\n\n### More information\n\n- [What is dbt](https://docs.getdbt.com/docs/introduction)?\n- Read the [dbt viewpoint](https://docs.getdbt.com/docs/viewpoint)\n- [Installation](https://docs.getdbt.com/docs/installation)\n- Join the [dbt Community](https://www.getdbt.com/community/) for questions and discussion"}}, "exposures": {}, "metrics": {}, "groups": {}, "selectors": {}, "disabled": {}, "parent_map": {"seed.fivetran_log_integration_tests.log": [], "seed.fivetran_log_integration_tests.destination_membership": [], "seed.fivetran_log_integration_tests.credits_used": [], "seed.fivetran_log_integration_tests.destination": [], "seed.fivetran_log_integration_tests.connector": [], "seed.fivetran_log_integration_tests.user": [], "seed.fivetran_log_integration_tests.account": [], "seed.fivetran_log_integration_tests.usage_cost": [], "seed.fivetran_log_integration_tests.incremental_mar": [], "model.fivetran_log.fivetran_platform__schema_changelog": ["model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.stg_fivetran_platform__log"], "model.fivetran_log.fivetran_platform__connector_daily_events": ["model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.stg_fivetran_platform__log", "source.fivetran_log.fivetran_platform.connector"], "model.fivetran_log.fivetran_platform__audit_user_activity": ["model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination", "model.fivetran_log.stg_fivetran_platform__destination_membership", "model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.stg_fivetran_platform__user"], "model.fivetran_log.fivetran_platform__connector_status": ["model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination", "model.fivetran_log.stg_fivetran_platform__log"], "model.fivetran_log.fivetran_platform__usage_mar_destination_history": ["model.fivetran_log.fivetran_platform__mar_table_history", "model.fivetran_log.stg_fivetran_platform__credits_used", "model.fivetran_log.stg_fivetran_platform__usage_cost"], "model.fivetran_log.fivetran_platform__audit_table": ["model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.stg_fivetran_platform__log"], "model.fivetran_log.fivetran_platform__mar_table_history": ["model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination", "model.fivetran_log.stg_fivetran_platform__incremental_mar"], "model.fivetran_log.stg_fivetran_platform__user": ["source.fivetran_log.fivetran_platform.user"], "model.fivetran_log.stg_fivetran_platform__destination_membership": ["source.fivetran_log.fivetran_platform.destination_membership"], "model.fivetran_log.stg_fivetran_platform__credits_used": [], "model.fivetran_log.stg_fivetran_platform__usage_cost": [], "model.fivetran_log.stg_fivetran_platform__destination": ["source.fivetran_log.fivetran_platform.destination"], "model.fivetran_log.stg_fivetran_platform__log": ["model.fivetran_log.stg_fivetran_platform__log_tmp"], "model.fivetran_log.stg_fivetran_platform__incremental_mar": ["source.fivetran_log.fivetran_platform.incremental_mar"], "model.fivetran_log.stg_fivetran_platform__connector": ["model.fivetran_log.stg_fivetran_platform__connector_tmp"], "model.fivetran_log.stg_fivetran_platform__account": ["source.fivetran_log.fivetran_platform.account"], "model.fivetran_log.stg_fivetran_platform__connector_tmp": ["source.fivetran_log.fivetran_platform.connector"], "model.fivetran_log.stg_fivetran_platform__log_tmp": ["source.fivetran_log.fivetran_platform.log"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89": ["model.fivetran_log.fivetran_platform__connector_status"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441": ["model.fivetran_log.fivetran_platform__mar_table_history"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f": ["model.fivetran_log.fivetran_platform__connector_daily_events"], "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7": ["model.fivetran_log.fivetran_platform__audit_table"], "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af": ["model.fivetran_log.fivetran_platform__audit_table"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493": ["model.fivetran_log.fivetran_platform__schema_changelog"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at.be572689a3": ["model.fivetran_log.fivetran_platform__audit_user_activity"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a": ["model.fivetran_log.stg_fivetran_platform__connector"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38": ["model.fivetran_log.stg_fivetran_platform__credits_used"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f": ["model.fivetran_log.stg_fivetran_platform__usage_cost"], "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed": ["model.fivetran_log.stg_fivetran_platform__destination"], "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780": ["model.fivetran_log.stg_fivetran_platform__destination"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d": ["model.fivetran_log.stg_fivetran_platform__log"], "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc": ["model.fivetran_log.stg_fivetran_platform__account"], "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e": ["model.fivetran_log.stg_fivetran_platform__account"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a": ["model.fivetran_log.stg_fivetran_platform__destination_membership"], "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9": ["model.fivetran_log.stg_fivetran_platform__user"], "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0": ["model.fivetran_log.stg_fivetran_platform__user"], "source.fivetran_log.fivetran_platform.incremental_mar": [], "source.fivetran_log.fivetran_platform.connector": [], "source.fivetran_log.fivetran_platform.credits_used": [], "source.fivetran_log.fivetran_platform.usage_cost": [], "source.fivetran_log.fivetran_platform.destination": [], "source.fivetran_log.fivetran_platform.log": [], "source.fivetran_log.fivetran_platform.account": [], "source.fivetran_log.fivetran_platform.destination_membership": [], "source.fivetran_log.fivetran_platform.user": []}, "child_map": {"seed.fivetran_log_integration_tests.log": [], "seed.fivetran_log_integration_tests.destination_membership": [], "seed.fivetran_log_integration_tests.credits_used": [], "seed.fivetran_log_integration_tests.destination": [], "seed.fivetran_log_integration_tests.connector": [], "seed.fivetran_log_integration_tests.user": [], "seed.fivetran_log_integration_tests.account": [], "seed.fivetran_log_integration_tests.usage_cost": [], "seed.fivetran_log_integration_tests.incremental_mar": [], "model.fivetran_log.fivetran_platform__schema_changelog": ["test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493"], "model.fivetran_log.fivetran_platform__connector_daily_events": ["test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f"], "model.fivetran_log.fivetran_platform__audit_user_activity": ["test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at.be572689a3"], "model.fivetran_log.fivetran_platform__connector_status": ["model.fivetran_log.fivetran_platform__audit_table", "model.fivetran_log.fivetran_platform__connector_daily_events", "model.fivetran_log.fivetran_platform__schema_changelog", "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89"], "model.fivetran_log.fivetran_platform__usage_mar_destination_history": ["test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd"], "model.fivetran_log.fivetran_platform__audit_table": ["test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af", "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7"], "model.fivetran_log.fivetran_platform__mar_table_history": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history", "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441"], "model.fivetran_log.stg_fivetran_platform__user": ["model.fivetran_log.fivetran_platform__audit_user_activity", "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0", "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9"], "model.fivetran_log.stg_fivetran_platform__destination_membership": ["model.fivetran_log.fivetran_platform__audit_user_activity", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a"], "model.fivetran_log.stg_fivetran_platform__credits_used": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38"], "model.fivetran_log.stg_fivetran_platform__usage_cost": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f"], "model.fivetran_log.stg_fivetran_platform__destination": ["model.fivetran_log.fivetran_platform__audit_user_activity", "model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.fivetran_platform__mar_table_history", "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780", "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed"], "model.fivetran_log.stg_fivetran_platform__log": ["model.fivetran_log.fivetran_platform__audit_table", "model.fivetran_log.fivetran_platform__audit_user_activity", "model.fivetran_log.fivetran_platform__connector_daily_events", "model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.fivetran_platform__schema_changelog", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d"], "model.fivetran_log.stg_fivetran_platform__incremental_mar": ["model.fivetran_log.fivetran_platform__mar_table_history"], "model.fivetran_log.stg_fivetran_platform__connector": ["model.fivetran_log.fivetran_platform__audit_user_activity", "model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.fivetran_platform__mar_table_history", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a"], "model.fivetran_log.stg_fivetran_platform__account": ["test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e", "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc"], "model.fivetran_log.stg_fivetran_platform__connector_tmp": ["model.fivetran_log.stg_fivetran_platform__connector"], "model.fivetran_log.stg_fivetran_platform__log_tmp": ["model.fivetran_log.stg_fivetran_platform__log"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f": [], "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7": [], "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at.be572689a3": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f": [], "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed": [], "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d": [], "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc": [], "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a": [], "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9": [], "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0": [], "source.fivetran_log.fivetran_platform.incremental_mar": ["model.fivetran_log.stg_fivetran_platform__incremental_mar"], "source.fivetran_log.fivetran_platform.connector": ["model.fivetran_log.fivetran_platform__connector_daily_events", "model.fivetran_log.stg_fivetran_platform__connector_tmp"], "source.fivetran_log.fivetran_platform.credits_used": [], "source.fivetran_log.fivetran_platform.usage_cost": [], "source.fivetran_log.fivetran_platform.destination": ["model.fivetran_log.stg_fivetran_platform__destination"], "source.fivetran_log.fivetran_platform.log": ["model.fivetran_log.stg_fivetran_platform__log_tmp"], "source.fivetran_log.fivetran_platform.account": ["model.fivetran_log.stg_fivetran_platform__account"], "source.fivetran_log.fivetran_platform.destination_membership": ["model.fivetran_log.stg_fivetran_platform__destination_membership"], "source.fivetran_log.fivetran_platform.user": ["model.fivetran_log.stg_fivetran_platform__user"]}, "group_map": {}, "saved_queries": {}, "semantic_models": {}}
\ No newline at end of file
diff --git a/docs/run_results.json b/docs/run_results.json
index 5a921145..eca4082b 100644
--- a/docs/run_results.json
+++ b/docs/run_results.json
@@ -1 +1 @@
-{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v5.json", "dbt_version": "1.7.0", "generated_at": "2023-11-14T18:04:15.822113Z", "invocation_id": "5e424184-132f-49e4-8bc7-f99dbda88d2d", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.525694Z", "completed_at": "2023-11-14T18:04:12.562538Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.564647Z", "completed_at": "2023-11-14T18:04:12.564670Z"}], "thread_id": "Thread-1", "execution_time": 0.0462799072265625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__account", "compiled": true, "compiled_code": "with base as (\n    \n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`account`\n),\n\nfields as (\n\n    select\n        id as account_id,\n        country,\n        cast(created_at as timestamp) as created_at,\n        name as account_name,\n        status\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__account`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.540819Z", "completed_at": "2023-11-14T18:04:12.562970Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.564993Z", "completed_at": "2023-11-14T18:04:12.564997Z"}], "thread_id": "Thread-2", "execution_time": 0.045790910720825195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__connector_tmp", "compiled": true, "compiled_code": "select *\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`connector`", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__connector_tmp`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.546807Z", "completed_at": "2023-11-14T18:04:12.563991Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.567167Z", "completed_at": "2023-11-14T18:04:12.567171Z"}], "thread_id": "Thread-4", "execution_time": 0.04585599899291992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__destination", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`destination`\n),\n\nfields as (\n\n    select\n        id as destination_id,\n        account_id,\n        cast(created_at as timestamp) as created_at,\n        name as destination_name,\n        region\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__destination`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.544875Z", "completed_at": "2023-11-14T18:04:12.564315Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.567493Z", "completed_at": "2023-11-14T18:04:12.567498Z"}], "thread_id": "Thread-3", "execution_time": 0.04742789268493652, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__credits_used", "compiled": true, "compiled_code": "\n\nwith base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`credits_used`\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        credits_consumed as credits_spent\n    from base\n)\n\nselect * \nfrom fields\n\n", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__credits_used`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.576699Z", "completed_at": "2023-11-14T18:04:12.586249Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.587841Z", "completed_at": "2023-11-14T18:04:12.587846Z"}], "thread_id": "Thread-2", "execution_time": 0.018970727920532227, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__incremental_mar", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`incremental_mar`\n),\n\nfields as (\n\n    select\n        connector_id as connector_name,\n        destination_id,\n        free_type,\n        cast(measured_date as timestamp) as measured_date,\n        schema_name,\n        sync_type,\n        table_name,\n        updated_at,\n        _fivetran_synced,\n        incremental_rows\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__incremental_mar`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.572504Z", "completed_at": "2023-11-14T18:04:12.586510Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.588136Z", "completed_at": "2023-11-14T18:04:12.588139Z"}], "thread_id": "Thread-1", "execution_time": 0.01988506317138672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__destination_membership", "compiled": true, "compiled_code": "\n\nwith base as (\n    \n    select * from `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`destination_membership`\n),\n\nfields as (\n\n    select\n        destination_id,\n        user_id,\n        cast(activated_at as timestamp) as activated_at,\n        cast(joined_at as timestamp) as joined_at,\n        role as destination_role\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__destination_membership`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.580311Z", "completed_at": "2023-11-14T18:04:12.587347Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.589890Z", "completed_at": "2023-11-14T18:04:12.589894Z"}], "thread_id": "Thread-4", "execution_time": 0.01954483985900879, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__log_tmp", "compiled": true, "compiled_code": "select *\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`log`", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log_tmp`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.582861Z", "completed_at": "2023-11-14T18:04:12.587582Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.590155Z", "completed_at": "2023-11-14T18:04:12.590158Z"}], "thread_id": "Thread-3", "execution_time": 0.0196378231048584, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__usage_cost", "compiled": true, "compiled_code": "\nwith base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`usage_cost`\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        amount as dollars_spent\n    from base\n)\n\nselect * \nfrom fields\n\n", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__usage_cost`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.598737Z", "completed_at": "2023-11-14T18:04:12.599968Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.603966Z", "completed_at": "2023-11-14T18:04:12.603971Z"}], "thread_id": "Thread-1", "execution_time": 0.012684106826782227, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.account", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.601010Z", "completed_at": "2023-11-14T18:04:12.602202Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.605660Z", "completed_at": "2023-11-14T18:04:12.605664Z"}], "thread_id": "Thread-4", "execution_time": 0.012965917587280273, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.connector", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.602519Z", "completed_at": "2023-11-14T18:04:12.603662Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.605938Z", "completed_at": "2023-11-14T18:04:12.605940Z"}], "thread_id": "Thread-3", "execution_time": 0.013061046600341797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.credits_used", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.594747Z", "completed_at": "2023-11-14T18:04:12.604221Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.606487Z", "completed_at": "2023-11-14T18:04:12.606489Z"}], "thread_id": "Thread-2", "execution_time": 0.0162808895111084, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__user", "compiled": true, "compiled_code": "\n\nwith base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`user`\n),\n\nfields as (\n\n    select\n        id as user_id,\n        cast(created_at as timestamp) as created_at,\n        email,\n        email_disabled as has_disabled_email_notifications,\n        family_name as last_name,\n        given_name as first_name,\n        phone,\n        verified as is_verified\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__user`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.610611Z", "completed_at": "2023-11-14T18:04:12.612450Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.617126Z", "completed_at": "2023-11-14T18:04:12.617131Z"}], "thread_id": "Thread-1", "execution_time": 0.011912107467651367, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.destination", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.614028Z", "completed_at": "2023-11-14T18:04:12.615235Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.620206Z", "completed_at": "2023-11-14T18:04:12.620209Z"}], "thread_id": "Thread-4", "execution_time": 0.011639833450317383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.destination_membership", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.615571Z", "completed_at": "2023-11-14T18:04:12.616791Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.620472Z", "completed_at": "2023-11-14T18:04:12.620475Z"}], "thread_id": "Thread-3", "execution_time": 0.011792898178100586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.incremental_mar", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.617401Z", "completed_at": "2023-11-14T18:04:12.618694Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.620996Z", "completed_at": "2023-11-14T18:04:12.620998Z"}], "thread_id": "Thread-2", "execution_time": 0.010170936584472656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.log", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.625072Z", "completed_at": "2023-11-14T18:04:12.626390Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.637763Z", "completed_at": "2023-11-14T18:04:12.637768Z"}], "thread_id": "Thread-1", "execution_time": 0.020350933074951172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.usage_cost", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.628014Z", "completed_at": "2023-11-14T18:04:12.629916Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.643138Z", "completed_at": "2023-11-14T18:04:12.643142Z"}], "thread_id": "Thread-4", "execution_time": 0.020157814025878906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.user", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.630192Z", "completed_at": "2023-11-14T18:04:12.643435Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.646040Z", "completed_at": "2023-11-14T18:04:12.646044Z"}], "thread_id": "Thread-3", "execution_time": 0.022794008255004883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect account_id\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__account`\nwhere account_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.638046Z", "completed_at": "2023-11-14T18:04:12.643951Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.646614Z", "completed_at": "2023-11-14T18:04:12.646617Z"}], "thread_id": "Thread-2", "execution_time": 0.024075031280517578, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc", "compiled": true, "compiled_code": "\n    \n    \n\nwith dbt_test__target as (\n\n  select account_id as unique_field\n  from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__account`\n  where account_id is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.652568Z", "completed_at": "2023-11-14T18:04:12.660806Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.667874Z", "completed_at": "2023-11-14T18:04:12.667879Z"}], "thread_id": "Thread-4", "execution_time": 0.021780967712402344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect destination_id\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__destination`\nwhere destination_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.657845Z", "completed_at": "2023-11-14T18:04:12.668167Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.670072Z", "completed_at": "2023-11-14T18:04:12.670075Z"}], "thread_id": "Thread-3", "execution_time": 0.014747858047485352, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed", "compiled": true, "compiled_code": "\n    \n    \n\nwith dbt_test__target as (\n\n  select destination_id as unique_field\n  from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__destination`\n  where destination_id is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.661086Z", "completed_at": "2023-11-14T18:04:12.669007Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.670736Z", "completed_at": "2023-11-14T18:04:12.670739Z"}], "thread_id": "Thread-2", "execution_time": 0.015115737915039062, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        measured_month, destination_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__credits_used`\n    group by measured_month, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.672629Z", "completed_at": "2023-11-14T18:04:12.677939Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.730499Z", "completed_at": "2023-11-14T18:04:12.730506Z"}], "thread_id": "Thread-4", "execution_time": 0.060685157775878906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        destination_id, user_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__destination_membership`\n    group by destination_id, user_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.681007Z", "completed_at": "2023-11-14T18:04:12.735912Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.736712Z", "completed_at": "2023-11-14T18:04:12.736717Z"}], "thread_id": "Thread-2", "execution_time": 0.06028270721435547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        measured_month, destination_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__usage_cost`\n    group by measured_month, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.732645Z", "completed_at": "2023-11-14T18:04:12.737914Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.739175Z", "completed_at": "2023-11-14T18:04:12.739179Z"}], "thread_id": "Thread-4", "execution_time": 0.010925054550170898, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect user_id\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__user`\nwhere user_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.739454Z", "completed_at": "2023-11-14T18:04:12.743062Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:12.743567Z", "completed_at": "2023-11-14T18:04:12.743570Z"}], "thread_id": "Thread-2", "execution_time": 0.005714893341064453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9", "compiled": true, "compiled_code": "\n    \n    \n\nwith dbt_test__target as (\n\n  select user_id as unique_field\n  from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__user`\n  where user_id is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.647810Z", "completed_at": "2023-11-14T18:04:13.063701Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:13.066121Z", "completed_at": "2023-11-14T18:04:13.066131Z"}], "thread_id": "Thread-1", "execution_time": 0.42267513275146484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__connector", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__connector_tmp`\n),\n\nfields as (\n    select\n        \n    cast(null as boolean) as \n    \n    _fivetran_deleted\n    \n , \n    \n    \n    _fivetran_synced\n    \n as \n    \n    _fivetran_synced\n    \n, \n    \n    \n    connecting_user_id\n    \n as \n    \n    connecting_user_id\n    \n, \n    \n    \n    connector_id\n    \n as \n    \n    connector_id\n    \n, \n    \n    \n    connector_name\n    \n as \n    \n    connector_name\n    \n, \n    \n    \n    connector_type\n    \n as \n    \n    connector_type\n    \n, \n    cast(null as string) as \n    \n    connector_type_id\n    \n , \n    \n    \n    destination_id\n    \n as \n    \n    destination_id\n    \n, \n    \n    \n    paused\n    \n as \n    \n    paused\n    \n, \n    cast(null as INT64) as \n    \n    service_version\n    \n , \n    \n    \n    signed_up\n    \n as \n    \n    signed_up\n    \n\n\n\n        ,row_number() over ( partition by connector_name, destination_id order by _fivetran_synced desc ) as nth_last_record\n    from base\n),\n\nfinal as (\n\n    select \n        connector_id,\n        connector_name,\n        coalesce(connector_type_id, connector_type) as connector_type,\n        destination_id,\n        connecting_user_id,\n        paused as is_paused,\n        signed_up as set_up_at\n    from fields\n\n    -- Only look at the most recent one\n    where nth_last_record = 1\n)\n\nselect * \nfrom final", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__connector`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:12.678211Z", "completed_at": "2023-11-14T18:04:13.064430Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:13.066721Z", "completed_at": "2023-11-14T18:04:13.066727Z"}], "thread_id": "Thread-3", "execution_time": 0.39223575592041016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__log", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log_tmp`\n),\n\nfields as (\n    select\n        \n    \n    \n    _fivetran_synced\n    \n as \n    \n    _fivetran_synced\n    \n, \n    \n    \n    connector_id\n    \n as \n    \n    connector_id\n    \n, \n    \n    \n    event\n    \n as \n    \n    event\n    \n, \n    \n    \n    id\n    \n as \n    \n    id\n    \n, \n    \n    \n    message_data\n    \n as \n    \n    message_data\n    \n, \n    \n    \n    message_event\n    \n as \n    \n    message_event\n    \n, \n    \n    \n    sync_id\n    \n as \n    \n    sync_id\n    \n, \n    \n    \n    time_stamp\n    \n as \n    \n    time_stamp\n    \n, \n    \n    \n    transformation_id\n    \n as \n    \n    transformation_id\n    \n\n\n\n    from base\n),\n\nfinal as (\n\n    select\n        id as log_id, \n        sync_id,\n        cast(time_stamp as timestamp) as created_at,\n        connector_id, -- Note: the connector_id column used to erroneously equal the connector_name, NOT its id.\n        case when transformation_id is not null and event is null then 'TRANSFORMATION'\n        else event end as event_type, \n        message_data,\n        case \n        when transformation_id is not null and message_data like '%has succeeded%' then 'transformation run success'\n        when transformation_id is not null and message_data like '%has failed%' then 'transformation run failed'\n        else message_event end as event_subtype,\n        transformation_id\n    from fields\n)\n\nselect * \nfrom final", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:13.083497Z", "completed_at": "2023-11-14T18:04:13.127976Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:13.130017Z", "completed_at": "2023-11-14T18:04:13.130022Z"}], "thread_id": "Thread-2", "execution_time": 0.05874514579772949, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_name, destination_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__connector`\n    group by connector_name, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:13.097523Z", "completed_at": "2023-11-14T18:04:13.128325Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:13.130563Z", "completed_at": "2023-11-14T18:04:13.130566Z"}], "thread_id": "Thread-1", "execution_time": 0.05878019332885742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__audit_user_activity", "compiled": true, "compiled_code": "with logs as (\n\n    select \n        *,\n        \n\n \n  json_extract_scalar(message_data, '$.actor')\n\n as actor_email\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log`\n),\n\nuser_logs as (\n\n    select *\n    from logs\n    where actor_email is not null \n        and lower(actor_email) != 'fivetran'\n),\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__connector`\n),\n\ndestination as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__destination`\n),\nusers as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__user`\n),\n    destination_membership as (\n\n        select *\n        from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__destination_membership`\n    ),\n    final as (\n\n    select\n        timestamp_trunc(\n        cast(user_logs.created_at as timestamp),\n        day\n    ) as date_day,\n        format_date('%a', cast(user_logs.created_at as date)) as day_name,\n        extract(day from user_logs.created_at) as day_of_month,\n        user_logs.created_at as occurred_at,\n        destination.destination_name,\n        destination.destination_id,\n        connector.connector_name,\n        connector.connector_id,\n        user_logs.actor_email as email,\n        users.first_name,\n        users.last_name,\n        users.user_id,\n        destination_membership.destination_role,\n    user_logs.event_type, -- should always be INFO for user-triggered actions but include just in case\n        user_logs.event_subtype,\n        user_logs.message_data,\n        user_logs.log_id\n\n    from user_logs\n    left join connector\n        on user_logs.connector_id = connector.connector_id\n    left join destination\n        on connector.destination_id = destination.destination_id\n    left join users \n        on lower(users.email) = lower(user_logs.actor_email)\n    left join destination_membership\n        on destination.destination_id = destination_membership.destination_id\n        and users.user_id = destination_membership.user_id\n\n    )\n\nselect *\nfrom final", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__audit_user_activity`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:13.076363Z", "completed_at": "2023-11-14T18:04:13.128633Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:13.130855Z", "completed_at": "2023-11-14T18:04:13.130859Z"}], "thread_id": "Thread-4", "execution_time": 0.06137490272521973, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__mar_table_history", "compiled": true, "compiled_code": "with incremental_mar as (\n\n    select\n        *,\n        timestamp_trunc(\n        cast(measured_date as timestamp),\n        month\n    ) as measured_month\n\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__incremental_mar`\n),\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__connector`\n),\n\ndestination as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__destination`\n),\n\nordered_mar as (\n\n    select\n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        max(measured_date) as last_measured_at,\n        sum(incremental_rows) as incremental_rows,\n        sum(coalesce(case when lower(free_type) = 'paid'\n            then incremental_rows\n        end, 0)) as paid_monthly_active_rows,\n        sum(coalesce(case when lower(free_type) != 'paid'\n            then incremental_rows\n        end, 0)) as free_monthly_active_rows\n\n    from incremental_mar\n    group by 1,2,3,4,5\n),\n\nlatest_mar as (\n    select \n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        date(last_measured_at) as last_measured_at,\n        free_monthly_active_rows,\n        paid_monthly_active_rows,\n        (free_monthly_active_rows + paid_monthly_active_rows) as total_monthly_active_rows\n\n    from ordered_mar\n),\n\nmar_join as (\n\n    select\n        latest_mar.*,\n        connector.connector_type,\n        connector.connector_id,\n        destination.destination_name\n\n    from latest_mar\n    join connector\n        on latest_mar.connector_name = connector.connector_name\n        and latest_mar.destination_id = connector.destination_id\n    join destination on latest_mar.destination_id = destination.destination_id\n)\n\nselect * from mar_join\norder by measured_month desc, destination_id, connector_name", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__mar_table_history`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:13.111672Z", "completed_at": "2023-11-14T18:04:13.129183Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:13.131716Z", "completed_at": "2023-11-14T18:04:13.131718Z"}], "thread_id": "Thread-3", "execution_time": 0.05894589424133301, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__connector_status", "compiled": true, "compiled_code": "with transformation_removal as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log`\n    where transformation_id is null\n\n),\n\nconnector_log as (\n    select \n        *,\n        sum( case when event_subtype in ('sync_start') then 1 else 0 end) over ( partition by connector_id \n            order by created_at rows unbounded preceding) as sync_batch_id\n    from transformation_removal\n    -- only looking at errors, warnings, and syncs here\n    where event_type = 'SEVERE'\n        or event_type = 'WARNING'\n        or event_subtype like 'sync%'\n        or (event_subtype = 'status' \n            and \n\n \n  json_extract_scalar(message_data, '$.status')\n\n = 'RESCHEDULED'\n            \n            and \n\n \n  json_extract_scalar(message_data, '$.reason')\n\n like '%intended behavior%'\n            ) -- for priority-first syncs. these should be captured by event_type = 'WARNING' but let's make sure\n        or (event_subtype = 'status' \n            and \n\n \n  json_extract_scalar(message_data, '$.status')\n\n = 'SUCCESSFUL'\n        )\n        -- whole reason is \"We have rescheduled the connector to force flush data from the forward sync into your destination. This is intended behavior and means that the connector is working as expected.\"\n),\n\nschema_changes as (\n\n    select\n        connector_id,\n        count(*) as number_of_schema_changes_last_month\n\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log`\n\n    where \n        \n\n    datetime_diff(\n        cast(current_timestamp as datetime),\n        cast(created_at as datetime),\n        day\n    )\n\n   <= 30\n        and event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n\n    group by 1\n\n),\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__connector`\n\n),\n\ndestination as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__destination`\n),\n\nconnector_metrics as (\n\n    select\n        connector.connector_id,\n        connector.connector_name,\n        connector.connector_type,\n        connector.destination_id,\n        connector.is_paused,\n        connector.set_up_at,\n        max(case when connector_log.event_subtype = 'sync_start' then connector_log.created_at else null end) as last_sync_started_at,\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.created_at else null end) as last_sync_completed_at,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and \n\n \n  json_extract_scalar(connector_log.message_data, '$.status')\n\n ='SUCCESSFUL'\n            then connector_log.created_at else null end) as last_successful_sync_completed_at,\n\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.sync_batch_id else null end) as last_sync_batch_id,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and \n\n \n  json_extract_scalar(connector_log.message_data, '$.status')\n\n ='RESCHEDULED'\n                and \n\n \n  json_extract_scalar(connector_log.message_data, '$.reason')\n\n like '%intended behavior%'\n            then connector_log.created_at else null end) as last_priority_first_sync_completed_at,\n                \n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.created_at else null end) as last_error_at,\n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.sync_batch_id else null end) as last_error_batch,\n        max(case when event_type = 'WARNING' then connector_log.created_at else null end) as last_warning_at\n\n    from connector \n    left join connector_log \n        on connector_log.connector_id = connector.connector_id\n    group by 1,2,3,4,5,6\n\n),\n\nconnector_health as (\n\n    select\n        *,\n        case \n            -- connector is paused\n            when is_paused then 'paused'\n\n            -- a sync has never been attempted\n            when last_sync_started_at is null then 'incomplete'\n\n            -- a priority-first sync has occurred, but a normal sync has not\n            when last_priority_first_sync_completed_at is not null and last_sync_completed_at is null then 'priority first sync'\n\n            -- a priority sync has occurred more recently than a normal one (may occurr if the connector has been paused and resumed)\n            when last_priority_first_sync_completed_at > last_sync_completed_at then 'priority first sync'\n\n            -- a sync has been attempted, but not completed, and it's not due to errors. also a priority-first sync hasn't\n            when last_sync_completed_at is null and last_error_at is null then 'initial sync in progress'\n\n            -- the last attempted sync had an error\n            when last_sync_batch_id = last_error_batch then 'broken'\n\n            -- there's never been a successful sync and there have been errors\n            when last_sync_completed_at is null and last_error_at is not null then 'broken'\n\n        else 'connected' end as connector_health\n\n    from connector_metrics\n),\n\n-- Joining with log to grab pertinent error/warning messagees\nconnector_recent_logs as (\n\n    select \n        connector_health.connector_id,\n        connector_health.connector_name,\n        connector_health.connector_type,\n        connector_health.destination_id,\n        connector_health.connector_health,\n        connector_health.last_successful_sync_completed_at,\n        connector_health.last_sync_started_at,\n        connector_health.last_sync_completed_at,\n        connector_health.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n    from connector_health \n    left join connector_log \n        on connector_log.connector_id = connector_health.connector_id\n        -- limiting relevance to since the last successful sync completion (if there has been one)\n        and connector_log.created_at > coalesce(connector_health.last_sync_completed_at, connector_health.last_priority_first_sync_completed_at, '2000-01-01') \n        -- only looking at errors and warnings (excluding syncs - both normal and priority first)\n        and connector_log.event_type != 'INFO' \n        -- need to explicitly avoid priority first statuses because they are of event_type WARNING\n        and not (connector_log.event_subtype = 'status' \n            and \n\n \n  json_extract_scalar(connector_log.message_data, '$.status')\n\n ='RESCHEDULED'\n            and \n\n \n  json_extract_scalar(connector_log.message_data, '$.reason')\n\n like '%intended behavior%')\n\n    group by 1,2,3,4,5,6,7,8,9,10,11,12 -- de-duping error messages\n    \n\n),\n\nfinal as (\n\n    select\n        connector_recent_logs.connector_id,\n        connector_recent_logs.connector_name,\n        connector_recent_logs.connector_type,\n        connector_recent_logs.destination_id,\n        destination.destination_name,\n        connector_recent_logs.connector_health,\n        connector_recent_logs.last_successful_sync_completed_at,\n        connector_recent_logs.last_sync_started_at,\n        connector_recent_logs.last_sync_completed_at,\n        connector_recent_logs.set_up_at,\n        coalesce(schema_changes.number_of_schema_changes_last_month, 0) as number_of_schema_changes_last_month\n        \n        \n        , \n    string_agg(distinct case when connector_recent_logs.event_type = 'SEVERE' then connector_recent_logs.message_data else null end, '\\n')\n\n as errors_since_last_completed_sync\n        , \n    string_agg(distinct case when connector_recent_logs.event_type = 'WARNING' then connector_recent_logs.message_data else null end, '\\n')\n\n as warnings_since_last_completed_sync\n        \n\n    from connector_recent_logs\n    left join schema_changes \n        on connector_recent_logs.connector_id = schema_changes.connector_id \n\n    join destination on destination.destination_id = connector_recent_logs.destination_id\n    group by 1,2,3,4,5,6,7,8,9,10,11\n)\n\nselect * from final", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__connector_status`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:13.137190Z", "completed_at": "2023-11-14T18:04:13.153834Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:13.154378Z", "completed_at": "2023-11-14T18:04:13.154383Z"}], "thread_id": "Thread-2", "execution_time": 0.0202789306640625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        log_id, created_at\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log`\n    group by log_id, created_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:13.147026Z", "completed_at": "2023-11-14T18:04:13.155281Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:13.157478Z", "completed_at": "2023-11-14T18:04:13.157481Z"}], "thread_id": "Thread-3", "execution_time": 0.02234172821044922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__usage_mar_destination_history", "compiled": true, "compiled_code": "with table_mar as (\n    \n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__mar_table_history`\n),\n\ncredits_used as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__credits_used`\n),\n\nuseage_cost as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__usage_cost`\n),\n\ndestination_mar as (\n\n    select \n        measured_month,\n        destination_id,\n        destination_name,\n        sum(free_monthly_active_rows) as free_monthly_active_rows,\n        sum(paid_monthly_active_rows) as paid_monthly_active_rows,\n        sum(total_monthly_active_rows) as total_monthly_active_rows\n    from table_mar\n    group by 1,2,3\n),\n\nusage as (\n\n    select \n        coalesce(credits_used.destination_id, useage_cost.destination_id) as destination_id,\n        credits_used.credits_spent,\n        useage_cost.dollars_spent,\n        cast(concat(coalesce(credits_used.measured_month,useage_cost.measured_month), '-01') as date) as measured_month -- match date format to join with MAR table\n    from credits_used\n    full outer join useage_cost\n        on useage_cost.measured_month = credits_used.measured_month\n        and useage_cost.destination_id = credits_used.destination_id\n),\n\njoin_usage_mar as (\n\n    select \n        destination_mar.measured_month,\n        destination_mar.destination_id,\n        destination_mar.destination_name,\n        usage.credits_spent,\n        usage.dollars_spent,\n        destination_mar.free_monthly_active_rows,\n        destination_mar.paid_monthly_active_rows,\n        destination_mar.total_monthly_active_rows,\n\n        -- credit and usage mar calculations\n        round( cast(nullif(usage.credits_spent,0) * 1000000.0 as numeric) / cast(nullif(destination_mar.total_monthly_active_rows,0) as numeric), 2) as credits_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as numeric) / cast(nullif(usage.credits_spent,0) as numeric), 0) as mar_per_credit_spent,\n        round( cast(nullif(usage.dollars_spent,0) * 1000000.0 as numeric) / cast(nullif(destination_mar.total_monthly_active_rows,0) as numeric), 2) as amount_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as numeric) / cast(nullif(usage.dollars_spent,0) as numeric), 0) as mar_per_amount_spent\n    from destination_mar \n    left join usage \n        on destination_mar.measured_month = cast(usage.measured_month as timestamp)\n        and destination_mar.destination_id = usage.destination_id\n)\n\nselect * \nfrom join_usage_mar\norder by measured_month desc", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__usage_mar_destination_history`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:13.141275Z", "completed_at": "2023-11-14T18:04:13.155542Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:13.157755Z", "completed_at": "2023-11-14T18:04:13.157759Z"}], "thread_id": "Thread-1", "execution_time": 0.023931264877319336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.not_null_fivetran_platform__audit_user_activity_log_id.db973498ba", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect log_id\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__audit_user_activity`\nwhere log_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:13.144185Z", "completed_at": "2023-11-14T18:04:13.155818Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:13.158021Z", "completed_at": "2023-11-14T18:04:13.158023Z"}], "thread_id": "Thread-4", "execution_time": 0.024039030075073242, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.unique_fivetran_platform__audit_user_activity_log_id.2662c08a2a", "compiled": true, "compiled_code": "\n    \n    \n\nwith dbt_test__target as (\n\n  select log_id as unique_field\n  from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__audit_user_activity`\n  where log_id is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:13.160060Z", "completed_at": "2023-11-14T18:04:13.166422Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:13.191681Z", "completed_at": "2023-11-14T18:04:13.191687Z"}], "thread_id": "Thread-2", "execution_time": 0.03583216667175293, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, schema_name, table_name, measured_month\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__mar_table_history`\n    group by connector_id, destination_id, schema_name, table_name, measured_month\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:13.187641Z", "completed_at": "2023-11-14T18:04:13.194288Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:13.196496Z", "completed_at": "2023-11-14T18:04:13.196501Z"}], "thread_id": "Thread-4", "execution_time": 0.03123617172241211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__schema_changelog", "compiled": true, "compiled_code": "with schema_changes as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log`\n\n    where event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n),\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__connector_status`\n),\n\nadd_connector_info as (\n\n    select \n        schema_changes.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n\n    from schema_changes join connector using(connector_id)\n),\n\nfinal as (\n\n    select\n        connector_id,\n        connector_name,\n        destination_id,\n        destination_name,\n        created_at,\n        event_subtype,\n        message_data,\n\n        case \n        when event_subtype = 'alter_table' then \n\n \n  json_extract_scalar(message_data, '$.table')\n\n \n        when event_subtype = 'create_table' then \n\n \n  json_extract_scalar(message_data, '$.name')\n\n \n        else null end as table_name,\n\n        case \n        when event_subtype = 'create_schema' or event_subtype = 'create_table' then \n\n \n  json_extract_scalar(message_data, '$.schema')\n\n \n        else null end as schema_name\n    \n    from add_connector_info\n)\n\nselect * from final\norder by created_at desc, connector_id", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__schema_changelog`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:13.197658Z", "completed_at": "2023-11-14T18:04:13.205156Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:13.205721Z", "completed_at": "2023-11-14T18:04:13.205725Z"}], "thread_id": "Thread-2", "execution_time": 0.010305166244506836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__connector_status`\n    group by connector_id, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:13.201958Z", "completed_at": "2023-11-14T18:04:13.206820Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:13.208121Z", "completed_at": "2023-11-14T18:04:13.208125Z"}], "thread_id": "Thread-4", "execution_time": 0.010675907135009766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        destination_id, measured_month\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__usage_mar_destination_history`\n    group by destination_id, measured_month\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:13.208396Z", "completed_at": "2023-11-14T18:04:13.212642Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:13.213180Z", "completed_at": "2023-11-14T18:04:13.213184Z"}], "thread_id": "Thread-2", "execution_time": 0.006512165069580078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, message_data, created_at\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__schema_changelog`\n    group by connector_id, destination_id, message_data, created_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:13.167627Z", "completed_at": "2023-11-14T18:04:14.853963Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:14.855321Z", "completed_at": "2023-11-14T18:04:14.855339Z"}], "thread_id": "Thread-3", "execution_time": 1.6913261413574219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__audit_table", "compiled": true, "compiled_code": "\n\nwith sync_log as (\n    \n    select \n        *,\n        \n\n \n  json_extract_scalar(message_data, '$.table')\n\n as table_name\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log`\n    where event_subtype in ('sync_start', 'sync_end', 'write_to_table_start', 'write_to_table_end', 'records_modified')\n\n    \n\n    -- Capture the latest timestamp in a call statement instead of a subquery for optimizing BQ costs on incremental runs-- load the result from the above query into a new variable-- the query_result is stored as a dataframe. Therefore, we want to now store it as a singular value.-- compare the new batch of data to the latest sync already stored in this model\n    and date(created_at) > '2021-12-10'\n\n    \n),\n\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__connector_status`\n),\n\nadd_connector_info as (\n\n    select \n        sync_log.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n    from sync_log \n    left join connector\n        on connector.connector_id = sync_log.connector_id\n),\n\nsync_timestamps as (\n\n    select\n        connector_id,\n        connector_name,\n        table_name,\n        event_subtype,\n        destination_id,\n        destination_name,\n        created_at as write_to_table_start,\n        min(case when event_subtype = 'write_to_table_end' then created_at else null end) \n            over (partition by connector_id, table_name order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as write_to_table_end,\n\n        max(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between UNBOUNDED PRECEDING and CURRENT ROW) as sync_start,\n\n        min(case when event_subtype = 'sync_end' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as sync_end, -- coalesce with next_sync_start\n\n        min(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as next_sync_start\n    from add_connector_info\n),\n\n-- this will be the base for every record in the final CTE\nlimit_to_table_starts as (\n\n    select *\n    from sync_timestamps \n    where event_subtype = 'write_to_table_start'\n),\n\nrecords_modified_log as (\n\n    select \n        connector_id,\n        created_at,\n        \n\n \n  json_extract_scalar(message_data, '$.table')\n\n as table_name,\n        \n\n \n  json_extract_scalar(message_data, '$.schema')\n\n as schema_name,\n        \n\n \n  json_extract_scalar(message_data, '$.operationType')\n\n as operation_type,\n        cast (\n\n \n  json_extract_scalar(message_data, '$.count')\n\n as INT64) as row_count\n    from sync_log \n    where event_subtype = 'records_modified'\n\n),\n\nsum_records_modified as (\n\n    select\n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name) as schema_name,\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end as sync_end,\n        sum(case when records_modified_log.operation_type = 'REPLACED_OR_INSERTED' then records_modified_log.row_count else 0 end) as sum_rows_replaced_or_inserted,\n        sum(case when records_modified_log.operation_type = 'UPDATED' then records_modified_log.row_count else 0 end) as sum_rows_updated,\n        sum(case when records_modified_log.operation_type = 'DELETED' then records_modified_log.row_count else 0 end) as sum_rows_deleted\n    from limit_to_table_starts\n    left join records_modified_log on \n        limit_to_table_starts.connector_id = records_modified_log.connector_id\n        and limit_to_table_starts.table_name = records_modified_log.table_name\n\n        -- confine it to one sync\n        and records_modified_log.created_at > limit_to_table_starts.sync_start \n        and records_modified_log.created_at < coalesce(limit_to_table_starts.sync_end, limit_to_table_starts.next_sync_start) \n\n    group by 1,2,3,4,5,6,7,8,9,10\n),\n\nfinal as (\n\n    select \n        *,\n        to_hex(md5(cast(coalesce(cast(schema_name as string), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(connector_id as string), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(destination_id as string), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(table_name as string), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(write_to_table_start as string), '_dbt_utils_surrogate_key_null_') as string))) as unique_table_sync_key, -- for incremental materialization \n        timestamp_trunc(\n        cast(sync_start as timestamp),\n        day\n    ) as sync_start_day -- for partitioning in databricks\n    from sum_records_modified\n)\n\nselect *\nfrom final", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__audit_table`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:14.868737Z", "completed_at": "2023-11-14T18:04:14.874675Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:14.876460Z", "completed_at": "2023-11-14T18:04:14.876469Z"}], "thread_id": "Thread-2", "execution_time": 0.017674922943115234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7", "compiled": true, "compiled_code": "\n    \n    \n\nwith dbt_test__target as (\n\n  select unique_table_sync_key as unique_field\n  from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__audit_table`\n  where unique_table_sync_key is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:14.861698Z", "completed_at": "2023-11-14T18:04:14.875192Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:14.876904Z", "completed_at": "2023-11-14T18:04:14.876910Z"}], "thread_id": "Thread-4", "execution_time": 0.01937413215637207, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect unique_table_sync_key\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__audit_table`\nwhere unique_table_sync_key is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:13.179994Z", "completed_at": "2023-11-14T18:04:15.801791Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:15.803195Z", "completed_at": "2023-11-14T18:04:15.803216Z"}], "thread_id": "Thread-1", "execution_time": 2.6387901306152344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__connector_daily_events", "compiled": true, "compiled_code": "-- depends_on: `dbt-package-testing`.`fivetran_platform_integration_tests_1`.`connector`\n\nwith connector as (\n    \n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__connector_status`\n),\n\n-- grab api calls, schema changes, and record modifications\nlog_events as (\n\n    select \n        connector_id,\n        cast( timestamp_trunc(\n        cast(created_at as timestamp),\n        day\n    ) as date) as date_day,\n        case \n            when event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config') then 'schema_change' \n            else event_subtype end as event_subtype,\n\n        sum(case when event_subtype = 'records_modified' then cast( \n\n \n  json_extract_scalar(message_data, '$.count')\n\n as INT64 )\n        else 1 end) as count_events \n\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`stg_fivetran_platform__log`\n\n    where event_subtype in ('api_call', \n                            'records_modified', \n                            'create_table', 'alter_table', 'create_schema', 'change_schema_config') -- all schema changes\n                            \n        and connector_id is not null\n\n    group by 1,2,3\n),\n\npivot_out_events as (\n\n    select\n        connector_id,\n        date_day,\n        max(case when event_subtype = 'api_call' then count_events else 0 end) as count_api_calls,\n        max(case when event_subtype = 'records_modified' then count_events else 0 end) as count_record_modifications,\n        max(case when event_subtype = 'schema_change' then count_events else 0 end) as count_schema_changes\n\n    from log_events\n    group by 1,2\n),\n\nconnector_event_counts as (\n\n    select\n        pivot_out_events.date_day,\n        pivot_out_events.count_api_calls,\n        pivot_out_events.count_record_modifications,\n        pivot_out_events.count_schema_changes,\n        connector.connector_name,\n        connector.connector_id,\n        connector.connector_type,\n        connector.destination_name,\n        connector.destination_id,\n        connector.set_up_at\n    from\n    connector left join pivot_out_events \n        on pivot_out_events.connector_id = connector.connector_id\n),\n\nspine as (\n\n    \n    \n    \n    \n    \n\n    \n\n\n\n\n\nwith rawdata as (\n\n    \n\n    \n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    \n    p0.generated_number * power(2, 0)\n     + \n    \n    p1.generated_number * power(2, 1)\n     + \n    \n    p2.generated_number * power(2, 2)\n     + \n    \n    p3.generated_number * power(2, 3)\n     + \n    \n    p4.generated_number * power(2, 4)\n     + \n    \n    p5.generated_number * power(2, 5)\n     + \n    \n    p6.generated_number * power(2, 6)\n     + \n    \n    p7.generated_number * power(2, 7)\n     + \n    \n    p8.generated_number * power(2, 8)\n     + \n    \n    p9.generated_number * power(2, 9)\n     + \n    \n    p10.generated_number * power(2, 10)\n    \n    \n    + 1\n    as generated_number\n\n    from\n\n    \n    p as p0\n     cross join \n    \n    p as p1\n     cross join \n    \n    p as p2\n     cross join \n    \n    p as p3\n     cross join \n    \n    p as p4\n     cross join \n    \n    p as p5\n     cross join \n    \n    p as p6\n     cross join \n    \n    p as p7\n     cross join \n    \n    p as p8\n     cross join \n    \n    p as p9\n     cross join \n    \n    p as p10\n    \n    \n\n    )\n\n    select *\n    from unioned\n    where generated_number <= 1705\n    order by generated_number\n\n\n\n),\n\nall_periods as (\n\n    select (\n        \n\n        datetime_add(\n            cast( cast('2019-03-22' as date) as datetime),\n        interval row_number() over (order by 1) - 1 day\n        )\n\n\n    ) as date_day\n    from rawdata\n\n),\n\nfiltered as (\n\n    select *\n    from all_periods\n    where date_day <= \n\n        datetime_add(\n            cast( timestamp_trunc(\n        cast(current_timestamp as timestamp),\n        day\n    ) as datetime),\n        interval 1 week\n        )\n\n\n\n)\n\nselect * from filtered\n\n \n),\n\nconnector_event_history as (\n\n    select\n        cast(spine.date_day as date) as date_day,\n        connector_event_counts.connector_name,\n        connector_event_counts.connector_id,\n        connector_event_counts.connector_type,\n        connector_event_counts.destination_name,\n        connector_event_counts.destination_id,\n        max(case \n            when cast(spine.date_day as date) = connector_event_counts.date_day then connector_event_counts.count_api_calls\n            else 0\n        end) as count_api_calls,\n        max(case \n            when cast(spine.date_day as date) = connector_event_counts.date_day then connector_event_counts.count_record_modifications\n            else 0\n        end) as count_record_modifications,\n        max(case \n            when cast(spine.date_day as date) = connector_event_counts.date_day then connector_event_counts.count_schema_changes\n            else 0\n        end) as count_schema_changes\n    from\n    spine join connector_event_counts\n        on spine.date_day  >= cast( timestamp_trunc(\n        cast(connector_event_counts.set_up_at as timestamp),\n        day\n    ) as date)\n\n    group by 1,2,3,4,5,6\n),\n\n-- now rejoin spine to get a complete calendar\njoin_event_history as (\n    \n    select\n        spine.date_day,\n        connector_event_history.connector_name,\n        connector_event_history.connector_id,\n        connector_event_history.connector_type,\n        connector_event_history.destination_name,\n        connector_event_history.destination_id,\n        max(connector_event_history.count_api_calls) as count_api_calls,\n        max(connector_event_history.count_record_modifications) as count_record_modifications,\n        max(connector_event_history.count_schema_changes) as count_schema_changes\n\n    from\n    spine left join connector_event_history\n        on cast(spine.date_day as date) = connector_event_history.date_day\n\n    group by 1,2,3,4,5,6\n),\n\nfinal as (\n\n    select *\n    from join_event_history\n\n    where cast(date_day as timestamp) <= current_timestamp\n\n    order by date_day desc\n)\n\nselect *\nfrom final", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__connector_daily_events`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-11-14T18:04:15.808514Z", "completed_at": "2023-11-14T18:04:15.816963Z"}, {"name": "execute", "started_at": "2023-11-14T18:04:15.817946Z", "completed_at": "2023-11-14T18:04:15.817954Z"}], "thread_id": "Thread-3", "execution_time": 0.012108087539672852, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, date_day\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_1_fivetran_platform`.`fivetran_platform__connector_daily_events`\n    group by connector_id, destination_id, date_day\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}], "elapsed_time": 4.363950729370117, "args": {"empty_catalog": false, "exclude": [], "log_level": "info", "log_file_max_bytes": 10485760, "project_dir": "/Users/jamie.rodriguez/Desktop/dbt_repos/jamie_dbt_dev/dbt_packages/fivetran_log/integration_tests", "printer_width": 80, "warn_error_options": {"include": [], "exclude": []}, "select": [], "log_level_file": "debug", "use_colors_file": true, "favor_state": false, "use_colors": true, "enable_legacy_logger": false, "macro_debugging": false, "show_resource_report": false, "print": true, "profiles_dir": "/Users/jamie.rodriguez/.dbt", "populate_cache": true, "invocation_command": "dbt docs generate", "defer": false, "introspect": true, "compile": true, "partial_parse": true, "static_parser": true, "send_anonymous_usage_stats": true, "vars": {}, "version_check": true, "write_json": true, "log_format": "default", "quiet": false, "static": false, "log_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/jamie_dbt_dev/dbt_packages/fivetran_log/integration_tests/logs", "strict_mode": false, "partial_parse_file_diff": true, "which": "generate", "log_format_file": "debug", "indirect_selection": "eager", "cache_selected_only": false}}
\ No newline at end of file
+{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v5.json", "dbt_version": "1.7.3", "generated_at": "2023-12-12T19:08:32.891443Z", "invocation_id": "c0fa594b-cab7-478a-aeb0-a325788070ef", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.583275Z", "completed_at": "2023-12-12T19:08:29.596288Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.597120Z", "completed_at": "2023-12-12T19:08:29.597133Z"}], "thread_id": "Thread-1", "execution_time": 0.016467809677124023, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__account", "compiled": true, "compiled_code": "with base as (\n    \n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.account\n),\n\nfields as (\n\n    select\n        id as account_id,\n        country,\n        cast(created_at as timestamp) as created_at,\n        name as account_name,\n        status\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__account"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.599824Z", "completed_at": "2023-12-12T19:08:29.604343Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.605132Z", "completed_at": "2023-12-12T19:08:29.605138Z"}], "thread_id": "Thread-1", "execution_time": 0.0069370269775390625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__connector_tmp", "compiled": true, "compiled_code": "select *\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.connector", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.607589Z", "completed_at": "2023-12-12T19:08:29.615707Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.616388Z", "completed_at": "2023-12-12T19:08:29.616395Z"}], "thread_id": "Thread-1", "execution_time": 0.010297775268554688, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__credits_used", "compiled": true, "compiled_code": "\n\nwith base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.credits_used\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        credits_consumed as credits_spent\n    from base\n)\n\nselect * \nfrom fields\n\n", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__credits_used"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.618679Z", "completed_at": "2023-12-12T19:08:29.622466Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.623073Z", "completed_at": "2023-12-12T19:08:29.623078Z"}], "thread_id": "Thread-1", "execution_time": 0.005653858184814453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__destination", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.destination\n),\n\nfields as (\n\n    select\n        id as destination_id,\n        account_id,\n        cast(created_at as timestamp) as created_at,\n        name as destination_name,\n        region\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.625052Z", "completed_at": "2023-12-12T19:08:29.629175Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.629747Z", "completed_at": "2023-12-12T19:08:29.629751Z"}], "thread_id": "Thread-1", "execution_time": 0.005950212478637695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__destination_membership", "compiled": true, "compiled_code": "\n\nwith base as (\n    \n    select * from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.destination_membership\n),\n\nfields as (\n\n    select\n        destination_id,\n        user_id,\n        cast(activated_at as timestamp) as activated_at,\n        cast(joined_at as timestamp) as joined_at,\n        role as destination_role\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination_membership"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.631597Z", "completed_at": "2023-12-12T19:08:29.635190Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.635757Z", "completed_at": "2023-12-12T19:08:29.635762Z"}], "thread_id": "Thread-1", "execution_time": 0.005378007888793945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__incremental_mar", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.incremental_mar\n),\n\nfields as (\n\n    select\n        connector_id as connector_name,\n        destination_id,\n        free_type,\n        cast(measured_date as timestamp) as measured_date,\n        schema_name,\n        sync_type,\n        table_name,\n        updated_at,\n        _fivetran_synced,\n        incremental_rows\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__incremental_mar"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.637571Z", "completed_at": "2023-12-12T19:08:29.640593Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.641133Z", "completed_at": "2023-12-12T19:08:29.641139Z"}], "thread_id": "Thread-1", "execution_time": 0.004690885543823242, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__log_tmp", "compiled": true, "compiled_code": "select *\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.log", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.642917Z", "completed_at": "2023-12-12T19:08:29.647520Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.648054Z", "completed_at": "2023-12-12T19:08:29.648059Z"}], "thread_id": "Thread-1", "execution_time": 0.006251096725463867, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__usage_cost", "compiled": true, "compiled_code": "\nwith base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.usage_cost\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        amount as dollars_spent\n    from base\n)\n\nselect * \nfrom fields\n\n", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__usage_cost"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.649748Z", "completed_at": "2023-12-12T19:08:29.653285Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.653815Z", "completed_at": "2023-12-12T19:08:29.653820Z"}], "thread_id": "Thread-1", "execution_time": 0.00515294075012207, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__user", "compiled": true, "compiled_code": "\n\nwith base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.user\n),\n\nfields as (\n\n    select\n        id as user_id,\n        cast(created_at as timestamp) as created_at,\n        email,\n        email_disabled as has_disabled_email_notifications,\n        family_name as last_name,\n        given_name as first_name,\n        phone,\n        verified as is_verified\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__user"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.655632Z", "completed_at": "2023-12-12T19:08:29.657197Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.657937Z", "completed_at": "2023-12-12T19:08:29.657946Z"}], "thread_id": "Thread-1", "execution_time": 0.0037610530853271484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.account", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.659975Z", "completed_at": "2023-12-12T19:08:29.661369Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.661999Z", "completed_at": "2023-12-12T19:08:29.662005Z"}], "thread_id": "Thread-1", "execution_time": 0.003264904022216797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.connector", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.663981Z", "completed_at": "2023-12-12T19:08:29.665987Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.666537Z", "completed_at": "2023-12-12T19:08:29.666542Z"}], "thread_id": "Thread-1", "execution_time": 0.0037810802459716797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.credits_used", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.668142Z", "completed_at": "2023-12-12T19:08:29.669323Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.669837Z", "completed_at": "2023-12-12T19:08:29.669841Z"}], "thread_id": "Thread-1", "execution_time": 0.0027382373809814453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.destination", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.671560Z", "completed_at": "2023-12-12T19:08:29.672852Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.673431Z", "completed_at": "2023-12-12T19:08:29.673435Z"}], "thread_id": "Thread-1", "execution_time": 0.0030248165130615234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.destination_membership", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.675410Z", "completed_at": "2023-12-12T19:08:29.676786Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.677317Z", "completed_at": "2023-12-12T19:08:29.677322Z"}], "thread_id": "Thread-1", "execution_time": 0.0032188892364501953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.incremental_mar", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.678940Z", "completed_at": "2023-12-12T19:08:29.680184Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.680661Z", "completed_at": "2023-12-12T19:08:29.680665Z"}], "thread_id": "Thread-1", "execution_time": 0.00272369384765625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.log", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.682192Z", "completed_at": "2023-12-12T19:08:29.684052Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.684555Z", "completed_at": "2023-12-12T19:08:29.684561Z"}], "thread_id": "Thread-1", "execution_time": 0.0034568309783935547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.usage_cost", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.686240Z", "completed_at": "2023-12-12T19:08:29.687484Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.688000Z", "completed_at": "2023-12-12T19:08:29.688004Z"}], "thread_id": "Thread-1", "execution_time": 0.002780914306640625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.user", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.689570Z", "completed_at": "2023-12-12T19:08:29.697474Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.697983Z", "completed_at": "2023-12-12T19:08:29.697987Z"}], "thread_id": "Thread-1", "execution_time": 0.009428024291992188, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect account_id\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__account\nwhere account_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.699648Z", "completed_at": "2023-12-12T19:08:29.703938Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.704438Z", "completed_at": "2023-12-12T19:08:29.704442Z"}], "thread_id": "Thread-1", "execution_time": 0.00582122802734375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc", "compiled": true, "compiled_code": "\n    \n    \n\nselect\n    account_id as unique_field,\n    count(*) as n_records\n\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__account\nwhere account_id is not null\ngroup by account_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.706035Z", "completed_at": "2023-12-12T19:08:30.181914Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:30.182785Z", "completed_at": "2023-12-12T19:08:30.182793Z"}], "thread_id": "Thread-1", "execution_time": 0.5884549617767334, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__connector", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector_tmp\n),\n\nfields as (\n    select\n        \n    cast(null as boolean) as \n    \n    _fivetran_deleted\n    \n , \n    \n    \n    _fivetran_synced\n    \n as \n    \n    _fivetran_synced\n    \n, \n    \n    \n    connecting_user_id\n    \n as \n    \n    connecting_user_id\n    \n, \n    \n    \n    connector_id\n    \n as \n    \n    connector_id\n    \n, \n    \n    \n    connector_name\n    \n as \n    \n    connector_name\n    \n, \n    \n    \n    connector_type\n    \n as \n    \n    connector_type\n    \n, \n    cast(null as TEXT) as \n    \n    connector_type_id\n    \n , \n    \n    \n    destination_id\n    \n as \n    \n    destination_id\n    \n, \n    \n    \n    paused\n    \n as \n    \n    paused\n    \n, \n    cast(null as integer) as \n    \n    service_version\n    \n , \n    \n    \n    signed_up\n    \n as \n    \n    signed_up\n    \n\n\n\n        ,row_number() over ( partition by connector_name, destination_id order by _fivetran_synced desc ) as nth_last_record\n    from base\n),\n\nfinal as (\n\n    select \n        connector_id,\n        connector_name,\n        coalesce(connector_type_id, connector_type) as connector_type,\n        destination_id,\n        connecting_user_id,\n        paused as is_paused,\n        signed_up as set_up_at\n    from fields\n\n    -- Only look at the most recent one\n    where nth_last_record = 1\n)\n\nselect * \nfrom final", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:30.297083Z", "completed_at": "2023-12-12T19:08:30.309610Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:30.310462Z", "completed_at": "2023-12-12T19:08:30.310469Z"}], "thread_id": "Thread-1", "execution_time": 0.01565098762512207, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        measured_month, destination_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__credits_used\n    group by measured_month, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:30.313185Z", "completed_at": "2023-12-12T19:08:30.318491Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:30.319211Z", "completed_at": "2023-12-12T19:08:30.319216Z"}], "thread_id": "Thread-1", "execution_time": 0.007678031921386719, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect destination_id\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\nwhere destination_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:30.321551Z", "completed_at": "2023-12-12T19:08:30.325638Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:30.326315Z", "completed_at": "2023-12-12T19:08:30.326321Z"}], "thread_id": "Thread-1", "execution_time": 0.006234884262084961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed", "compiled": true, "compiled_code": "\n    \n    \n\nselect\n    destination_id as unique_field,\n    count(*) as n_records\n\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\nwhere destination_id is not null\ngroup by destination_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:30.328476Z", "completed_at": "2023-12-12T19:08:30.332995Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:30.333612Z", "completed_at": "2023-12-12T19:08:30.333617Z"}], "thread_id": "Thread-1", "execution_time": 0.006437778472900391, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        destination_id, user_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination_membership\n    group by destination_id, user_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:30.335526Z", "completed_at": "2023-12-12T19:08:30.852282Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:30.853331Z", "completed_at": "2023-12-12T19:08:30.853348Z"}], "thread_id": "Thread-1", "execution_time": 0.6241931915283203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__log", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log_tmp\n),\n\nfields as (\n    select\n        \n    \n    \n    _fivetran_synced\n    \n as \n    \n    _fivetran_synced\n    \n, \n    \n    \n    connector_id\n    \n as \n    \n    connector_id\n    \n, \n    \n    \n    event\n    \n as \n    \n    event\n    \n, \n    \n    \n    id\n    \n as \n    \n    id\n    \n, \n    \n    \n    message_data\n    \n as \n    \n    message_data\n    \n, \n    \n    \n    message_event\n    \n as \n    \n    message_event\n    \n, \n    \n    \n    sync_id\n    \n as \n    \n    sync_id\n    \n, \n    \n    \n    time_stamp\n    \n as \n    \n    time_stamp\n    \n, \n    \n    \n    transformation_id\n    \n as \n    \n    transformation_id\n    \n\n\n\n    from base\n),\n\nfinal as (\n\n    select\n        id as log_id, \n        sync_id,\n        cast(time_stamp as timestamp) as created_at,\n        connector_id, -- Note: the connector_id column used to erroneously equal the connector_name, NOT its id.\n        case when transformation_id is not null and event is null then 'TRANSFORMATION'\n        else event end as event_type, \n        message_data,\n        case \n        when transformation_id is not null and message_data like '%has succeeded%' then 'transformation run success'\n        when transformation_id is not null and message_data like '%has failed%' then 'transformation run failed'\n        else message_event end as event_subtype,\n        transformation_id\n    from fields\n)\n\nselect * \nfrom final", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:30.963549Z", "completed_at": "2023-12-12T19:08:30.972244Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:30.973344Z", "completed_at": "2023-12-12T19:08:30.973353Z"}], "thread_id": "Thread-1", "execution_time": 0.012953042984008789, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        measured_month, destination_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__usage_cost\n    group by measured_month, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:30.976632Z", "completed_at": "2023-12-12T19:08:30.982543Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:30.983388Z", "completed_at": "2023-12-12T19:08:30.983394Z"}], "thread_id": "Thread-1", "execution_time": 0.008631229400634766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect user_id\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__user\nwhere user_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:30.985990Z", "completed_at": "2023-12-12T19:08:30.990905Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:30.991611Z", "completed_at": "2023-12-12T19:08:30.991617Z"}], "thread_id": "Thread-1", "execution_time": 0.0071811676025390625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9", "compiled": true, "compiled_code": "\n    \n    \n\nselect\n    user_id as unique_field,\n    count(*) as n_records\n\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__user\nwhere user_id is not null\ngroup by user_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:30.993932Z", "completed_at": "2023-12-12T19:08:31.000774Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:31.001429Z", "completed_at": "2023-12-12T19:08:31.001435Z"}], "thread_id": "Thread-1", "execution_time": 0.008944988250732422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__mar_table_history", "compiled": true, "compiled_code": "with incremental_mar as (\n\n    select\n        *,\n        date_trunc('month', measured_date) as measured_month\n\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__incremental_mar\n),\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector\n),\n\ndestination as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\n),\n\nordered_mar as (\n\n    select\n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        max(measured_date) as last_measured_at,\n        sum(incremental_rows) as incremental_rows,\n        sum(coalesce(case when lower(free_type) = 'paid'\n            then incremental_rows\n        end, 0)) as paid_monthly_active_rows,\n        sum(coalesce(case when lower(free_type) != 'paid'\n            then incremental_rows\n        end, 0)) as free_monthly_active_rows\n\n    from incremental_mar\n    group by connector_name, schema_name, table_name, destination_id, measured_month\n),\n\nlatest_mar as (\n    select \n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        cast(last_measured_at as date) as last_measured_at,\n        free_monthly_active_rows,\n        paid_monthly_active_rows,\n        (free_monthly_active_rows + paid_monthly_active_rows) as total_monthly_active_rows\n\n    from ordered_mar\n),\n\nmar_join as (\n\n    select\n        latest_mar.*,\n        connector.connector_type,\n        connector.connector_id,\n        destination.destination_name\n\n    from latest_mar\n    join connector\n        on latest_mar.connector_name = connector.connector_name\n        and latest_mar.destination_id = connector.destination_id\n    join destination on latest_mar.destination_id = destination.destination_id\n)\n\nselect * from mar_join\n -- can't order CTEs in sqlserver\norder by measured_month desc, destination_id, connector_name\n", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__mar_table_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:31.003631Z", "completed_at": "2023-12-12T19:08:31.008119Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:31.008761Z", "completed_at": "2023-12-12T19:08:31.008766Z"}], "thread_id": "Thread-1", "execution_time": 0.0064868927001953125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_name, destination_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector\n    group by connector_name, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:31.010675Z", "completed_at": "2023-12-12T19:08:31.022245Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:31.022815Z", "completed_at": "2023-12-12T19:08:31.022820Z"}], "thread_id": "Thread-1", "execution_time": 0.01335287094116211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__audit_user_activity", "compiled": true, "compiled_code": "with logs as (\n\n    select \n        *,\n        \n\n  parse_json( message_data )['actor'] as actor_email\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n),\n\nuser_logs as (\n\n    select *\n    from logs\n    where actor_email is not null \n        and lower(actor_email) != 'fivetran'\n),\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector\n),\n\ndestination as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\n),\nusers as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__user\n),\n    destination_membership as (\n\n        select *\n        from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination_membership\n    ),\n    final as (\n\n    select\n        date_trunc('day', user_logs.created_at) as date_day,\n        \n        dayname(user_logs.created_at) as day_name,\n            date_part('day', user_logs.created_at) as day_of_month,\n        user_logs.created_at as occurred_at,\n        destination.destination_name,\n        destination.destination_id,\n        connector.connector_name,\n        connector.connector_id,\n        user_logs.actor_email as email,\n        users.first_name,\n        users.last_name,\n        users.user_id,\n        destination_membership.destination_role,\n    user_logs.event_type, -- should always be INFO for user-triggered actions but include just in case\n        user_logs.event_subtype,\n        user_logs.message_data,\n        user_logs.log_id\n\n    from user_logs\n    left join connector\n        on user_logs.connector_id = connector.connector_id\n    left join destination\n        on connector.destination_id = destination.destination_id\n    left join users \n        on lower(users.email) = lower(user_logs.actor_email)\n    left join destination_membership\n        on destination.destination_id = destination_membership.destination_id\n        and users.user_id = destination_membership.user_id\n\n    )\n\nselect *\nfrom final", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_user_activity"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:31.024698Z", "completed_at": "2023-12-12T19:08:31.037061Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:31.037576Z", "completed_at": "2023-12-12T19:08:31.037581Z"}], "thread_id": "Thread-1", "execution_time": 0.014023780822753906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__connector_status", "compiled": true, "compiled_code": "with transformation_removal as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n    where transformation_id is null\n\n),\n\nconnector_log as (\n    select \n        *,\n        sum( case when event_subtype in ('sync_start') then 1 else 0 end) over ( partition by connector_id \n            order by created_at rows unbounded preceding) as sync_batch_id\n    from transformation_removal\n    -- only looking at errors, warnings, and syncs here\n    where event_type = 'SEVERE'\n        or event_type = 'WARNING'\n        or event_subtype like 'sync%'\n        or (event_subtype = 'status' \n            and \n\n  parse_json( message_data )['status'] = 'RESCHEDULED'\n            \n            and \n\n  parse_json( message_data )['reason'] like '%intended behavior%'\n            ) -- for priority-first syncs. these should be captured by event_type = 'WARNING' but let's make sure\n        or (event_subtype = 'status' \n            and \n\n  parse_json( message_data )['status'] = 'SUCCESSFUL'\n        )\n        -- whole reason is \"We have rescheduled the connector to force flush data from the forward sync into your destination. This is intended behavior and means that the connector is working as expected.\"\n),\n\nschema_changes as (\n\n    select\n        connector_id,\n        count(*) as number_of_schema_changes_last_month\n\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n\n    where \n        datediff(\n        day,\n        created_at,\n        \n  current_timestamp::timestamp\n\n        ) <= 30\n        and event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n\n    group by connector_id\n\n),\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector\n\n),\n\ndestination as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\n),\n\nconnector_metrics as (\n\n    select\n        connector.connector_id,\n        connector.connector_name,\n        connector.connector_type,\n        connector.destination_id,\n        connector.is_paused,\n        connector.set_up_at,\n        max(case when connector_log.event_subtype = 'sync_start' then connector_log.created_at else null end) as last_sync_started_at,\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.created_at else null end) as last_sync_completed_at,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and \n\n  parse_json( connector_log.message_data )['status'] ='SUCCESSFUL'\n            then connector_log.created_at else null end) as last_successful_sync_completed_at,\n\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.sync_batch_id else null end) as last_sync_batch_id,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and \n\n  parse_json( connector_log.message_data )['status'] ='RESCHEDULED'\n                and \n\n  parse_json( connector_log.message_data )['reason'] like '%intended behavior%'\n            then connector_log.created_at else null end) as last_priority_first_sync_completed_at,\n                \n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.created_at else null end) as last_error_at,\n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.sync_batch_id else null end) as last_error_batch,\n        max(case when event_type = 'WARNING' then connector_log.created_at else null end) as last_warning_at\n\n    from connector \n    left join connector_log \n        on connector_log.connector_id = connector.connector_id\n    group by connector.connector_id, connector.connector_name, connector.connector_type, connector.destination_id, connector.is_paused, connector.set_up_at\n),\n\nconnector_health_status as (\n\n    select\n        *,\n        case \n            -- connector is paused\n            when is_paused  then 'paused'\n\n            -- a sync has never been attempted\n            when last_sync_started_at is null then 'incomplete'\n\n            -- a priority-first sync has occurred, but a normal sync has not\n            when last_priority_first_sync_completed_at is not null and last_sync_completed_at is null then 'priority first sync'\n\n            -- a priority sync has occurred more recently than a normal one (may occurr if the connector has been paused and resumed)\n            when last_priority_first_sync_completed_at > last_sync_completed_at then 'priority first sync'\n\n            -- a sync has been attempted, but not completed, and it's not due to errors. also a priority-first sync hasn't\n            when last_sync_completed_at is null and last_error_at is null then 'initial sync in progress'\n\n            -- the last attempted sync had an error\n            when last_sync_batch_id = last_error_batch then 'broken'\n\n            -- there's never been a successful sync and there have been errors\n            when last_sync_completed_at is null and last_error_at is not null then 'broken'\n\n        else 'connected' end as connector_health\n\n    from connector_metrics\n),\n\n-- Joining with log to grab pertinent error/warning messagees\nconnector_recent_logs as (\n\n    select \n        connector_health_status.connector_id,\n        connector_health_status.connector_name,\n        connector_health_status.connector_type,\n        connector_health_status.destination_id,\n        connector_health_status.connector_health,\n        connector_health_status.last_successful_sync_completed_at,\n        connector_health_status.last_sync_started_at,\n        connector_health_status.last_sync_completed_at,\n        connector_health_status.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n    from connector_health_status \n    left join connector_log \n        on connector_log.connector_id = connector_health_status.connector_id\n        -- limiting relevance to since the last successful sync completion (if there has been one)\n        and connector_log.created_at > coalesce(connector_health_status.last_sync_completed_at, connector_health_status.last_priority_first_sync_completed_at, '2000-01-01') \n        -- only looking at errors and warnings (excluding syncs - both normal and priority first)\n        and connector_log.event_type != 'INFO' \n        -- need to explicitly avoid priority first statuses because they are of event_type WARNING\n        and not (connector_log.event_subtype = 'status' \n            and \n\n  parse_json( connector_log.message_data )['status'] ='RESCHEDULED'\n            and \n\n  parse_json( connector_log.message_data )['reason'] like '%intended behavior%')\n\n    group by -- remove duplicates\n        connector_health_status.connector_id,\n        connector_health_status.connector_name,\n        connector_health_status.connector_type,\n        connector_health_status.destination_id,\n        connector_health_status.connector_health,\n        connector_health_status.last_successful_sync_completed_at,\n        connector_health_status.last_sync_started_at,\n        connector_health_status.last_sync_completed_at,\n        connector_health_status.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n),\n\nfinal as (\n\n    select\n        connector_recent_logs.connector_id,\n        connector_recent_logs.connector_name,\n        connector_recent_logs.connector_type,\n        connector_recent_logs.destination_id,\n        destination.destination_name,\n        connector_recent_logs.connector_health,\n        connector_recent_logs.last_successful_sync_completed_at,\n        connector_recent_logs.last_sync_started_at,\n        connector_recent_logs.last_sync_completed_at,\n        connector_recent_logs.set_up_at,\n        coalesce(schema_changes.number_of_schema_changes_last_month, 0) as number_of_schema_changes_last_month\n        \n        \n        , \n    listagg(case when connector_recent_logs.event_type = 'SEVERE' then connector_recent_logs.message_data else null end, '\\n')\n\n as errors_since_last_completed_sync\n        , \n    listagg(case when connector_recent_logs.event_type = 'WARNING' then connector_recent_logs.message_data else null end, '\\n')\n\n as warnings_since_last_completed_sync\n        \n\n    from connector_recent_logs\n    left join schema_changes \n        on connector_recent_logs.connector_id = schema_changes.connector_id \n\n    join destination on destination.destination_id = connector_recent_logs.destination_id\n    group by \n        connector_recent_logs.connector_id, \n        connector_recent_logs.connector_name, \n        connector_recent_logs.connector_type, \n        connector_recent_logs.destination_id, \n        destination.destination_name, \n        connector_recent_logs.connector_health, \n        connector_recent_logs.last_successful_sync_completed_at, \n        connector_recent_logs.last_sync_started_at, \n        connector_recent_logs.last_sync_completed_at, \n        connector_recent_logs.set_up_at, \n        number_of_schema_changes_last_month\n)\n\nselect * from final", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:31.039340Z", "completed_at": "2023-12-12T19:08:31.043914Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:31.044436Z", "completed_at": "2023-12-12T19:08:31.044440Z"}], "thread_id": "Thread-1", "execution_time": 0.006209135055541992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        log_id, created_at\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n    group by log_id, created_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:31.046068Z", "completed_at": "2023-12-12T19:08:31.052140Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:31.052644Z", "completed_at": "2023-12-12T19:08:31.052648Z"}], "thread_id": "Thread-1", "execution_time": 0.007603883743286133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__usage_mar_destination_history", "compiled": true, "compiled_code": "with table_mar as (\n    \n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__mar_table_history\n),\n\ncredits_used as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__credits_used\n),\n\nuseage_cost as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__usage_cost\n),\n\ndestination_mar as (\n\n    select \n        cast(measured_month as date) as measured_month,\n        destination_id,\n        destination_name,\n        sum(free_monthly_active_rows) as free_monthly_active_rows,\n        sum(paid_monthly_active_rows) as paid_monthly_active_rows,\n        sum(total_monthly_active_rows) as total_monthly_active_rows\n    from table_mar\n    group by measured_month, destination_id, destination_name\n),\n\nusage as (\n\n    select \n        coalesce(credits_used.destination_id, useage_cost.destination_id) as destination_id,\n        credits_used.credits_spent,\n        useage_cost.dollars_spent,\n        cast(concat(coalesce(credits_used.measured_month,useage_cost.measured_month), '-01') as date) as measured_month -- match date format to join with MAR table\n    from credits_used\n    full outer join useage_cost\n        on useage_cost.measured_month = credits_used.measured_month\n        and useage_cost.destination_id = credits_used.destination_id\n),\n\njoin_usage_mar as (\n\n    select \n        destination_mar.measured_month,\n        destination_mar.destination_id,\n        destination_mar.destination_name,\n        usage.credits_spent,\n        usage.dollars_spent,\n        destination_mar.free_monthly_active_rows,\n        destination_mar.paid_monthly_active_rows,\n        destination_mar.total_monthly_active_rows,\n\n        -- credit and usage mar calculations\n        round( cast(nullif(usage.credits_spent,0) * 1000000.0 as numeric(28,6)) / cast(nullif(destination_mar.total_monthly_active_rows,0) as numeric(28,6)), 2) as credits_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as numeric(28,6)) / cast(nullif(usage.credits_spent,0) as numeric(28,6)), 0) as mar_per_credit_spent,\n        round( cast(nullif(usage.dollars_spent,0) * 1000000.0 as numeric(28,6)) / cast(nullif(destination_mar.total_monthly_active_rows,0) as numeric(28,6)), 2) as amount_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as numeric(28,6)) / cast(nullif(usage.dollars_spent,0) as numeric(28,6)), 0) as mar_per_amount_spent\n    from destination_mar \n    left join usage \n        on destination_mar.measured_month = cast(usage.measured_month as date)\n        and destination_mar.destination_id = usage.destination_id\n)\n\nselect * \nfrom join_usage_mar\n -- sql server doesn't support ordering CTEs\norder by measured_month desc\n", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__usage_mar_destination_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:31.054317Z", "completed_at": "2023-12-12T19:08:31.058350Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:31.058877Z", "completed_at": "2023-12-12T19:08:31.058881Z"}], "thread_id": "Thread-1", "execution_time": 0.005629301071166992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, schema_name, table_name, measured_month\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__mar_table_history\n    group by connector_id, destination_id, schema_name, table_name, measured_month\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:31.060509Z", "completed_at": "2023-12-12T19:08:31.063954Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:31.064462Z", "completed_at": "2023-12-12T19:08:31.064465Z"}], "thread_id": "Thread-1", "execution_time": 0.004993915557861328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at.be572689a3", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        log_id, occurred_at\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_user_activity\n    group by log_id, occurred_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:31.066082Z", "completed_at": "2023-12-12T19:08:31.569824Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:31.570586Z", "completed_at": "2023-12-12T19:08:31.570594Z"}], "thread_id": "Thread-1", "execution_time": 0.613135814666748, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__audit_table", "compiled": true, "compiled_code": "\n\nwith sync_log as (\n    \n    select \n        *,\n        \n\n  parse_json( message_data )['table'] as table_name\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n    where event_subtype in ('sync_start', 'sync_end', 'write_to_table_start', 'write_to_table_end', 'records_modified')\n\n    \n\n    -- Capture the latest timestamp in a call statement instead of a subquery for optimizing BQ costs on incremental runs-- load the result from the above query into a new variable-- the query_result is stored as a dataframe. Therefore, we want to now store it as a singular value.-- compare the new batch of data to the latest sync already stored in this model\n    and cast(created_at as date) > '2021-12-10'\n\n    \n),\n\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status\n),\n\nadd_connector_info as (\n\n    select \n        sync_log.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n    from sync_log \n    left join connector\n        on connector.connector_id = sync_log.connector_id\n),\n\nsync_timestamps as (\n\n    select\n        connector_id,\n        connector_name,\n        table_name,\n        event_subtype,\n        destination_id,\n        destination_name,\n        created_at as write_to_table_start,\n        min(case when event_subtype = 'write_to_table_end' then created_at else null end) \n            over (partition by connector_id, table_name order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as write_to_table_end,\n\n        max(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between UNBOUNDED PRECEDING and CURRENT ROW) as sync_start,\n\n        min(case when event_subtype = 'sync_end' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as sync_end, -- coalesce with next_sync_start\n\n        min(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as next_sync_start\n    from add_connector_info\n),\n\n-- this will be the base for every record in the final CTE\nlimit_to_table_starts as (\n\n    select *\n    from sync_timestamps \n    where event_subtype = 'write_to_table_start'\n),\n\nrecords_modified_log as (\n\n    select \n        connector_id,\n        created_at,\n        \n\n  parse_json( message_data )['table'] as table_name,\n        \n\n  parse_json( message_data )['schema'] as schema_name,\n        \n\n  parse_json( message_data )['operationType'] as operation_type,\n        cast (\n\n  parse_json( message_data )['count'] as integer) as row_count\n    from sync_log \n    where event_subtype = 'records_modified'\n\n),\n\nsum_records_modified as (\n\n    select\n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name) as schema_name,\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end as sync_end,\n        sum(case when records_modified_log.operation_type = 'REPLACED_OR_INSERTED' then records_modified_log.row_count else 0 end) as sum_rows_replaced_or_inserted,\n        sum(case when records_modified_log.operation_type = 'UPDATED' then records_modified_log.row_count else 0 end) as sum_rows_updated,\n        sum(case when records_modified_log.operation_type = 'DELETED' then records_modified_log.row_count else 0 end) as sum_rows_deleted\n    from limit_to_table_starts\n    left join records_modified_log on \n        limit_to_table_starts.connector_id = records_modified_log.connector_id\n        and limit_to_table_starts.table_name = records_modified_log.table_name\n\n        -- confine it to one sync\n        and records_modified_log.created_at > limit_to_table_starts.sync_start \n        and records_modified_log.created_at < coalesce(limit_to_table_starts.sync_end, limit_to_table_starts.next_sync_start) \n\n    group by \n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name),\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end\n),\n\nfinal as (\n\n    select \n        *,\n        md5(cast(coalesce(cast(schema_name as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(connector_id as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(destination_id as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(table_name as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(write_to_table_start as TEXT), '_dbt_utils_surrogate_key_null_') as TEXT)) as unique_table_sync_key, -- for incremental materialization \n        date_trunc('day', sync_start) as sync_start_day -- for partitioning in databricks\n    from sum_records_modified\n)\n\nselect *\nfrom final", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_table"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:31.681914Z", "completed_at": "2023-12-12T19:08:32.711767Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:32.712553Z", "completed_at": "2023-12-12T19:08:32.712562Z"}], "thread_id": "Thread-1", "execution_time": 1.146045207977295, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__connector_daily_events", "compiled": true, "compiled_code": "-- depends_on: DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.connector\n\nwith connector as (\n    \n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status\n),\n\n-- grab api calls, schema changes, and record modifications\nlog_events as (\n\n    select \n        connector_id,\n        cast( date_trunc('day', created_at) as date) as date_day,\n        case \n            when event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config') then 'schema_change' \n            else event_subtype end as event_subtype,\n\n        sum(case when event_subtype = 'records_modified' then cast( \n\n  parse_json( message_data )['count'] as integer )\n        else 1 end) as count_events \n\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n\n    where event_subtype in ('api_call', \n                            'records_modified', \n                            'create_table', 'alter_table', 'create_schema', 'change_schema_config') -- all schema changes\n                            \n        and connector_id is not null\n\n    group by connector_id, cast( date_trunc('day', created_at) as date), event_subtype\n),\n\npivot_out_events as (\n\n    select\n        connector_id,\n        date_day,\n        max(case when event_subtype = 'api_call' then count_events else 0 end) as count_api_calls,\n        max(case when event_subtype = 'records_modified' then count_events else 0 end) as count_record_modifications,\n        max(case when event_subtype = 'schema_change' then count_events else 0 end) as count_schema_changes\n\n    from log_events\n    group by connector_id, date_day\n), \n\nconnector_event_counts as (\n\n    select\n        pivot_out_events.date_day,\n        pivot_out_events.count_api_calls,\n        pivot_out_events.count_record_modifications,\n        pivot_out_events.count_schema_changes,\n        connector.connector_name,\n        connector.connector_id,\n        connector.connector_type,\n        connector.destination_name,\n        connector.destination_id,\n        connector.set_up_at\n    from\n    connector left join pivot_out_events \n        on pivot_out_events.connector_id = connector.connector_id\n),\n\nspine as (\n\n    \n    \n    \n    \n    \n\n    select cast(date_day as date) as date_day\n    from (\n        \n\n    \n\n\n\n\n\nwith rawdata as (\n\n    \n\n    \n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    \n    p0.generated_number * power(2, 0)\n     + \n    \n    p1.generated_number * power(2, 1)\n     + \n    \n    p2.generated_number * power(2, 2)\n     + \n    \n    p3.generated_number * power(2, 3)\n     + \n    \n    p4.generated_number * power(2, 4)\n     + \n    \n    p5.generated_number * power(2, 5)\n     + \n    \n    p6.generated_number * power(2, 6)\n     + \n    \n    p7.generated_number * power(2, 7)\n     + \n    \n    p8.generated_number * power(2, 8)\n     + \n    \n    p9.generated_number * power(2, 9)\n     + \n    \n    p10.generated_number * power(2, 10)\n    \n    \n    + 1\n    as generated_number\n\n    from\n\n    \n    p as p0\n     cross join \n    \n    p as p1\n     cross join \n    \n    p as p2\n     cross join \n    \n    p as p3\n     cross join \n    \n    p as p4\n     cross join \n    \n    p as p5\n     cross join \n    \n    p as p6\n     cross join \n    \n    p as p7\n     cross join \n    \n    p as p8\n     cross join \n    \n    p as p9\n     cross join \n    \n    p as p10\n    \n    \n\n    )\n\n    select *\n    from unioned\n    where generated_number <= 1733\n    order by generated_number\n\n\n\n),\n\nall_periods as (\n\n    select (\n        \n\n    dateadd(\n        day,\n        row_number() over (order by 1) - 1,\n        cast('2019-03-22' as date)\n        )\n\n\n    ) as date_day\n    from rawdata\n\n),\n\nfiltered as (\n\n    select *\n    from all_periods\n    where date_day <= \n\n    dateadd(\n        week,\n        1,\n        date_trunc('day', \n  current_timestamp::timestamp\n)\n        )\n\n\n\n)\n\nselect * from filtered\n\n\n        \n \n    ) as date_spine\n),\n\nconnector_event_history as (\n\n    select\n        spine.date_day,\n        connector_event_counts.connector_name,\n        connector_event_counts.connector_id,\n        connector_event_counts.connector_type,\n        connector_event_counts.destination_name,\n        connector_event_counts.destination_id,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_api_calls\n            else 0\n        end) as count_api_calls,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_record_modifications\n            else 0\n        end) as count_record_modifications,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_schema_changes\n            else 0\n        end) as count_schema_changes\n    from\n    spine join connector_event_counts\n        on spine.date_day  >= cast(date_trunc('day', cast(connector_event_counts.set_up_at as date)) as date)\n\n    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id\n),\n\n-- now rejoin spine to get a complete calendar\njoin_event_history as (\n    \n    select\n        spine.date_day,\n        connector_event_history.connector_name,\n        connector_event_history.connector_id,\n        connector_event_history.connector_type,\n        connector_event_history.destination_name,\n        connector_event_history.destination_id,\n        max(connector_event_history.count_api_calls) as count_api_calls,\n        max(connector_event_history.count_record_modifications) as count_record_modifications,\n        max(connector_event_history.count_schema_changes) as count_schema_changes\n\n    from\n    spine left join connector_event_history\n        on spine.date_day = connector_event_history.date_day\n\n    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id\n),\n\nfinal as (\n\n    select *\n    from join_event_history\n\n    where date_day <= cast(\n  current_timestamp::timestamp\n as date)\n\n     -- sql server cant order CTEs\n    order by date_day desc\n    \n)\n\nselect *\nfrom final", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_daily_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:32.830750Z", "completed_at": "2023-12-12T19:08:32.841876Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:32.842997Z", "completed_at": "2023-12-12T19:08:32.843007Z"}], "thread_id": "Thread-1", "execution_time": 0.01489114761352539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__schema_changelog", "compiled": true, "compiled_code": "with schema_changes as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n\n    where event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n),\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status\n),\n\nadd_connector_info as (\n\n    select \n        schema_changes.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n\n    from schema_changes join connector \n        on schema_changes.connector_id = connector.connector_id\n),\n\nfinal as (\n\n    select\n        connector_id,\n        connector_name,\n        destination_id,\n        destination_name,\n        created_at,\n        event_subtype,\n        message_data,\n\n        case \n        when event_subtype = 'alter_table' then \n\n  parse_json( message_data )['table'] \n        when event_subtype = 'create_table' then \n\n  parse_json( message_data )['name'] \n        else null end as table_name,\n\n        case \n        when event_subtype = 'create_schema' or event_subtype = 'create_table' then \n\n  parse_json( message_data )['schema'] \n        else null end as schema_name\n    \n    from add_connector_info\n)\n\nselect * from final\n\norder by created_at desc, connector_id\n", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__schema_changelog"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:32.846299Z", "completed_at": "2023-12-12T19:08:32.852753Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:32.853624Z", "completed_at": "2023-12-12T19:08:32.853632Z"}], "thread_id": "Thread-1", "execution_time": 0.00932002067565918, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status\n    group by connector_id, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:32.856304Z", "completed_at": "2023-12-12T19:08:32.860984Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:32.861731Z", "completed_at": "2023-12-12T19:08:32.861736Z"}], "thread_id": "Thread-1", "execution_time": 0.007028341293334961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        destination_id, measured_month\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__usage_mar_destination_history\n    group by destination_id, measured_month\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:32.864088Z", "completed_at": "2023-12-12T19:08:32.868334Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:32.868984Z", "completed_at": "2023-12-12T19:08:32.868989Z"}], "thread_id": "Thread-1", "execution_time": 0.006339073181152344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect unique_table_sync_key\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_table\nwhere unique_table_sync_key is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:32.871083Z", "completed_at": "2023-12-12T19:08:32.875008Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:32.875652Z", "completed_at": "2023-12-12T19:08:32.875657Z"}], "thread_id": "Thread-1", "execution_time": 0.005892753601074219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7", "compiled": true, "compiled_code": "\n    \n    \n\nselect\n    unique_table_sync_key as unique_field,\n    count(*) as n_records\n\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_table\nwhere unique_table_sync_key is not null\ngroup by unique_table_sync_key\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:32.877634Z", "completed_at": "2023-12-12T19:08:32.882772Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:32.883389Z", "completed_at": "2023-12-12T19:08:32.883393Z"}], "thread_id": "Thread-1", "execution_time": 0.00697779655456543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, date_day\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_daily_events\n    group by connector_id, destination_id, date_day\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:32.885322Z", "completed_at": "2023-12-12T19:08:32.889225Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:32.889780Z", "completed_at": "2023-12-12T19:08:32.889784Z"}], "thread_id": "Thread-1", "execution_time": 0.005650997161865234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, message_data, created_at\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__schema_changelog\n    group by connector_id, destination_id, message_data, created_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}], "elapsed_time": 4.609646797180176, "args": {"use_colors_file": true, "defer": false, "indirect_selection": "eager", "partial_parse_file_diff": true, "log_format_file": "debug", "empty_catalog": false, "strict_mode": false, "log_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests/logs", "log_format": "default", "macro_debugging": false, "enable_legacy_logger": false, "introspect": true, "project_dir": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "vars": {}, "write_json": true, "static_parser": true, "use_colors": true, "warn_error_options": {"include": [], "exclude": []}, "exclude": [], "printer_width": 80, "print": true, "log_level_file": "debug", "log_file_max_bytes": 10485760, "invocation_command": "dbt docs generate", "version_check": true, "log_level": "info", "populate_cache": true, "cache_selected_only": false, "quiet": false, "compile": true, "select": [], "profiles_dir": "/Users/jamie.rodriguez/.dbt", "show_resource_report": false, "favor_state": false, "static": false, "partial_parse": true, "which": "generate", "send_anonymous_usage_stats": true}}
\ No newline at end of file

From ad029f69b7babe3470a6a11c7a24be4796ab9c8c Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 13 Dec 2023 12:02:51 -0800
Subject: [PATCH 53/54] joe feedback

---
 CHANGELOG.md                                         |  5 ++++-
 dbt_project.yml                                      |  2 +-
 integration_tests/dbt_project.yml                    |  2 +-
 models/fivetran_platform.yml                         |  6 ++++--
 models/fivetran_platform__audit_table.sql            |  1 +
 models/fivetran_platform__connector_daily_events.sql |  7 ++-----
 models/fivetran_platform__connector_status.sql       | 12 +++++++-----
 models/fivetran_platform__mar_table_history.sql      |  4 ----
 models/fivetran_platform__schema_changelog.sql       |  5 +----
 ...etran_platform__usage_mar_destination_history.sql |  5 +----
 10 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 648dd167..ea205667 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-# dbt_fivetran_log v1.3.1
+# dbt_fivetran_log v1.4.0
 
 ## Feature Updates
 - This release introduces compatibility with **SQL Server** 🥳  🎆  🍾 ([PR #101](https://github.com/fivetran/dbt_fivetran_log/pull/101))
@@ -7,6 +7,9 @@
 - Adjusts the uniqueness test on the recently introduced `fivetran_platform__audit_user_activity` model to test on `log_id` and `occurred_at` ([PR #102](https://github.com/fivetran/dbt_fivetran_log/pull/102)).
   - Previously, the `log_id` was erroneously considered the primary key of this model.
 
+## Under the Hood
+- Removed `order by` from the final `select` statement in each model. This was done to reduce compute costs from the models ([PR #101](https://github.com/fivetran/dbt_fivetran_log/pull/101)).
+
 # dbt_fivetran_log v1.3.0
 
 ## 🚨 Breaking Changes 🚨
diff --git a/dbt_project.yml b/dbt_project.yml
index 94364207..c8404fad 100644
--- a/dbt_project.yml
+++ b/dbt_project.yml
@@ -1,6 +1,6 @@
 config-version: 2
 name: 'fivetran_log'
-version: '1.3.1'
+version: '1.4.0'
 require-dbt-version: [">=1.3.0", "<2.0.0"]
 
 models:
diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml
index 0c1cc5e4..66c9a4cb 100644
--- a/integration_tests/dbt_project.yml
+++ b/integration_tests/dbt_project.yml
@@ -1,5 +1,5 @@
 name: 'fivetran_log_integration_tests'
-version: '1.3.1'
+version: '1.4.0'
 
 config-version: 2
 profile: 'integration_tests'
diff --git a/models/fivetran_platform.yml b/models/fivetran_platform.yml
index 11ff749d..72463bd8 100644
--- a/models/fivetran_platform.yml
+++ b/models/fivetran_platform.yml
@@ -56,12 +56,14 @@ models:
       - name: errors_since_last_completed_sync
         description: >
           Aggregated line-separated list of error messages (in JSON format) raised synce the last 
-          sync completion. 
+          sync completion. Included by default for non-SQL Server targets, but can be disabled by setting
+          the `fivetran_platform_using_sync_alert_messages` var to False.
 
       - name: warnings_since_last_completed_sync
         description: >
           Aggregated line-separated list of warning messages (in JSON format) raised synce the last 
-          sync completion. 
+          sync completion. Included by default for non-SQL Server targets, but can be disabled by setting
+          the `fivetran_platform_using_sync_alert_messages` var to False.
 
     
   - name: fivetran_platform__mar_table_history
diff --git a/models/fivetran_platform__audit_table.sql b/models/fivetran_platform__audit_table.sql
index 7e8ad6ae..5e071e14 100644
--- a/models/fivetran_platform__audit_table.sql
+++ b/models/fivetran_platform__audit_table.sql
@@ -127,6 +127,7 @@ sum_records_modified as (
         and records_modified_log.created_at > limit_to_table_starts.sync_start 
         and records_modified_log.created_at < coalesce(limit_to_table_starts.sync_end, limit_to_table_starts.next_sync_start) 
 
+    -- explicit group by needed for SQL Server
     group by 
         limit_to_table_starts.connector_id,
         limit_to_table_starts.connector_name,
diff --git a/models/fivetran_platform__connector_daily_events.sql b/models/fivetran_platform__connector_daily_events.sql
index b6b78e37..7a7b7e05 100644
--- a/models/fivetran_platform__connector_daily_events.sql
+++ b/models/fivetran_platform__connector_daily_events.sql
@@ -72,7 +72,8 @@ spine as (
     {% else %} {% set first_date = "2016-01-01" %}
     {% endif %}
 
-    select cast(date_day as date) as date_day
+    select 
+        cast(date_day as date) as date_day
     from (
         {{ fivetran_utils.fivetran_date_spine(
             datepart = "day", 
@@ -138,10 +139,6 @@ final as (
     from join_event_history
 
     where date_day <= cast({{ dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp() }} as date)
-
-    {% if target.type != 'sqlserver' %} -- sql server cant order CTEs
-    order by date_day desc
-    {% endif %}
 )
 
 select *
diff --git a/models/fivetran_platform__connector_status.sql b/models/fivetran_platform__connector_status.sql
index b958302b..f3f3d59d 100644
--- a/models/fivetran_platform__connector_status.sql
+++ b/models/fivetran_platform__connector_status.sql
@@ -101,7 +101,7 @@ connector_health_status as (
         *,
         case 
             -- connector is paused
-            when is_paused {{ ' = 1' if target.type == 'sqlserver' else '' }} then 'paused'
+            when is_paused {{ ' = 1' if target.type == 'sqlserver' }} then 'paused'
 
             -- a sync has never been attempted
             when last_sync_started_at is null then 'incomplete'
@@ -155,7 +155,7 @@ connector_recent_logs as (
             and {{ fivetran_utils.json_parse(string="connector_log.message_data", string_path=["status"]) }} ='RESCHEDULED'
             and {{ fivetran_utils.json_parse(string="connector_log.message_data", string_path=["reason"]) }} like '%intended behavior%')
 
-    group by -- remove duplicates
+    group by -- remove duplicates, need explicit group by for SQL Server
         connector_health_status.connector_id,
         connector_health_status.connector_name,
         connector_health_status.connector_type,
@@ -186,9 +186,9 @@ final as (
         connector_recent_logs.set_up_at,
         coalesce(schema_changes.number_of_schema_changes_last_month, 0) as number_of_schema_changes_last_month
         
-        {% if var('fivetran_platform_using_sync_alert_messages', true) %}
-        , {{ fivetran_utils.string_agg("case when connector_recent_logs.event_type = 'SEVERE' then connector_recent_logs.message_data else null end", "'\\n'") }} as errors_since_last_completed_sync
-        , {{ fivetran_utils.string_agg("case when connector_recent_logs.event_type = 'WARNING' then connector_recent_logs.message_data else null end", "'\\n'") }} as warnings_since_last_completed_sync
+        {% if var('fivetran_platform_using_sync_alert_messages', true) and target.type != 'sqlserver' %}
+        , {{ fivetran_utils.string_agg("distinct case when connector_recent_logs.event_type = 'SEVERE' then connector_recent_logs.message_data else null end", "'\\n'") }} as errors_since_last_completed_sync
+        , {{ fivetran_utils.string_agg("distinct case when connector_recent_logs.event_type = 'WARNING' then connector_recent_logs.message_data else null end", "'\\n'") }} as warnings_since_last_completed_sync
         {% endif %}
 
     from connector_recent_logs
@@ -196,6 +196,8 @@ final as (
         on connector_recent_logs.connector_id = schema_changes.connector_id 
 
     join destination on destination.destination_id = connector_recent_logs.destination_id
+
+    -- need explicit group bys for SQL Server
     group by 
         connector_recent_logs.connector_id, 
         connector_recent_logs.connector_name, 
diff --git a/models/fivetran_platform__mar_table_history.sql b/models/fivetran_platform__mar_table_history.sql
index 5841f53e..49e17eb5 100644
--- a/models/fivetran_platform__mar_table_history.sql
+++ b/models/fivetran_platform__mar_table_history.sql
@@ -71,7 +71,3 @@ mar_join as (
 )
 
 select * from mar_join
-{% if target.type != 'sqlserver' %} -- can't order CTEs in sqlserver
-order by measured_month desc, destination_id, connector_name
-{% endif %}
-
diff --git a/models/fivetran_platform__schema_changelog.sql b/models/fivetran_platform__schema_changelog.sql
index 94835020..134443ca 100644
--- a/models/fivetran_platform__schema_changelog.sql
+++ b/models/fivetran_platform__schema_changelog.sql
@@ -47,7 +47,4 @@ final as (
     from add_connector_info
 )
 
-select * from final
-{% if target.type != 'sqlserver' %}
-order by created_at desc, connector_id
-{% endif %}
\ No newline at end of file
+select * from final
\ No newline at end of file
diff --git a/models/fivetran_platform__usage_mar_destination_history.sql b/models/fivetran_platform__usage_mar_destination_history.sql
index 537e768c..ce1a3d9c 100644
--- a/models/fivetran_platform__usage_mar_destination_history.sql
+++ b/models/fivetran_platform__usage_mar_destination_history.sql
@@ -66,7 +66,4 @@ join_usage_mar as (
 )
 
 select * 
-from join_usage_mar
-{% if target.type != 'sqlserver' %} -- sql server doesn't support ordering CTEs
-order by measured_month desc
-{% endif %}
\ No newline at end of file
+from join_usage_mar
\ No newline at end of file

From 4b41f966911dfaf22fb9d839a835f2f8384ea1cd Mon Sep 17 00:00:00 2001
From: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
Date: Wed, 13 Dec 2023 12:56:27 -0800
Subject: [PATCH 54/54] docs and changelog

---
 CHANGELOG.md          | 1 +
 docs/catalog.json     | 2 +-
 docs/manifest.json    | 2 +-
 docs/run_results.json | 2 +-
 4 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ea205667..0885f24f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@
 
 ## Under the Hood
 - Removed `order by` from the final `select` statement in each model. This was done to reduce compute costs from the models ([PR #101](https://github.com/fivetran/dbt_fivetran_log/pull/101)).
+- Converted all `group by`'s to explicitly reference the names of columns we are grouping by, instead of grouping by column number. This was necessary for SQL Server compatibility, as implicit groupings are not supported ([PR #101](https://github.com/fivetran/dbt_fivetran_log/pull/101)).
 
 # dbt_fivetran_log v1.3.0
 
diff --git a/docs/catalog.json b/docs/catalog.json
index f9fca39d..1b91c6ff 100644
--- a/docs/catalog.json
+++ b/docs/catalog.json
@@ -1 +1 @@
-{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.7.3", "generated_at": "2023-12-12T19:09:33.038503Z", "invocation_id": "c0fa594b-cab7-478a-aeb0-a325788070ef", "env": {}}, "nodes": {"model.fivetran_log.fivetran_platform__connector_status": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "FIVETRAN_PLATFORM__CONNECTOR_STATUS", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_ID": {"type": "TEXT", "index": 1, "name": "CONNECTOR_ID", "comment": null}, "CONNECTOR_NAME": {"type": "TEXT", "index": 2, "name": "CONNECTOR_NAME", "comment": null}, "CONNECTOR_TYPE": {"type": "TEXT", "index": 3, "name": "CONNECTOR_TYPE", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 4, "name": "DESTINATION_ID", "comment": null}, "DESTINATION_NAME": {"type": "TEXT", "index": 5, "name": "DESTINATION_NAME", "comment": null}, "CONNECTOR_HEALTH": {"type": "TEXT", "index": 6, "name": "CONNECTOR_HEALTH", "comment": null}, "LAST_SUCCESSFUL_SYNC_COMPLETED_AT": {"type": "TIMESTAMP_NTZ", "index": 7, "name": "LAST_SUCCESSFUL_SYNC_COMPLETED_AT", "comment": null}, "LAST_SYNC_STARTED_AT": {"type": "TIMESTAMP_NTZ", "index": 8, "name": "LAST_SYNC_STARTED_AT", "comment": null}, "LAST_SYNC_COMPLETED_AT": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "LAST_SYNC_COMPLETED_AT", "comment": null}, "SET_UP_AT": {"type": "TIMESTAMP_NTZ", "index": 10, "name": "SET_UP_AT", "comment": null}, "NUMBER_OF_SCHEMA_CHANGES_LAST_MONTH": {"type": "NUMBER", "index": 11, "name": "NUMBER_OF_SCHEMA_CHANGES_LAST_MONTH", "comment": null}, "ERRORS_SINCE_LAST_COMPLETED_SYNC": {"type": "TEXT", "index": 12, "name": "ERRORS_SINCE_LAST_COMPLETED_SYNC", "comment": null}, "WARNINGS_SINCE_LAST_COMPLETED_SYNC": {"type": "TEXT", "index": 13, "name": "WARNINGS_SINCE_LAST_COMPLETED_SYNC", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4608, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__connector_status"}, "seed.fivetran_log_integration_tests.account": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "ACCOUNT", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "COUNTRY": {"type": "NUMBER", "index": 3, "name": "COUNTRY", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "CREATED_AT", "comment": null}, "NAME": {"type": "TEXT", "index": 5, "name": "NAME", "comment": null}, "STATUS": {"type": "TEXT", "index": 6, "name": "STATUS", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.account"}, "model.fivetran_log.fivetran_platform__schema_changelog": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "FIVETRAN_PLATFORM__SCHEMA_CHANGELOG", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_ID": {"type": "TEXT", "index": 1, "name": "CONNECTOR_ID", "comment": null}, "CONNECTOR_NAME": {"type": "TEXT", "index": 2, "name": "CONNECTOR_NAME", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 3, "name": "DESTINATION_ID", "comment": null}, "DESTINATION_NAME": {"type": "TEXT", "index": 4, "name": "DESTINATION_NAME", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 5, "name": "CREATED_AT", "comment": null}, "EVENT_SUBTYPE": {"type": "TEXT", "index": 6, "name": "EVENT_SUBTYPE", "comment": null}, "MESSAGE_DATA": {"type": "TEXT", "index": 7, "name": "MESSAGE_DATA", "comment": null}, "TABLE_NAME": {"type": "VARIANT", "index": 8, "name": "TABLE_NAME", "comment": null}, "SCHEMA_NAME": {"type": "VARIANT", "index": 9, "name": "SCHEMA_NAME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__schema_changelog"}, "model.fivetran_log.fivetran_platform__audit_user_activity": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "FIVETRAN_PLATFORM__AUDIT_USER_ACTIVITY", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DATE_DAY": {"type": "TIMESTAMP_NTZ", "index": 1, "name": "DATE_DAY", "comment": null}, "DAY_NAME": {"type": "TEXT", "index": 2, "name": "DAY_NAME", "comment": null}, "DAY_OF_MONTH": {"type": "NUMBER", "index": 3, "name": "DAY_OF_MONTH", "comment": null}, "OCCURRED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "OCCURRED_AT", "comment": null}, "DESTINATION_NAME": {"type": "TEXT", "index": 5, "name": "DESTINATION_NAME", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 6, "name": "DESTINATION_ID", "comment": null}, "CONNECTOR_NAME": {"type": "TEXT", "index": 7, "name": "CONNECTOR_NAME", "comment": null}, "CONNECTOR_ID": {"type": "TEXT", "index": 8, "name": "CONNECTOR_ID", "comment": null}, "EMAIL": {"type": "VARIANT", "index": 9, "name": "EMAIL", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 10, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 11, "name": "LAST_NAME", "comment": null}, "USER_ID": {"type": "TEXT", "index": 12, "name": "USER_ID", "comment": null}, "DESTINATION_ROLE": {"type": "TEXT", "index": 13, "name": "DESTINATION_ROLE", "comment": null}, "EVENT_TYPE": {"type": "TEXT", "index": 14, "name": "EVENT_TYPE", "comment": null}, "EVENT_SUBTYPE": {"type": "TEXT", "index": 15, "name": "EVENT_SUBTYPE", "comment": null}, "MESSAGE_DATA": {"type": "TEXT", "index": 16, "name": "MESSAGE_DATA", "comment": null}, "LOG_ID": {"type": "TEXT", "index": 17, "name": "LOG_ID", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5120, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__audit_user_activity"}, "model.fivetran_log.stg_fivetran_platform__connector": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__CONNECTOR", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_ID": {"type": "TEXT", "index": 1, "name": "CONNECTOR_ID", "comment": null}, "CONNECTOR_NAME": {"type": "TEXT", "index": 2, "name": "CONNECTOR_NAME", "comment": null}, "CONNECTOR_TYPE": {"type": "TEXT", "index": 3, "name": "CONNECTOR_TYPE", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 4, "name": "DESTINATION_ID", "comment": null}, "CONNECTING_USER_ID": {"type": "TEXT", "index": 5, "name": "CONNECTING_USER_ID", "comment": null}, "IS_PAUSED": {"type": "BOOLEAN", "index": 6, "name": "IS_PAUSED", "comment": null}, "SET_UP_AT": {"type": "TIMESTAMP_NTZ", "index": 7, "name": "SET_UP_AT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__connector"}, "model.fivetran_log.stg_fivetran_platform__log": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__LOG", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"LOG_ID": {"type": "TEXT", "index": 1, "name": "LOG_ID", "comment": null}, "SYNC_ID": {"type": "TEXT", "index": 2, "name": "SYNC_ID", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "CREATED_AT", "comment": null}, "CONNECTOR_ID": {"type": "TEXT", "index": 4, "name": "CONNECTOR_ID", "comment": null}, "EVENT_TYPE": {"type": "TEXT", "index": 5, "name": "EVENT_TYPE", "comment": null}, "MESSAGE_DATA": {"type": "TEXT", "index": 6, "name": "MESSAGE_DATA", "comment": null}, "EVENT_SUBTYPE": {"type": "TEXT", "index": 7, "name": "EVENT_SUBTYPE", "comment": null}, "TRANSFORMATION_ID": {"type": "TEXT", "index": 8, "name": "TRANSFORMATION_ID", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 30, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5632, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__log"}, "seed.fivetran_log_integration_tests.destination": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "DESTINATION", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "ACCOUNT_ID": {"type": "TEXT", "index": 3, "name": "ACCOUNT_ID", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "CREATED_AT", "comment": null}, "NAME": {"type": "TEXT", "index": 5, "name": "NAME", "comment": null}, "REGION": {"type": "TEXT", "index": 6, "name": "REGION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.destination"}, "model.fivetran_log.fivetran_platform__usage_mar_destination_history": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "FIVETRAN_PLATFORM__USAGE_MAR_DESTINATION_HISTORY", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"MEASURED_MONTH": {"type": "DATE", "index": 1, "name": "MEASURED_MONTH", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 2, "name": "DESTINATION_ID", "comment": null}, "DESTINATION_NAME": {"type": "TEXT", "index": 3, "name": "DESTINATION_NAME", "comment": null}, "CREDITS_SPENT": {"type": "NUMBER", "index": 4, "name": "CREDITS_SPENT", "comment": null}, "DOLLARS_SPENT": {"type": "FLOAT", "index": 5, "name": "DOLLARS_SPENT", "comment": null}, "FREE_MONTHLY_ACTIVE_ROWS": {"type": "NUMBER", "index": 6, "name": "FREE_MONTHLY_ACTIVE_ROWS", "comment": null}, "PAID_MONTHLY_ACTIVE_ROWS": {"type": "NUMBER", "index": 7, "name": "PAID_MONTHLY_ACTIVE_ROWS", "comment": null}, "TOTAL_MONTHLY_ACTIVE_ROWS": {"type": "NUMBER", "index": 8, "name": "TOTAL_MONTHLY_ACTIVE_ROWS", "comment": null}, "CREDITS_SPENT_PER_MILLION_MAR": {"type": "NUMBER", "index": 9, "name": "CREDITS_SPENT_PER_MILLION_MAR", "comment": null}, "MAR_PER_CREDIT_SPENT": {"type": "NUMBER", "index": 10, "name": "MAR_PER_CREDIT_SPENT", "comment": null}, "AMOUNT_SPENT_PER_MILLION_MAR": {"type": "NUMBER", "index": 11, "name": "AMOUNT_SPENT_PER_MILLION_MAR", "comment": null}, "MAR_PER_AMOUNT_SPENT": {"type": "NUMBER", "index": 12, "name": "MAR_PER_AMOUNT_SPENT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__usage_mar_destination_history"}, "model.fivetran_log.stg_fivetran_platform__account": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__ACCOUNT", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ACCOUNT_ID": {"type": "TEXT", "index": 1, "name": "ACCOUNT_ID", "comment": null}, "COUNTRY": {"type": "NUMBER", "index": 2, "name": "COUNTRY", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "CREATED_AT", "comment": null}, "ACCOUNT_NAME": {"type": "TEXT", "index": 4, "name": "ACCOUNT_NAME", "comment": null}, "STATUS": {"type": "TEXT", "index": 5, "name": "STATUS", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__account"}, "model.fivetran_log.fivetran_platform__audit_table": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "FIVETRAN_PLATFORM__AUDIT_TABLE", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_ID": {"type": "TEXT", "index": 1, "name": "CONNECTOR_ID", "comment": null}, "CONNECTOR_NAME": {"type": "TEXT", "index": 2, "name": "CONNECTOR_NAME", "comment": null}, "SCHEMA_NAME": {"type": "TEXT", "index": 3, "name": "SCHEMA_NAME", "comment": null}, "TABLE_NAME": {"type": "VARIANT", "index": 4, "name": "TABLE_NAME", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 5, "name": "DESTINATION_ID", "comment": null}, "DESTINATION_NAME": {"type": "TEXT", "index": 6, "name": "DESTINATION_NAME", "comment": null}, "WRITE_TO_TABLE_START": {"type": "TIMESTAMP_NTZ", "index": 7, "name": "WRITE_TO_TABLE_START", "comment": null}, "WRITE_TO_TABLE_END": {"type": "TIMESTAMP_NTZ", "index": 8, "name": "WRITE_TO_TABLE_END", "comment": null}, "SYNC_START": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "SYNC_START", "comment": null}, "SYNC_END": {"type": "TIMESTAMP_NTZ", "index": 10, "name": "SYNC_END", "comment": null}, "SUM_ROWS_REPLACED_OR_INSERTED": {"type": "NUMBER", "index": 11, "name": "SUM_ROWS_REPLACED_OR_INSERTED", "comment": null}, "SUM_ROWS_UPDATED": {"type": "NUMBER", "index": 12, "name": "SUM_ROWS_UPDATED", "comment": null}, "SUM_ROWS_DELETED": {"type": "NUMBER", "index": 13, "name": "SUM_ROWS_DELETED", "comment": null}, "UNIQUE_TABLE_SYNC_KEY": {"type": "TEXT", "index": 14, "name": "UNIQUE_TABLE_SYNC_KEY", "comment": null}, "SYNC_START_DAY": {"type": "TIMESTAMP_NTZ", "index": 15, "name": "SYNC_START_DAY", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 6, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 6144, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__audit_table"}, "seed.fivetran_log_integration_tests.incremental_mar": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "INCREMENTAL_MAR", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_ID": {"type": "TEXT", "index": 1, "name": "CONNECTOR_ID", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 2, "name": "DESTINATION_ID", "comment": null}, "FREE_TYPE": {"type": "TEXT", "index": 3, "name": "FREE_TYPE", "comment": null}, "MEASURED_DATE": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "MEASURED_DATE", "comment": null}, "SCHEMA_NAME": {"type": "TEXT", "index": 5, "name": "SCHEMA_NAME", "comment": null}, "SYNC_TYPE": {"type": "TEXT", "index": 6, "name": "SYNC_TYPE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 7, "name": "TABLE_NAME", "comment": null}, "UPDATED_AT": {"type": "TIMESTAMP_NTZ", "index": 8, "name": "UPDATED_AT", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "_FIVETRAN_SYNCED", "comment": null}, "INCREMENTAL_ROWS": {"type": "NUMBER", "index": 10, "name": "INCREMENTAL_ROWS", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 10, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4096, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.incremental_mar"}, "model.fivetran_log.stg_fivetran_platform__destination": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__DESTINATION", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "ACCOUNT_ID": {"type": "TEXT", "index": 2, "name": "ACCOUNT_ID", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "CREATED_AT", "comment": null}, "DESTINATION_NAME": {"type": "TEXT", "index": 4, "name": "DESTINATION_NAME", "comment": null}, "REGION": {"type": "TEXT", "index": 5, "name": "REGION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__destination"}, "model.fivetran_log.stg_fivetran_platform__incremental_mar": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__INCREMENTAL_MAR", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_NAME": {"type": "TEXT", "index": 1, "name": "CONNECTOR_NAME", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 2, "name": "DESTINATION_ID", "comment": null}, "FREE_TYPE": {"type": "TEXT", "index": 3, "name": "FREE_TYPE", "comment": null}, "MEASURED_DATE": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "MEASURED_DATE", "comment": null}, "SCHEMA_NAME": {"type": "TEXT", "index": 5, "name": "SCHEMA_NAME", "comment": null}, "SYNC_TYPE": {"type": "TEXT", "index": 6, "name": "SYNC_TYPE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 7, "name": "TABLE_NAME", "comment": null}, "UPDATED_AT": {"type": "TIMESTAMP_NTZ", "index": 8, "name": "UPDATED_AT", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "_FIVETRAN_SYNCED", "comment": null}, "INCREMENTAL_ROWS": {"type": "NUMBER", "index": 10, "name": "INCREMENTAL_ROWS", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 10, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4096, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__incremental_mar"}, "seed.fivetran_log_integration_tests.log": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "LOG", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "TIME_STAMP": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "TIME_STAMP", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "_FIVETRAN_SYNCED", "comment": null}, "CONNECTOR_ID": {"type": "TEXT", "index": 4, "name": "CONNECTOR_ID", "comment": null}, "EVENT": {"type": "TEXT", "index": 5, "name": "EVENT", "comment": null}, "MESSAGE_DATA": {"type": "TEXT", "index": 6, "name": "MESSAGE_DATA", "comment": null}, "MESSAGE_EVENT": {"type": "TEXT", "index": 7, "name": "MESSAGE_EVENT", "comment": null}, "TRANSFORMATION_ID": {"type": "TEXT", "index": 8, "name": "TRANSFORMATION_ID", "comment": null}, "SYNC_ID": {"type": "TEXT", "index": 9, "name": "SYNC_ID", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 30, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 6144, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.log"}, "seed.fivetran_log_integration_tests.user": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "USER", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "CREATED_AT", "comment": null}, "EMAIL": {"type": "TEXT", "index": 4, "name": "EMAIL", "comment": null}, "EMAIL_DISABLED": {"type": "BOOLEAN", "index": 5, "name": "EMAIL_DISABLED", "comment": null}, "FAMILY_NAME": {"type": "TEXT", "index": 6, "name": "FAMILY_NAME", "comment": null}, "GIVEN_NAME": {"type": "TEXT", "index": 7, "name": "GIVEN_NAME", "comment": null}, "PHONE": {"type": "NUMBER", "index": 8, "name": "PHONE", "comment": null}, "VERIFIED": {"type": "BOOLEAN", "index": 9, "name": "VERIFIED", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3584, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.user"}, "model.fivetran_log.stg_fivetran_platform__usage_cost": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__USAGE_COST", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "MEASURED_MONTH": {"type": "TEXT", "index": 2, "name": "MEASURED_MONTH", "comment": null}, "DOLLARS_SPENT": {"type": "FLOAT", "index": 3, "name": "DOLLARS_SPENT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 4, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__usage_cost"}, "model.fivetran_log.stg_fivetran_platform__log_tmp": {"metadata": {"type": "VIEW", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__LOG_TMP", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "TIME_STAMP": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "TIME_STAMP", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "_FIVETRAN_SYNCED", "comment": null}, "CONNECTOR_ID": {"type": "TEXT", "index": 4, "name": "CONNECTOR_ID", "comment": null}, "EVENT": {"type": "TEXT", "index": 5, "name": "EVENT", "comment": null}, "MESSAGE_DATA": {"type": "TEXT", "index": 6, "name": "MESSAGE_DATA", "comment": null}, "MESSAGE_EVENT": {"type": "TEXT", "index": 7, "name": "MESSAGE_EVENT", "comment": null}, "TRANSFORMATION_ID": {"type": "TEXT", "index": 8, "name": "TRANSFORMATION_ID", "comment": null}, "SYNC_ID": {"type": "TEXT", "index": 9, "name": "SYNC_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__log_tmp"}, "seed.fivetran_log_integration_tests.destination_membership": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "DESTINATION_MEMBERSHIP", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "USER_ID": {"type": "TEXT", "index": 2, "name": "USER_ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "_FIVETRAN_SYNCED", "comment": null}, "ACTIVATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "ACTIVATED_AT", "comment": null}, "JOINED_AT": {"type": "TIMESTAMP_NTZ", "index": 5, "name": "JOINED_AT", "comment": null}, "ROLE": {"type": "TEXT", "index": 6, "name": "ROLE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.destination_membership"}, "seed.fivetran_log_integration_tests.connector": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "CONNECTOR", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_ID": {"type": "TEXT", "index": 1, "name": "CONNECTOR_ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "CONNECTING_USER_ID": {"type": "TEXT", "index": 3, "name": "CONNECTING_USER_ID", "comment": null}, "CONNECTOR_NAME": {"type": "TEXT", "index": 4, "name": "CONNECTOR_NAME", "comment": null}, "CONNECTOR_TYPE": {"type": "TEXT", "index": 5, "name": "CONNECTOR_TYPE", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 6, "name": "DESTINATION_ID", "comment": null}, "PAUSED": {"type": "BOOLEAN", "index": 7, "name": "PAUSED", "comment": null}, "SIGNED_UP": {"type": "TIMESTAMP_NTZ", "index": 8, "name": "SIGNED_UP", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.connector"}, "model.fivetran_log.stg_fivetran_platform__destination_membership": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__DESTINATION_MEMBERSHIP", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "USER_ID": {"type": "TEXT", "index": 2, "name": "USER_ID", "comment": null}, "ACTIVATED_AT": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "ACTIVATED_AT", "comment": null}, "JOINED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "JOINED_AT", "comment": null}, "DESTINATION_ROLE": {"type": "TEXT", "index": 5, "name": "DESTINATION_ROLE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__destination_membership"}, "model.fivetran_log.stg_fivetran_platform__credits_used": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__CREDITS_USED", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "MEASURED_MONTH": {"type": "TEXT", "index": 2, "name": "MEASURED_MONTH", "comment": null}, "CREDITS_SPENT": {"type": "NUMBER", "index": 3, "name": "CREDITS_SPENT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__credits_used"}, "model.fivetran_log.fivetran_platform__mar_table_history": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "FIVETRAN_PLATFORM__MAR_TABLE_HISTORY", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_NAME": {"type": "TEXT", "index": 1, "name": "CONNECTOR_NAME", "comment": null}, "SCHEMA_NAME": {"type": "TEXT", "index": 2, "name": "SCHEMA_NAME", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 4, "name": "DESTINATION_ID", "comment": null}, "MEASURED_MONTH": {"type": "TIMESTAMP_NTZ", "index": 5, "name": "MEASURED_MONTH", "comment": null}, "LAST_MEASURED_AT": {"type": "DATE", "index": 6, "name": "LAST_MEASURED_AT", "comment": null}, "FREE_MONTHLY_ACTIVE_ROWS": {"type": "NUMBER", "index": 7, "name": "FREE_MONTHLY_ACTIVE_ROWS", "comment": null}, "PAID_MONTHLY_ACTIVE_ROWS": {"type": "NUMBER", "index": 8, "name": "PAID_MONTHLY_ACTIVE_ROWS", "comment": null}, "TOTAL_MONTHLY_ACTIVE_ROWS": {"type": "NUMBER", "index": 9, "name": "TOTAL_MONTHLY_ACTIVE_ROWS", "comment": null}, "CONNECTOR_TYPE": {"type": "TEXT", "index": 10, "name": "CONNECTOR_TYPE", "comment": null}, "CONNECTOR_ID": {"type": "TEXT", "index": 11, "name": "CONNECTOR_ID", "comment": null}, "DESTINATION_NAME": {"type": "TEXT", "index": 12, "name": "DESTINATION_NAME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__mar_table_history"}, "model.fivetran_log.stg_fivetran_platform__connector_tmp": {"metadata": {"type": "VIEW", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__CONNECTOR_TMP", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_ID": {"type": "TEXT", "index": 1, "name": "CONNECTOR_ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "CONNECTING_USER_ID": {"type": "TEXT", "index": 3, "name": "CONNECTING_USER_ID", "comment": null}, "CONNECTOR_NAME": {"type": "TEXT", "index": 4, "name": "CONNECTOR_NAME", "comment": null}, "CONNECTOR_TYPE": {"type": "TEXT", "index": 5, "name": "CONNECTOR_TYPE", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 6, "name": "DESTINATION_ID", "comment": null}, "PAUSED": {"type": "BOOLEAN", "index": 7, "name": "PAUSED", "comment": null}, "SIGNED_UP": {"type": "TIMESTAMP_NTZ", "index": 8, "name": "SIGNED_UP", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__connector_tmp"}, "seed.fivetran_log_integration_tests.credits_used": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "CREDITS_USED", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "MEASURED_MONTH": {"type": "TEXT", "index": 2, "name": "MEASURED_MONTH", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "_FIVETRAN_SYNCED", "comment": null}, "CREDITS_CONSUMED": {"type": "NUMBER", "index": 4, "name": "CREDITS_CONSUMED", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.credits_used"}, "seed.fivetran_log_integration_tests.usage_cost": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "USAGE_COST", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "MEASURED_MONTH": {"type": "TEXT", "index": 2, "name": "MEASURED_MONTH", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "_FIVETRAN_SYNCED", "comment": null}, "AMOUNT": {"type": "FLOAT", "index": 4, "name": "AMOUNT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 4, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.usage_cost"}, "model.fivetran_log.fivetran_platform__connector_daily_events": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "FIVETRAN_PLATFORM__CONNECTOR_DAILY_EVENTS", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DATE_DAY": {"type": "DATE", "index": 1, "name": "DATE_DAY", "comment": null}, "CONNECTOR_NAME": {"type": "TEXT", "index": 2, "name": "CONNECTOR_NAME", "comment": null}, "CONNECTOR_ID": {"type": "TEXT", "index": 3, "name": "CONNECTOR_ID", "comment": null}, "CONNECTOR_TYPE": {"type": "TEXT", "index": 4, "name": "CONNECTOR_TYPE", "comment": null}, "DESTINATION_NAME": {"type": "TEXT", "index": 5, "name": "DESTINATION_NAME", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 6, "name": "DESTINATION_ID", "comment": null}, "COUNT_API_CALLS": {"type": "NUMBER", "index": 7, "name": "COUNT_API_CALLS", "comment": null}, "COUNT_RECORD_MODIFICATIONS": {"type": "NUMBER", "index": 8, "name": "COUNT_RECORD_MODIFICATIONS", "comment": null}, "COUNT_SCHEMA_CHANGES": {"type": "NUMBER", "index": 9, "name": "COUNT_SCHEMA_CHANGES", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2926, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 29184, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__connector_daily_events"}, "model.fivetran_log.stg_fivetran_platform__user": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1_FIVETRAN_PLATFORM", "name": "STG_FIVETRAN_PLATFORM__USER", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"USER_ID": {"type": "TEXT", "index": 1, "name": "USER_ID", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "CREATED_AT", "comment": null}, "EMAIL": {"type": "TEXT", "index": 3, "name": "EMAIL", "comment": null}, "HAS_DISABLED_EMAIL_NOTIFICATIONS": {"type": "BOOLEAN", "index": 4, "name": "HAS_DISABLED_EMAIL_NOTIFICATIONS", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 5, "name": "LAST_NAME", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 6, "name": "FIRST_NAME", "comment": null}, "PHONE": {"type": "NUMBER", "index": 7, "name": "PHONE", "comment": null}, "IS_VERIFIED": {"type": "BOOLEAN", "index": 8, "name": "IS_VERIFIED", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__user"}}, "sources": {"source.fivetran_log.fivetran_platform.account": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "ACCOUNT", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "COUNTRY": {"type": "NUMBER", "index": 3, "name": "COUNTRY", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "CREATED_AT", "comment": null}, "NAME": {"type": "TEXT", "index": 5, "name": "NAME", "comment": null}, "STATUS": {"type": "TEXT", "index": 6, "name": "STATUS", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.account"}, "source.fivetran_log.fivetran_platform.destination": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "DESTINATION", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "ACCOUNT_ID": {"type": "TEXT", "index": 3, "name": "ACCOUNT_ID", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "CREATED_AT", "comment": null}, "NAME": {"type": "TEXT", "index": 5, "name": "NAME", "comment": null}, "REGION": {"type": "TEXT", "index": 6, "name": "REGION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.destination"}, "source.fivetran_log.fivetran_platform.incremental_mar": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "INCREMENTAL_MAR", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_ID": {"type": "TEXT", "index": 1, "name": "CONNECTOR_ID", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 2, "name": "DESTINATION_ID", "comment": null}, "FREE_TYPE": {"type": "TEXT", "index": 3, "name": "FREE_TYPE", "comment": null}, "MEASURED_DATE": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "MEASURED_DATE", "comment": null}, "SCHEMA_NAME": {"type": "TEXT", "index": 5, "name": "SCHEMA_NAME", "comment": null}, "SYNC_TYPE": {"type": "TEXT", "index": 6, "name": "SYNC_TYPE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 7, "name": "TABLE_NAME", "comment": null}, "UPDATED_AT": {"type": "TIMESTAMP_NTZ", "index": 8, "name": "UPDATED_AT", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "_FIVETRAN_SYNCED", "comment": null}, "INCREMENTAL_ROWS": {"type": "NUMBER", "index": 10, "name": "INCREMENTAL_ROWS", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 10, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4096, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.incremental_mar"}, "source.fivetran_log.fivetran_platform.log": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "LOG", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "TIME_STAMP": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "TIME_STAMP", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "_FIVETRAN_SYNCED", "comment": null}, "CONNECTOR_ID": {"type": "TEXT", "index": 4, "name": "CONNECTOR_ID", "comment": null}, "EVENT": {"type": "TEXT", "index": 5, "name": "EVENT", "comment": null}, "MESSAGE_DATA": {"type": "TEXT", "index": 6, "name": "MESSAGE_DATA", "comment": null}, "MESSAGE_EVENT": {"type": "TEXT", "index": 7, "name": "MESSAGE_EVENT", "comment": null}, "TRANSFORMATION_ID": {"type": "TEXT", "index": 8, "name": "TRANSFORMATION_ID", "comment": null}, "SYNC_ID": {"type": "TEXT", "index": 9, "name": "SYNC_ID", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 30, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 6144, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.log"}, "source.fivetran_log.fivetran_platform.user": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "USER", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "CREATED_AT": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "CREATED_AT", "comment": null}, "EMAIL": {"type": "TEXT", "index": 4, "name": "EMAIL", "comment": null}, "EMAIL_DISABLED": {"type": "BOOLEAN", "index": 5, "name": "EMAIL_DISABLED", "comment": null}, "FAMILY_NAME": {"type": "TEXT", "index": 6, "name": "FAMILY_NAME", "comment": null}, "GIVEN_NAME": {"type": "TEXT", "index": 7, "name": "GIVEN_NAME", "comment": null}, "PHONE": {"type": "NUMBER", "index": 8, "name": "PHONE", "comment": null}, "VERIFIED": {"type": "BOOLEAN", "index": 9, "name": "VERIFIED", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3584, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.user"}, "source.fivetran_log.fivetran_platform.destination_membership": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "DESTINATION_MEMBERSHIP", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "USER_ID": {"type": "TEXT", "index": 2, "name": "USER_ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "_FIVETRAN_SYNCED", "comment": null}, "ACTIVATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "ACTIVATED_AT", "comment": null}, "JOINED_AT": {"type": "TIMESTAMP_NTZ", "index": 5, "name": "JOINED_AT", "comment": null}, "ROLE": {"type": "TEXT", "index": 6, "name": "ROLE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.destination_membership"}, "source.fivetran_log.fivetran_platform.connector": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "CONNECTOR", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"CONNECTOR_ID": {"type": "TEXT", "index": 1, "name": "CONNECTOR_ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "CONNECTING_USER_ID": {"type": "TEXT", "index": 3, "name": "CONNECTING_USER_ID", "comment": null}, "CONNECTOR_NAME": {"type": "TEXT", "index": 4, "name": "CONNECTOR_NAME", "comment": null}, "CONNECTOR_TYPE": {"type": "TEXT", "index": 5, "name": "CONNECTOR_TYPE", "comment": null}, "DESTINATION_ID": {"type": "TEXT", "index": 6, "name": "DESTINATION_ID", "comment": null}, "PAUSED": {"type": "BOOLEAN", "index": 7, "name": "PAUSED", "comment": null}, "SIGNED_UP": {"type": "TIMESTAMP_NTZ", "index": 8, "name": "SIGNED_UP", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.connector"}, "source.fivetran_log.fivetran_platform.credits_used": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "CREDITS_USED", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "MEASURED_MONTH": {"type": "TEXT", "index": 2, "name": "MEASURED_MONTH", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "_FIVETRAN_SYNCED", "comment": null}, "CREDITS_CONSUMED": {"type": "NUMBER", "index": 4, "name": "CREDITS_CONSUMED", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.credits_used"}, "source.fivetran_log.fivetran_platform.usage_cost": {"metadata": {"type": "BASE TABLE", "schema": "FIVETRAN_PLATFORM_INTEGRATION_TESTS_1", "name": "USAGE_COST", "database": "DBT_PACKAGE_TESTING", "comment": null, "owner": "DBT_PACKAGE"}, "columns": {"DESTINATION_ID": {"type": "TEXT", "index": 1, "name": "DESTINATION_ID", "comment": null}, "MEASURED_MONTH": {"type": "TEXT", "index": 2, "name": "MEASURED_MONTH", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "_FIVETRAN_SYNCED", "comment": null}, "AMOUNT": {"type": "FLOAT", "index": 4, "name": "AMOUNT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2023-12-12 19:07UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 4, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.usage_cost"}}, "errors": null}
\ No newline at end of file
+{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.7.3", "generated_at": "2023-12-13T20:53:29.424291Z", "invocation_id": "577df33a-3268-4af6-b091-fe0bceede99b", "env": {}}, "nodes": {"model.fivetran_log.stg_fivetran_platform__connector_tmp": {"metadata": {"type": "view", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__connector_tmp", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_id": {"type": "STRING", "index": 1, "name": "connector_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "connecting_user_id": {"type": "STRING", "index": 3, "name": "connecting_user_id", "comment": null}, "connector_name": {"type": "STRING", "index": 4, "name": "connector_name", "comment": null}, "connector_type": {"type": "STRING", "index": 5, "name": "connector_type", "comment": null}, "destination_id": {"type": "STRING", "index": 6, "name": "destination_id", "comment": null}, "paused": {"type": "BOOL", "index": 7, "name": "paused", "comment": null}, "signed_up": {"type": "TIMESTAMP", "index": 8, "name": "signed_up", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__connector_tmp"}, "model.fivetran_log.stg_fivetran_platform__user": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__user", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"user_id": {"type": "STRING", "index": 1, "name": "user_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 2, "name": "created_at", "comment": null}, "email": {"type": "STRING", "index": 3, "name": "email", "comment": null}, "has_disabled_email_notifications": {"type": "BOOL", "index": 4, "name": "has_disabled_email_notifications", "comment": null}, "last_name": {"type": "STRING", "index": 5, "name": "last_name", "comment": null}, "first_name": {"type": "STRING", "index": 6, "name": "first_name", "comment": null}, "phone": {"type": "INT64", "index": 7, "name": "phone", "comment": null}, "is_verified": {"type": "BOOL", "index": 8, "name": "is_verified", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 117, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__user"}, "model.fivetran_log.stg_fivetran_platform__log": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__log", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"log_id": {"type": "STRING", "index": 1, "name": "log_id", "comment": null}, "sync_id": {"type": "STRING", "index": 2, "name": "sync_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 3, "name": "created_at", "comment": null}, "connector_id": {"type": "STRING", "index": 4, "name": "connector_id", "comment": null}, "event_type": {"type": "STRING", "index": 5, "name": "event_type", "comment": null}, "message_data": {"type": "STRING", "index": 6, "name": "message_data", "comment": null}, "event_subtype": {"type": "STRING", "index": 7, "name": "event_subtype", "comment": null}, "transformation_id": {"type": "STRING", "index": 8, "name": "transformation_id", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 30, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 4356, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__log"}, "model.fivetran_log.stg_fivetran_platform__incremental_mar": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__incremental_mar", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_name": {"type": "STRING", "index": 1, "name": "connector_name", "comment": null}, "destination_id": {"type": "STRING", "index": 2, "name": "destination_id", "comment": null}, "free_type": {"type": "STRING", "index": 3, "name": "free_type", "comment": null}, "measured_date": {"type": "TIMESTAMP", "index": 4, "name": "measured_date", "comment": null}, "schema_name": {"type": "STRING", "index": 5, "name": "schema_name", "comment": null}, "sync_type": {"type": "STRING", "index": 6, "name": "sync_type", "comment": null}, "table_name": {"type": "STRING", "index": 7, "name": "table_name", "comment": null}, "updated_at": {"type": "DATETIME", "index": 8, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 9, "name": "_fivetran_synced", "comment": null}, "incremental_rows": {"type": "INT64", "index": 10, "name": "incremental_rows", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 988, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__incremental_mar"}, "model.fivetran_log.stg_fivetran_platform__account": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__account", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"account_id": {"type": "STRING", "index": 1, "name": "account_id", "comment": null}, "country": {"type": "INT64", "index": 2, "name": "country", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 3, "name": "created_at", "comment": null}, "account_name": {"type": "STRING", "index": 4, "name": "account_name", "comment": null}, "status": {"type": "STRING", "index": 5, "name": "status", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 47, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__account"}, "model.fivetran_log.stg_fivetran_platform__destination": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__destination", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "account_id": {"type": "STRING", "index": 2, "name": "account_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 3, "name": "created_at", "comment": null}, "destination_name": {"type": "STRING", "index": 4, "name": "destination_name", "comment": null}, "region": {"type": "STRING", "index": 5, "name": "region", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 123, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__destination"}, "model.fivetran_log.fivetran_platform__audit_user_activity": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "fivetran_platform__audit_user_activity", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"date_day": {"type": "TIMESTAMP", "index": 1, "name": "date_day", "comment": null}, "day_name": {"type": "STRING", "index": 2, "name": "day_name", "comment": null}, "day_of_month": {"type": "INT64", "index": 3, "name": "day_of_month", "comment": null}, "occurred_at": {"type": "TIMESTAMP", "index": 4, "name": "occurred_at", "comment": null}, "destination_name": {"type": "STRING", "index": 5, "name": "destination_name", "comment": null}, "destination_id": {"type": "STRING", "index": 6, "name": "destination_id", "comment": null}, "connector_name": {"type": "STRING", "index": 7, "name": "connector_name", "comment": null}, "connector_id": {"type": "STRING", "index": 8, "name": "connector_id", "comment": null}, "email": {"type": "STRING", "index": 9, "name": "email", "comment": null}, "first_name": {"type": "STRING", "index": 10, "name": "first_name", "comment": null}, "last_name": {"type": "STRING", "index": 11, "name": "last_name", "comment": null}, "user_id": {"type": "STRING", "index": 12, "name": "user_id", "comment": null}, "destination_role": {"type": "STRING", "index": 13, "name": "destination_role", "comment": null}, "event_type": {"type": "STRING", "index": 14, "name": "event_type", "comment": null}, "event_subtype": {"type": "STRING", "index": 15, "name": "event_subtype", "comment": null}, "message_data": {"type": "STRING", "index": 16, "name": "message_data", "comment": null}, "log_id": {"type": "STRING", "index": 17, "name": "log_id", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 342, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__audit_user_activity"}, "model.fivetran_log.fivetran_platform__mar_table_history": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "fivetran_platform__mar_table_history", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_name": {"type": "STRING", "index": 1, "name": "connector_name", "comment": null}, "schema_name": {"type": "STRING", "index": 2, "name": "schema_name", "comment": null}, "table_name": {"type": "STRING", "index": 3, "name": "table_name", "comment": null}, "destination_id": {"type": "STRING", "index": 4, "name": "destination_id", "comment": null}, "measured_month": {"type": "TIMESTAMP", "index": 5, "name": "measured_month", "comment": null}, "last_measured_at": {"type": "DATE", "index": 6, "name": "last_measured_at", "comment": null}, "free_monthly_active_rows": {"type": "INT64", "index": 7, "name": "free_monthly_active_rows", "comment": null}, "paid_monthly_active_rows": {"type": "INT64", "index": 8, "name": "paid_monthly_active_rows", "comment": null}, "total_monthly_active_rows": {"type": "INT64", "index": 9, "name": "total_monthly_active_rows", "comment": null}, "connector_type": {"type": "STRING", "index": 10, "name": "connector_type", "comment": null}, "connector_id": {"type": "STRING", "index": 11, "name": "connector_id", "comment": null}, "destination_name": {"type": "STRING", "index": 12, "name": "destination_name", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__mar_table_history"}, "model.fivetran_log.stg_fivetran_platform__connector": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__connector", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_id": {"type": "STRING", "index": 1, "name": "connector_id", "comment": null}, "connector_name": {"type": "STRING", "index": 2, "name": "connector_name", "comment": null}, "connector_type": {"type": "STRING", "index": 3, "name": "connector_type", "comment": null}, "destination_id": {"type": "STRING", "index": 4, "name": "destination_id", "comment": null}, "connecting_user_id": {"type": "STRING", "index": 5, "name": "connecting_user_id", "comment": null}, "is_paused": {"type": "BOOL", "index": 6, "name": "is_paused", "comment": null}, "set_up_at": {"type": "TIMESTAMP", "index": 7, "name": "set_up_at", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 142, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__connector"}, "model.fivetran_log.stg_fivetran_platform__credits_used": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__credits_used", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "measured_month": {"type": "STRING", "index": 2, "name": "measured_month", "comment": null}, "credits_spent": {"type": "INT64", "index": 3, "name": "credits_spent", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 58, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__credits_used"}, "model.fivetran_log.stg_fivetran_platform__usage_cost": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__usage_cost", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "measured_month": {"type": "STRING", "index": 2, "name": "measured_month", "comment": null}, "dollars_spent": {"type": "FLOAT64", "index": 3, "name": "dollars_spent", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 4, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 132, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__usage_cost"}, "model.fivetran_log.stg_fivetran_platform__destination_membership": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__destination_membership", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "user_id": {"type": "STRING", "index": 2, "name": "user_id", "comment": null}, "activated_at": {"type": "TIMESTAMP", "index": 3, "name": "activated_at", "comment": null}, "joined_at": {"type": "TIMESTAMP", "index": 4, "name": "joined_at", "comment": null}, "destination_role": {"type": "STRING", "index": 5, "name": "destination_role", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 109, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__destination_membership"}, "model.fivetran_log.fivetran_platform__audit_table": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "fivetran_platform__audit_table", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_id": {"type": "STRING", "index": 1, "name": "connector_id", "comment": null}, "connector_name": {"type": "STRING", "index": 2, "name": "connector_name", "comment": null}, "schema_name": {"type": "STRING", "index": 3, "name": "schema_name", "comment": null}, "table_name": {"type": "STRING", "index": 4, "name": "table_name", "comment": null}, "destination_id": {"type": "STRING", "index": 5, "name": "destination_id", "comment": null}, "destination_name": {"type": "STRING", "index": 6, "name": "destination_name", "comment": null}, "write_to_table_start": {"type": "TIMESTAMP", "index": 7, "name": "write_to_table_start", "comment": null}, "write_to_table_end": {"type": "TIMESTAMP", "index": 8, "name": "write_to_table_end", "comment": null}, "sync_start": {"type": "TIMESTAMP", "index": 9, "name": "sync_start", "comment": null}, "sync_end": {"type": "TIMESTAMP", "index": 10, "name": "sync_end", "comment": null}, "sum_rows_replaced_or_inserted": {"type": "INT64", "index": 11, "name": "sum_rows_replaced_or_inserted", "comment": null}, "sum_rows_updated": {"type": "INT64", "index": 12, "name": "sum_rows_updated", "comment": null}, "sum_rows_deleted": {"type": "INT64", "index": 13, "name": "sum_rows_deleted", "comment": null}, "unique_table_sync_key": {"type": "STRING", "index": 14, "name": "unique_table_sync_key", "comment": null}, "sync_start_day": {"type": "TIMESTAMP", "index": 15, "name": "sync_start_day", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 6, "include": true, "description": "Approximate count of rows in this table"}, "partitioning_type": {"id": "partitioning_type", "label": "Partitioned By", "value": "sync_start", "include": true, "description": "The partitioning column for this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1172, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__audit_table"}, "model.fivetran_log.fivetran_platform__connector_status": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "fivetran_platform__connector_status", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_id": {"type": "STRING", "index": 1, "name": "connector_id", "comment": null}, "connector_name": {"type": "STRING", "index": 2, "name": "connector_name", "comment": null}, "connector_type": {"type": "STRING", "index": 3, "name": "connector_type", "comment": null}, "destination_id": {"type": "STRING", "index": 4, "name": "destination_id", "comment": null}, "destination_name": {"type": "STRING", "index": 5, "name": "destination_name", "comment": null}, "connector_health": {"type": "STRING", "index": 6, "name": "connector_health", "comment": null}, "last_successful_sync_completed_at": {"type": "TIMESTAMP", "index": 7, "name": "last_successful_sync_completed_at", "comment": null}, "last_sync_started_at": {"type": "TIMESTAMP", "index": 8, "name": "last_sync_started_at", "comment": null}, "last_sync_completed_at": {"type": "TIMESTAMP", "index": 9, "name": "last_sync_completed_at", "comment": null}, "set_up_at": {"type": "TIMESTAMP", "index": 10, "name": "set_up_at", "comment": null}, "number_of_schema_changes_last_month": {"type": "INT64", "index": 11, "name": "number_of_schema_changes_last_month", "comment": null}, "errors_since_last_completed_sync": {"type": "STRING", "index": 12, "name": "errors_since_last_completed_sync", "comment": null}, "warnings_since_last_completed_sync": {"type": "STRING", "index": 13, "name": "warnings_since_last_completed_sync", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 177, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__connector_status"}, "model.fivetran_log.fivetran_platform__connector_daily_events": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "fivetran_platform__connector_daily_events", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"date_day": {"type": "DATE", "index": 1, "name": "date_day", "comment": null}, "connector_name": {"type": "STRING", "index": 2, "name": "connector_name", "comment": null}, "connector_id": {"type": "STRING", "index": 3, "name": "connector_id", "comment": null}, "connector_type": {"type": "STRING", "index": 4, "name": "connector_type", "comment": null}, "destination_name": {"type": "STRING", "index": 5, "name": "destination_name", "comment": null}, "destination_id": {"type": "STRING", "index": 6, "name": "destination_id", "comment": null}, "count_api_calls": {"type": "INT64", "index": 7, "name": "count_api_calls", "comment": null}, "count_record_modifications": {"type": "INT64", "index": 8, "name": "count_record_modifications", "comment": null}, "count_schema_changes": {"type": "INT64", "index": 9, "name": "count_schema_changes", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2928, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 283344, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__connector_daily_events"}, "model.fivetran_log.fivetran_platform__usage_mar_destination_history": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "fivetran_platform__usage_mar_destination_history", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"measured_month": {"type": "DATE", "index": 1, "name": "measured_month", "comment": null}, "destination_id": {"type": "STRING", "index": 2, "name": "destination_id", "comment": null}, "destination_name": {"type": "STRING", "index": 3, "name": "destination_name", "comment": null}, "credits_spent": {"type": "INT64", "index": 4, "name": "credits_spent", "comment": null}, "dollars_spent": {"type": "FLOAT64", "index": 5, "name": "dollars_spent", "comment": null}, "free_monthly_active_rows": {"type": "INT64", "index": 6, "name": "free_monthly_active_rows", "comment": null}, "paid_monthly_active_rows": {"type": "INT64", "index": 7, "name": "paid_monthly_active_rows", "comment": null}, "total_monthly_active_rows": {"type": "INT64", "index": 8, "name": "total_monthly_active_rows", "comment": null}, "credits_spent_per_million_mar": {"type": "NUMERIC", "index": 9, "name": "credits_spent_per_million_mar", "comment": null}, "mar_per_credit_spent": {"type": "NUMERIC", "index": 10, "name": "mar_per_credit_spent", "comment": null}, "amount_spent_per_million_mar": {"type": "NUMERIC", "index": 11, "name": "amount_spent_per_million_mar", "comment": null}, "mar_per_amount_spent": {"type": "NUMERIC", "index": 12, "name": "mar_per_amount_spent", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__usage_mar_destination_history"}, "model.fivetran_log.stg_fivetran_platform__log_tmp": {"metadata": {"type": "view", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__log_tmp", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "STRING", "index": 1, "name": "id", "comment": null}, "time_stamp": {"type": "TIMESTAMP", "index": 2, "name": "time_stamp", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "connector_id": {"type": "STRING", "index": 4, "name": "connector_id", "comment": null}, "event": {"type": "STRING", "index": 5, "name": "event", "comment": null}, "message_data": {"type": "STRING", "index": 6, "name": "message_data", "comment": null}, "message_event": {"type": "STRING", "index": 7, "name": "message_event", "comment": null}, "transformation_id": {"type": "STRING", "index": 8, "name": "transformation_id", "comment": null}, "sync_id": {"type": "STRING", "index": 9, "name": "sync_id", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.stg_fivetran_platform__log_tmp"}, "model.fivetran_log.fivetran_platform__schema_changelog": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "fivetran_platform__schema_changelog", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_id": {"type": "STRING", "index": 1, "name": "connector_id", "comment": null}, "connector_name": {"type": "STRING", "index": 2, "name": "connector_name", "comment": null}, "destination_id": {"type": "STRING", "index": 3, "name": "destination_id", "comment": null}, "destination_name": {"type": "STRING", "index": 4, "name": "destination_name", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 5, "name": "created_at", "comment": null}, "event_subtype": {"type": "STRING", "index": 6, "name": "event_subtype", "comment": null}, "message_data": {"type": "STRING", "index": 7, "name": "message_data", "comment": null}, "table_name": {"type": "STRING", "index": 8, "name": "table_name", "comment": null}, "schema_name": {"type": "STRING", "index": 9, "name": "schema_name", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.fivetran_log.fivetran_platform__schema_changelog"}, "seed.fivetran_log_integration_tests.connector": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests", "name": "connector", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_id": {"type": "STRING", "index": 1, "name": "connector_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "connecting_user_id": {"type": "STRING", "index": 3, "name": "connecting_user_id", "comment": null}, "connector_name": {"type": "STRING", "index": 4, "name": "connector_name", "comment": null}, "connector_type": {"type": "STRING", "index": 5, "name": "connector_type", "comment": null}, "destination_id": {"type": "STRING", "index": 6, "name": "destination_id", "comment": null}, "paused": {"type": "BOOL", "index": 7, "name": "paused", "comment": null}, "signed_up": {"type": "TIMESTAMP", "index": 8, "name": "signed_up", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 158, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.connector"}, "seed.fivetran_log_integration_tests.log": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests", "name": "log", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "STRING", "index": 1, "name": "id", "comment": null}, "time_stamp": {"type": "TIMESTAMP", "index": 2, "name": "time_stamp", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "connector_id": {"type": "STRING", "index": 4, "name": "connector_id", "comment": null}, "event": {"type": "STRING", "index": 5, "name": "event", "comment": null}, "message_data": {"type": "STRING", "index": 6, "name": "message_data", "comment": null}, "message_event": {"type": "STRING", "index": 7, "name": "message_event", "comment": null}, "transformation_id": {"type": "STRING", "index": 8, "name": "transformation_id", "comment": null}, "sync_id": {"type": "STRING", "index": 9, "name": "sync_id", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 30, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 4596, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.log"}, "seed.fivetran_log_integration_tests.user": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests", "name": "user", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "STRING", "index": 1, "name": "id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 3, "name": "created_at", "comment": null}, "email": {"type": "STRING", "index": 4, "name": "email", "comment": null}, "email_disabled": {"type": "BOOL", "index": 5, "name": "email_disabled", "comment": null}, "family_name": {"type": "STRING", "index": 6, "name": "family_name", "comment": null}, "given_name": {"type": "STRING", "index": 7, "name": "given_name", "comment": null}, "phone": {"type": "INT64", "index": 8, "name": "phone", "comment": null}, "verified": {"type": "BOOL", "index": 9, "name": "verified", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 133, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.user"}, "seed.fivetran_log_integration_tests.incremental_mar": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests", "name": "incremental_mar", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_id": {"type": "STRING", "index": 1, "name": "connector_id", "comment": null}, "destination_id": {"type": "STRING", "index": 2, "name": "destination_id", "comment": null}, "free_type": {"type": "STRING", "index": 3, "name": "free_type", "comment": null}, "measured_date": {"type": "TIMESTAMP", "index": 4, "name": "measured_date", "comment": null}, "schema_name": {"type": "STRING", "index": 5, "name": "schema_name", "comment": null}, "sync_type": {"type": "STRING", "index": 6, "name": "sync_type", "comment": null}, "table_name": {"type": "STRING", "index": 7, "name": "table_name", "comment": null}, "updated_at": {"type": "DATETIME", "index": 8, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 9, "name": "_fivetran_synced", "comment": null}, "incremental_rows": {"type": "INT64", "index": 10, "name": "incremental_rows", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 988, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.incremental_mar"}, "seed.fivetran_log_integration_tests.destination": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests", "name": "destination", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "STRING", "index": 1, "name": "id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "account_id": {"type": "STRING", "index": 3, "name": "account_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 4, "name": "created_at", "comment": null}, "name": {"type": "STRING", "index": 5, "name": "name", "comment": null}, "region": {"type": "STRING", "index": 6, "name": "region", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 139, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.destination"}, "seed.fivetran_log_integration_tests.usage_cost": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests", "name": "usage_cost", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "measured_month": {"type": "STRING", "index": 2, "name": "measured_month", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "amount": {"type": "FLOAT64", "index": 4, "name": "amount", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 4, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 164, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.usage_cost"}, "seed.fivetran_log_integration_tests.credits_used": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests", "name": "credits_used", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "measured_month": {"type": "STRING", "index": 2, "name": "measured_month", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "credits_consumed": {"type": "INT64", "index": 4, "name": "credits_consumed", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 74, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.credits_used"}, "seed.fivetran_log_integration_tests.destination_membership": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests", "name": "destination_membership", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "user_id": {"type": "STRING", "index": 2, "name": "user_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "activated_at": {"type": "TIMESTAMP", "index": 4, "name": "activated_at", "comment": null}, "joined_at": {"type": "TIMESTAMP", "index": 5, "name": "joined_at", "comment": null}, "role": {"type": "STRING", "index": 6, "name": "role", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 125, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.destination_membership"}, "seed.fivetran_log_integration_tests.account": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests", "name": "account", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "STRING", "index": 1, "name": "id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "country": {"type": "INT64", "index": 3, "name": "country", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 4, "name": "created_at", "comment": null}, "name": {"type": "STRING", "index": 5, "name": "name", "comment": null}, "status": {"type": "STRING", "index": 6, "name": "status", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 55, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.fivetran_log_integration_tests.account"}}, "sources": {"source.fivetran_log.fivetran_platform.connector": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests", "name": "connector", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_id": {"type": "STRING", "index": 1, "name": "connector_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "connecting_user_id": {"type": "STRING", "index": 3, "name": "connecting_user_id", "comment": null}, "connector_name": {"type": "STRING", "index": 4, "name": "connector_name", "comment": null}, "connector_type": {"type": "STRING", "index": 5, "name": "connector_type", "comment": null}, "destination_id": {"type": "STRING", "index": 6, "name": "destination_id", "comment": null}, "paused": {"type": "BOOL", "index": 7, "name": "paused", "comment": null}, "signed_up": {"type": "TIMESTAMP", "index": 8, "name": "signed_up", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 158, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.connector"}, "source.fivetran_log.fivetran_platform.log": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests", "name": "log", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "STRING", "index": 1, "name": "id", "comment": null}, "time_stamp": {"type": "TIMESTAMP", "index": 2, "name": "time_stamp", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "connector_id": {"type": "STRING", "index": 4, "name": "connector_id", "comment": null}, "event": {"type": "STRING", "index": 5, "name": "event", "comment": null}, "message_data": {"type": "STRING", "index": 6, "name": "message_data", "comment": null}, "message_event": {"type": "STRING", "index": 7, "name": "message_event", "comment": null}, "transformation_id": {"type": "STRING", "index": 8, "name": "transformation_id", "comment": null}, "sync_id": {"type": "STRING", "index": 9, "name": "sync_id", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 30, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 4596, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.log"}, "source.fivetran_log.fivetran_platform.user": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests", "name": "user", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "STRING", "index": 1, "name": "id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 3, "name": "created_at", "comment": null}, "email": {"type": "STRING", "index": 4, "name": "email", "comment": null}, "email_disabled": {"type": "BOOL", "index": 5, "name": "email_disabled", "comment": null}, "family_name": {"type": "STRING", "index": 6, "name": "family_name", "comment": null}, "given_name": {"type": "STRING", "index": 7, "name": "given_name", "comment": null}, "phone": {"type": "INT64", "index": 8, "name": "phone", "comment": null}, "verified": {"type": "BOOL", "index": 9, "name": "verified", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 133, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.user"}, "source.fivetran_log.fivetran_platform.incremental_mar": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests", "name": "incremental_mar", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"connector_id": {"type": "STRING", "index": 1, "name": "connector_id", "comment": null}, "destination_id": {"type": "STRING", "index": 2, "name": "destination_id", "comment": null}, "free_type": {"type": "STRING", "index": 3, "name": "free_type", "comment": null}, "measured_date": {"type": "TIMESTAMP", "index": 4, "name": "measured_date", "comment": null}, "schema_name": {"type": "STRING", "index": 5, "name": "schema_name", "comment": null}, "sync_type": {"type": "STRING", "index": 6, "name": "sync_type", "comment": null}, "table_name": {"type": "STRING", "index": 7, "name": "table_name", "comment": null}, "updated_at": {"type": "DATETIME", "index": 8, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 9, "name": "_fivetran_synced", "comment": null}, "incremental_rows": {"type": "INT64", "index": 10, "name": "incremental_rows", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 988, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.incremental_mar"}, "source.fivetran_log.fivetran_platform.destination": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests", "name": "destination", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "STRING", "index": 1, "name": "id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "account_id": {"type": "STRING", "index": 3, "name": "account_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 4, "name": "created_at", "comment": null}, "name": {"type": "STRING", "index": 5, "name": "name", "comment": null}, "region": {"type": "STRING", "index": 6, "name": "region", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 139, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.destination"}, "source.fivetran_log.fivetran_platform.usage_cost": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests", "name": "usage_cost", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "measured_month": {"type": "STRING", "index": 2, "name": "measured_month", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "amount": {"type": "FLOAT64", "index": 4, "name": "amount", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 4, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 164, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.usage_cost"}, "source.fivetran_log.fivetran_platform.credits_used": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests", "name": "credits_used", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "measured_month": {"type": "STRING", "index": 2, "name": "measured_month", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "credits_consumed": {"type": "INT64", "index": 4, "name": "credits_consumed", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 74, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.credits_used"}, "source.fivetran_log.fivetran_platform.destination_membership": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests", "name": "destination_membership", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"destination_id": {"type": "STRING", "index": 1, "name": "destination_id", "comment": null}, "user_id": {"type": "STRING", "index": 2, "name": "user_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "activated_at": {"type": "TIMESTAMP", "index": 4, "name": "activated_at", "comment": null}, "joined_at": {"type": "TIMESTAMP", "index": 5, "name": "joined_at", "comment": null}, "role": {"type": "STRING", "index": 6, "name": "role", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 125, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.destination_membership"}, "source.fivetran_log.fivetran_platform.account": {"metadata": {"type": "table", "schema": "fivetran_platform_integration_tests", "name": "account", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "STRING", "index": 1, "name": "id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "country": {"type": "INT64", "index": 3, "name": "country", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 4, "name": "created_at", "comment": null}, "name": {"type": "STRING", "index": 5, "name": "name", "comment": null}, "status": {"type": "STRING", "index": 6, "name": "status", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 55, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.fivetran_log.fivetran_platform.account"}}, "errors": null}
\ No newline at end of file
diff --git a/docs/manifest.json b/docs/manifest.json
index 2090c526..72d00a55 100644
--- a/docs/manifest.json
+++ b/docs/manifest.json
@@ -1 +1 @@
-{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v11.json", "dbt_version": "1.7.3", "generated_at": "2023-12-12T19:08:28.222381Z", "invocation_id": "c0fa594b-cab7-478a-aeb0-a325788070ef", "env": {}, "project_name": "fivetran_log_integration_tests", "project_id": "601c934d3c286a01c58ed00bc69f8e64", "user_id": "2bfa9082-ea6e-467b-abdc-d0514ab111d9", "send_anonymous_usage_stats": true, "adapter_type": "snowflake"}, "nodes": {"seed.fivetran_log_integration_tests.log": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "log", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "log.csv", "original_file_path": "seeds/log.csv", "unique_id": "seed.fivetran_log_integration_tests.log", "fqn": ["fivetran_log_integration_tests", "log"], "alias": "log", "checksum": {"name": "sha256", "checksum": "3637d563f8916ee1a902edb08e4cd17c35bb975b7b6ca34093b553853e58edcc"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "time_stamp": "timestamp", "transformation_id": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"time_stamp": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}", "transformation_id": "{{ 'string' if target.type in ('bigquery', 'spark', 'databricks') else 'varchar' if target.type != 'sqlserver' else 'varchar(256)' }}"}}, "created_at": 1702408015.7380102, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.log", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.destination_membership": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "destination_membership", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "destination_membership.csv", "original_file_path": "seeds/destination_membership.csv", "unique_id": "seed.fivetran_log_integration_tests.destination_membership", "fqn": ["fivetran_log_integration_tests", "destination_membership"], "alias": "destination_membership", "checksum": {"name": "sha256", "checksum": "ea1c1b6a3929e8d4de990970c8cc497af21e2a5e12c1623be69462c22a3b0e1a"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "activated_at": "timestamp", "joined_at": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"activated_at": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}", "joined_at": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"}}, "created_at": 1702408015.7467039, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.destination_membership", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.credits_used": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "credits_used", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "credits_used.csv", "original_file_path": "seeds/credits_used.csv", "unique_id": "seed.fivetran_log_integration_tests.credits_used", "fqn": ["fivetran_log_integration_tests", "credits_used"], "alias": "credits_used", "checksum": {"name": "sha256", "checksum": "b6954f4070acaf5073fc4c4001c3ab8ebc254e0ddbe2226ba063e0cbc3001d7f"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "credits_consumed": "bigint"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"credits_consumed": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"}}, "created_at": 1702408015.748297, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.credits_used", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.destination": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "destination", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "destination.csv", "original_file_path": "seeds/destination.csv", "unique_id": "seed.fivetran_log_integration_tests.destination", "fqn": ["fivetran_log_integration_tests", "destination"], "alias": "destination", "checksum": {"name": "sha256", "checksum": "0f6955f215269c7d8754298fb9485f3196765564fccf9a138cf02a8ccb160ab3"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "created_at": "timestamp", "id": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"created_at": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}", "id": "{{ 'string' if target.type in ('bigquery', 'spark', 'databricks') else 'varchar' if target.type != 'sqlserver' else 'varchar(256)' }}"}}, "created_at": 1702408015.749771, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.destination", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.connector": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "connector", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "connector.csv", "original_file_path": "seeds/connector.csv", "unique_id": "seed.fivetran_log_integration_tests.connector", "fqn": ["fivetran_log_integration_tests", "connector"], "alias": "connector", "checksum": {"name": "sha256", "checksum": "8b9be1f60c7b2e33da88c97eb66a3241cb6fffad4af3e7e32c355f8f27c0c34c"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "signed_up": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"signed_up": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"}}, "created_at": 1702408015.7512288, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.connector", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.user": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "user", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "user.csv", "original_file_path": "seeds/user.csv", "unique_id": "seed.fivetran_log_integration_tests.user", "fqn": ["fivetran_log_integration_tests", "user"], "alias": "user", "checksum": {"name": "sha256", "checksum": "ce690544aed43600d42695a8fdf5e1fa14c342c04b22cadcbdb0934a0cf92a0e"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "created_at": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"created_at": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"}}, "created_at": 1702408015.752674, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.user", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.account": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "account", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "account.csv", "original_file_path": "seeds/account.csv", "unique_id": "seed.fivetran_log_integration_tests.account", "fqn": ["fivetran_log_integration_tests", "account"], "alias": "account", "checksum": {"name": "sha256", "checksum": "ec33e80835ab8169b97dd17dd2699f84862f798de4c2d0a90c8d261a111d3495"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "created_at": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"created_at": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"}}, "created_at": 1702408015.754123, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.account", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.usage_cost": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "usage_cost", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "usage_cost.csv", "original_file_path": "seeds/usage_cost.csv", "unique_id": "seed.fivetran_log_integration_tests.usage_cost", "fqn": ["fivetran_log_integration_tests", "usage_cost"], "alias": "usage_cost", "checksum": {"name": "sha256", "checksum": "3cbe3dadc6ca6dd2383cd5172fe2688bccf65af0b6bc30a7583c85aa41185a58"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"_fivetran_synced": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"}}, "created_at": 1702408015.755662, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.usage_cost", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.incremental_mar": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "incremental_mar", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "incremental_mar.csv", "original_file_path": "seeds/incremental_mar.csv", "unique_id": "seed.fivetran_log_integration_tests.incremental_mar", "fqn": ["fivetran_log_integration_tests", "incremental_mar"], "alias": "incremental_mar", "checksum": {"name": "sha256", "checksum": "e567d62bbb002d465ce48fea541f7d075cd7ceb5c82f439f4a9d4e715bd13018"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "measured_date": "timestamp", "incremental_rows": "bigint"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"measured_date": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}", "incremental_rows": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"}}, "created_at": 1702408015.757069, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.incremental_mar", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "model.fivetran_log.fivetran_platform__schema_changelog": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__schema_changelog", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__schema_changelog.sql", "original_file_path": "models/fivetran_platform__schema_changelog.sql", "unique_id": "model.fivetran_log.fivetran_platform__schema_changelog", "fqn": ["fivetran_log", "fivetran_platform__schema_changelog"], "alias": "fivetran_platform__schema_changelog", "checksum": {"name": "sha256", "checksum": "cdd229f1dc2246a7a1b6f89528d31a71868318f4d34ff7984fe6cca7cb8f63fd"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table capturing information around each kind of schema change made to a connector. Schema changes include altering and creating tables, changing the schema configuration, and creating schemas. \n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector whose schema was changed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination that the table is being written to.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the schema was changed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_subtype": {"name": "event_subtype", "description": "Type of schema change event. One of 'alter_table', 'create_table', 'change_schema_config', 'create_schema'.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_data": {"name": "message_data", "description": "The details of the event in JSON format.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Name of the table, if a table is being altered or created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "Name of the schema, if a schema or table is being created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.086418, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__schema_changelog", "raw_code": "with schema_changes as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__log') }}\n\n    where event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n),\n\nconnector as (\n\n    select *\n    from {{ ref('fivetran_platform__connector_status') }}\n),\n\nadd_connector_info as (\n\n    select \n        schema_changes.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n\n    from schema_changes join connector \n        on schema_changes.connector_id = connector.connector_id\n),\n\nfinal as (\n\n    select\n        connector_id,\n        connector_name,\n        destination_id,\n        destination_name,\n        created_at,\n        event_subtype,\n        message_data,\n\n        case \n        when event_subtype = 'alter_table' then {{ fivetran_utils.json_parse(string='message_data', string_path=['table']) }} \n        when event_subtype = 'create_table' then {{ fivetran_utils.json_parse(string='message_data', string_path=['name']) }} \n        else null end as table_name,\n\n        case \n        when event_subtype = 'create_schema' or event_subtype = 'create_table' then {{ fivetran_utils.json_parse(string='message_data', string_path=['schema']) }} \n        else null end as schema_name\n    \n    from add_connector_info\n)\n\nselect * from final\n{% if target.type != 'sqlserver' %}\norder by created_at desc, connector_id\n{% endif %}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "fivetran_platform__connector_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_utils.json_parse"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.fivetran_platform__connector_status"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__schema_changelog.sql", "compiled": true, "compiled_code": "with schema_changes as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n\n    where event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n),\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status\n),\n\nadd_connector_info as (\n\n    select \n        schema_changes.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n\n    from schema_changes join connector \n        on schema_changes.connector_id = connector.connector_id\n),\n\nfinal as (\n\n    select\n        connector_id,\n        connector_name,\n        destination_id,\n        destination_name,\n        created_at,\n        event_subtype,\n        message_data,\n\n        case \n        when event_subtype = 'alter_table' then \n\n  parse_json( message_data )['table'] \n        when event_subtype = 'create_table' then \n\n  parse_json( message_data )['name'] \n        else null end as table_name,\n\n        case \n        when event_subtype = 'create_schema' or event_subtype = 'create_table' then \n\n  parse_json( message_data )['schema'] \n        else null end as schema_name\n    \n    from add_connector_info\n)\n\nselect * from final\n\norder by created_at desc, connector_id\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__connector_daily_events": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__connector_daily_events", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__connector_daily_events.sql", "original_file_path": "models/fivetran_platform__connector_daily_events.sql", "unique_id": "model.fivetran_log.fivetran_platform__connector_daily_events", "fqn": ["fivetran_log", "fivetran_platform__connector_daily_events"], "alias": "fivetran_platform__connector_daily_events", "checksum": {"name": "sha256", "checksum": "9a9535f338aef0d59fecd2804044c9a51e376ea6dd7f59e33a8ebcdb1e710375"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of each connector's daily history of the quantity of api calls, schema changes, and records modified, starting at the connector's setup date. \n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination loading data from this connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "date_day": {"name": "date_day", "description": "Date on which the number of api calls for the connector is measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "count_api_calls": {"name": "count_api_calls", "description": "The number of api call events logged for this connector on this day.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "count_record_modifications": {"name": "count_record_modifications", "description": "The sum of all records modified (includes updates, inserts, and deletes).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "count_schema_changes": {"name": "count_schema_changes", "description": "The number of schema change events for this connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.0837162, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_daily_events", "raw_code": "-- depends_on: {{ var('connector') }}\n\nwith connector as (\n    \n    select * \n    from {{ ref('fivetran_platform__connector_status') }}\n),\n\n-- grab api calls, schema changes, and record modifications\nlog_events as (\n\n    select \n        connector_id,\n        cast( {{ dbt.date_trunc('day', 'created_at') }} as date) as date_day,\n        case \n            when event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config') then 'schema_change' \n            else event_subtype end as event_subtype,\n\n        sum(case when event_subtype = 'records_modified' then cast( {{ fivetran_utils.json_parse(string='message_data', string_path=['count']) }} as {{ dbt.type_int()}} )\n        else 1 end) as count_events \n\n    from {{ ref('stg_fivetran_platform__log') }}\n\n    where event_subtype in ('api_call', \n                            'records_modified', \n                            'create_table', 'alter_table', 'create_schema', 'change_schema_config') -- all schema changes\n                            \n        and connector_id is not null\n\n    group by connector_id, cast( {{ dbt.date_trunc('day', 'created_at') }} as date), event_subtype\n),\n\npivot_out_events as (\n\n    select\n        connector_id,\n        date_day,\n        max(case when event_subtype = 'api_call' then count_events else 0 end) as count_api_calls,\n        max(case when event_subtype = 'records_modified' then count_events else 0 end) as count_record_modifications,\n        max(case when event_subtype = 'schema_change' then count_events else 0 end) as count_schema_changes\n\n    from log_events\n    group by connector_id, date_day\n), \n\nconnector_event_counts as (\n\n    select\n        pivot_out_events.date_day,\n        pivot_out_events.count_api_calls,\n        pivot_out_events.count_record_modifications,\n        pivot_out_events.count_schema_changes,\n        connector.connector_name,\n        connector.connector_id,\n        connector.connector_type,\n        connector.destination_name,\n        connector.destination_id,\n        connector.set_up_at\n    from\n    connector left join pivot_out_events \n        on pivot_out_events.connector_id = connector.connector_id\n),\n\nspine as (\n\n    {% if execute %}\n    {% set first_date_query %}\n        select  min( signed_up ) as min_date from {{ var('connector') }}\n    {% endset %}\n    {% set first_date = run_query(first_date_query).columns[0][0]|string %}\n    \n    {% else %} {% set first_date = \"2016-01-01\" %}\n    {% endif %}\n\n    select cast(date_day as date) as date_day\n    from (\n        {{ fivetran_utils.fivetran_date_spine(\n            datepart = \"day\", \n            start_date =  \"cast('\" ~ first_date[0:10] ~ \"' as date)\", \n            end_date = dbt.dateadd(\"week\", 1, dbt.date_trunc('day', dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp())) \n            ) \n        }} \n    ) as date_spine\n),\n\nconnector_event_history as (\n\n    select\n        spine.date_day,\n        connector_event_counts.connector_name,\n        connector_event_counts.connector_id,\n        connector_event_counts.connector_type,\n        connector_event_counts.destination_name,\n        connector_event_counts.destination_id,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_api_calls\n            else 0\n        end) as count_api_calls,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_record_modifications\n            else 0\n        end) as count_record_modifications,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_schema_changes\n            else 0\n        end) as count_schema_changes\n    from\n    spine join connector_event_counts\n        on spine.date_day  >= cast({{ dbt.date_trunc('day', 'cast(connector_event_counts.set_up_at as date)') }} as date)\n\n    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id\n),\n\n-- now rejoin spine to get a complete calendar\njoin_event_history as (\n    \n    select\n        spine.date_day,\n        connector_event_history.connector_name,\n        connector_event_history.connector_id,\n        connector_event_history.connector_type,\n        connector_event_history.destination_name,\n        connector_event_history.destination_id,\n        max(connector_event_history.count_api_calls) as count_api_calls,\n        max(connector_event_history.count_record_modifications) as count_record_modifications,\n        max(connector_event_history.count_schema_changes) as count_schema_changes\n\n    from\n    spine left join connector_event_history\n        on spine.date_day = connector_event_history.date_day\n\n    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id\n),\n\nfinal as (\n\n    select *\n    from join_event_history\n\n    where date_day <= cast({{ dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp() }} as date)\n\n    {% if target.type != 'sqlserver' %} -- sql server cant order CTEs\n    order by date_day desc\n    {% endif %}\n)\n\nselect *\nfrom final", "language": "sql", "refs": [{"name": "fivetran_platform__connector_status", "package": null, "version": null}, {"name": "stg_fivetran_platform__log", "package": null, "version": null}], "sources": [["fivetran_platform", "connector"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.fivetran_utils.json_parse", "macro.dbt.type_int", "macro.dbt.current_timestamp_backcompat", "macro.dbt.dateadd", "macro.fivetran_utils.fivetran_date_spine", "macro.dbt.run_query"], "nodes": ["source.fivetran_log.fivetran_platform.connector", "model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.stg_fivetran_platform__log"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__connector_daily_events.sql", "compiled": true, "compiled_code": "-- depends_on: DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.connector\n\nwith connector as (\n    \n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status\n),\n\n-- grab api calls, schema changes, and record modifications\nlog_events as (\n\n    select \n        connector_id,\n        cast( date_trunc('day', created_at) as date) as date_day,\n        case \n            when event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config') then 'schema_change' \n            else event_subtype end as event_subtype,\n\n        sum(case when event_subtype = 'records_modified' then cast( \n\n  parse_json( message_data )['count'] as integer )\n        else 1 end) as count_events \n\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n\n    where event_subtype in ('api_call', \n                            'records_modified', \n                            'create_table', 'alter_table', 'create_schema', 'change_schema_config') -- all schema changes\n                            \n        and connector_id is not null\n\n    group by connector_id, cast( date_trunc('day', created_at) as date), event_subtype\n),\n\npivot_out_events as (\n\n    select\n        connector_id,\n        date_day,\n        max(case when event_subtype = 'api_call' then count_events else 0 end) as count_api_calls,\n        max(case when event_subtype = 'records_modified' then count_events else 0 end) as count_record_modifications,\n        max(case when event_subtype = 'schema_change' then count_events else 0 end) as count_schema_changes\n\n    from log_events\n    group by connector_id, date_day\n), \n\nconnector_event_counts as (\n\n    select\n        pivot_out_events.date_day,\n        pivot_out_events.count_api_calls,\n        pivot_out_events.count_record_modifications,\n        pivot_out_events.count_schema_changes,\n        connector.connector_name,\n        connector.connector_id,\n        connector.connector_type,\n        connector.destination_name,\n        connector.destination_id,\n        connector.set_up_at\n    from\n    connector left join pivot_out_events \n        on pivot_out_events.connector_id = connector.connector_id\n),\n\nspine as (\n\n    \n    \n    \n    \n    \n\n    select cast(date_day as date) as date_day\n    from (\n        \n\n    \n\n\n\n\n\nwith rawdata as (\n\n    \n\n    \n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    \n    p0.generated_number * power(2, 0)\n     + \n    \n    p1.generated_number * power(2, 1)\n     + \n    \n    p2.generated_number * power(2, 2)\n     + \n    \n    p3.generated_number * power(2, 3)\n     + \n    \n    p4.generated_number * power(2, 4)\n     + \n    \n    p5.generated_number * power(2, 5)\n     + \n    \n    p6.generated_number * power(2, 6)\n     + \n    \n    p7.generated_number * power(2, 7)\n     + \n    \n    p8.generated_number * power(2, 8)\n     + \n    \n    p9.generated_number * power(2, 9)\n     + \n    \n    p10.generated_number * power(2, 10)\n    \n    \n    + 1\n    as generated_number\n\n    from\n\n    \n    p as p0\n     cross join \n    \n    p as p1\n     cross join \n    \n    p as p2\n     cross join \n    \n    p as p3\n     cross join \n    \n    p as p4\n     cross join \n    \n    p as p5\n     cross join \n    \n    p as p6\n     cross join \n    \n    p as p7\n     cross join \n    \n    p as p8\n     cross join \n    \n    p as p9\n     cross join \n    \n    p as p10\n    \n    \n\n    )\n\n    select *\n    from unioned\n    where generated_number <= 1733\n    order by generated_number\n\n\n\n),\n\nall_periods as (\n\n    select (\n        \n\n    dateadd(\n        day,\n        row_number() over (order by 1) - 1,\n        cast('2019-03-22' as date)\n        )\n\n\n    ) as date_day\n    from rawdata\n\n),\n\nfiltered as (\n\n    select *\n    from all_periods\n    where date_day <= \n\n    dateadd(\n        week,\n        1,\n        date_trunc('day', \n  current_timestamp::timestamp\n)\n        )\n\n\n\n)\n\nselect * from filtered\n\n\n        \n \n    ) as date_spine\n),\n\nconnector_event_history as (\n\n    select\n        spine.date_day,\n        connector_event_counts.connector_name,\n        connector_event_counts.connector_id,\n        connector_event_counts.connector_type,\n        connector_event_counts.destination_name,\n        connector_event_counts.destination_id,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_api_calls\n            else 0\n        end) as count_api_calls,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_record_modifications\n            else 0\n        end) as count_record_modifications,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_schema_changes\n            else 0\n        end) as count_schema_changes\n    from\n    spine join connector_event_counts\n        on spine.date_day  >= cast(date_trunc('day', cast(connector_event_counts.set_up_at as date)) as date)\n\n    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id\n),\n\n-- now rejoin spine to get a complete calendar\njoin_event_history as (\n    \n    select\n        spine.date_day,\n        connector_event_history.connector_name,\n        connector_event_history.connector_id,\n        connector_event_history.connector_type,\n        connector_event_history.destination_name,\n        connector_event_history.destination_id,\n        max(connector_event_history.count_api_calls) as count_api_calls,\n        max(connector_event_history.count_record_modifications) as count_record_modifications,\n        max(connector_event_history.count_schema_changes) as count_schema_changes\n\n    from\n    spine left join connector_event_history\n        on spine.date_day = connector_event_history.date_day\n\n    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id\n),\n\nfinal as (\n\n    select *\n    from join_event_history\n\n    where date_day <= cast(\n  current_timestamp::timestamp\n as date)\n\n     -- sql server cant order CTEs\n    order by date_day desc\n    \n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__audit_user_activity": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__audit_user_activity", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__audit_user_activity.sql", "original_file_path": "models/fivetran_platform__audit_user_activity.sql", "unique_id": "model.fivetran_log.fivetran_platform__audit_user_activity", "fqn": ["fivetran_log", "fivetran_platform__audit_user_activity"], "alias": "fivetran_platform__audit_user_activity", "checksum": {"name": "sha256", "checksum": "bb023dcde9b2d6ba20219f1818540bf5539108c0a826c87f6b281b853a34b3cf"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Each record represents a user-triggered action in your Fivetran instance.This model is intended for audit-trail purposes, as it can be very helpful when trying to trace a user action to a [log event](https://fivetran.com/docs/logs#logeventlist) such as a schema change, sync frequency update,  manual update, broken connection, etc.\n", "columns": {"date_day": {"name": "date_day", "description": "Date on which the user action occurred.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "day_name": {"name": "day_name", "description": "Abbreviated weekday name of the date on which this user action occurred (e.g. Mon, Tues, Wed)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "day_of_month": {"name": "day_of_month", "description": "Day of the month on which this user action occurred (e.g. 2022-03-06 --> 6).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "occurred_at": {"name": "occurred_at", "description": "Timestamp of when the event was logged.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "UI-facing name of the destination on which the user action was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` on which the user action was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector that the user acted upon.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "Foreign key referencing the `connector` that the user acted upon.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "Account email of the user who triggered the action.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "Given name of the user who triggered the action.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "Surname of the user who triggered the action.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "Foreign key referencing the `user` who triggered the action.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_role": {"name": "destination_role", "description": "The acting user's permissions for this individual destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_type": {"name": "event_type", "description": "The umbrella event type. Events can be classified as a warning, an error, or just an information log. Typically = 'INFO' for user-triggered actions.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_subtype": {"name": "event_subtype", "description": "The routine involved in the log event, defined [here](https://fivetran.com/docs/logs#logevents).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_data": {"name": "message_data", "description": "The details of the event in JSON format.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "log_id": {"name": "log_id", "description": "Unique ID of the log record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.0883992, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_user_activity", "raw_code": "with logs as (\n\n    select \n        *,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['actor']) }} as actor_email\n    from {{ ref('stg_fivetran_platform__log') }}\n),\n\nuser_logs as (\n\n    select *\n    from logs\n    where actor_email is not null \n        and lower(actor_email) != 'fivetran'\n),\n\nconnector as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__connector') }}\n),\n\ndestination as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__destination') }}\n),\n\n{%- if var('fivetran_platform_using_user', true) %}\nusers as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__user') }}\n),\n\n    {%- if var('fivetran_platform_using_destination_membership', true) %}\n    destination_membership as (\n\n        select *\n        from {{ ref('stg_fivetran_platform__destination_membership') }}\n    ),\n    {% endif -%}\n\n{% endif -%}\n\nfinal as (\n\n    select\n        {{ dbt.date_trunc('day', 'user_logs.created_at') }} as date_day,\n        \n        {% if target.type != 'sqlserver' -%}\n            {{ dbt_date.day_name('user_logs.created_at') }} as day_name,\n            {{ dbt_date.day_of_month('user_logs.created_at') }} as day_of_month,\n        {% else -%} \n            format(cast(user_logs.created_at as date), 'ddd') as day_name,\n            day(user_logs.created_at) as day_of_month,\n        {% endif -%} \n        \n        user_logs.created_at as occurred_at,\n        destination.destination_name,\n        destination.destination_id,\n        connector.connector_name,\n        connector.connector_id,\n        user_logs.actor_email as email,\n{%- if var('fivetran_platform_using_user', true) %}\n        users.first_name,\n        users.last_name,\n        users.user_id,\n    {%- if var('fivetran_platform_using_destination_membership', true) %}\n        destination_membership.destination_role,\n    {% endif -%}\n{% endif -%}\n\n        user_logs.event_type, -- should always be INFO for user-triggered actions but include just in case\n        user_logs.event_subtype,\n        user_logs.message_data,\n        user_logs.log_id\n\n    from user_logs\n    left join connector\n        on user_logs.connector_id = connector.connector_id\n    left join destination\n        on connector.destination_id = destination.destination_id\n\n{%- if var('fivetran_platform_using_user', true) %}\n    left join users \n        on lower(users.email) = lower(user_logs.actor_email)\n\n    {%- if var('fivetran_platform_using_destination_membership', true) %}\n    left join destination_membership\n        on destination.destination_id = destination_membership.destination_id\n        and users.user_id = destination_membership.user_id\n\n    {% endif -%}\n{% endif -%}\n\n)\n\nselect *\nfrom final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "stg_fivetran_platform__connector", "package": null, "version": null}, {"name": "stg_fivetran_platform__destination", "package": null, "version": null}, {"name": "stg_fivetran_platform__user", "package": null, "version": null}, {"name": "stg_fivetran_platform__destination_membership", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_utils.json_parse", "macro.dbt.date_trunc", "macro.dbt_date.day_name", "macro.dbt_date.day_of_month"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination", "model.fivetran_log.stg_fivetran_platform__user", "model.fivetran_log.stg_fivetran_platform__destination_membership"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__audit_user_activity.sql", "compiled": true, "compiled_code": "with logs as (\n\n    select \n        *,\n        \n\n  parse_json( message_data )['actor'] as actor_email\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n),\n\nuser_logs as (\n\n    select *\n    from logs\n    where actor_email is not null \n        and lower(actor_email) != 'fivetran'\n),\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector\n),\n\ndestination as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\n),\nusers as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__user\n),\n    destination_membership as (\n\n        select *\n        from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination_membership\n    ),\n    final as (\n\n    select\n        date_trunc('day', user_logs.created_at) as date_day,\n        \n        dayname(user_logs.created_at) as day_name,\n            date_part('day', user_logs.created_at) as day_of_month,\n        user_logs.created_at as occurred_at,\n        destination.destination_name,\n        destination.destination_id,\n        connector.connector_name,\n        connector.connector_id,\n        user_logs.actor_email as email,\n        users.first_name,\n        users.last_name,\n        users.user_id,\n        destination_membership.destination_role,\n    user_logs.event_type, -- should always be INFO for user-triggered actions but include just in case\n        user_logs.event_subtype,\n        user_logs.message_data,\n        user_logs.log_id\n\n    from user_logs\n    left join connector\n        on user_logs.connector_id = connector.connector_id\n    left join destination\n        on connector.destination_id = destination.destination_id\n    left join users \n        on lower(users.email) = lower(user_logs.actor_email)\n    left join destination_membership\n        on destination.destination_id = destination_membership.destination_id\n        and users.user_id = destination_membership.user_id\n\n    )\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__connector_status": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__connector_status", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__connector_status.sql", "original_file_path": "models/fivetran_platform__connector_status.sql", "unique_id": "model.fivetran_log.fivetran_platform__connector_status", "fqn": ["fivetran_log", "fivetran_platform__connector_status"], "alias": "fivetran_platform__connector_status", "checksum": {"name": "sha256", "checksum": "0f06065d380f8db0d7e71883967d2769783e211b4f20a90ccb6dcbb0bef41190"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of each destination's connector and details surrounding its  connection and data-sync status.\n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination loading data from this connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_health": {"name": "connector_health", "description": "Status of the connector's data flow. Can be `\"broken\"`, `\"incomplete\"`, `\"connected\"`, `\"paused\"`, `\"initial sync in progress\"`, or `\"priority first sync\"`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_successful_sync_completed_at": {"name": "last_successful_sync_completed_at", "description": "Timestamp of when the last sync attempt was completed. This could be either a failure or a successful sync.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_sync_started_at": {"name": "last_sync_started_at", "description": "Timestamp of when the last sync was started. Note that if new data comes in after a sync has  begun, the new data will not be included in this sync.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_sync_completed_at": {"name": "last_sync_completed_at", "description": "Timestamp of when the last sync was completed.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "set_up_at": {"name": "set_up_at", "description": "Timestamp of when the connector was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "number_of_schema_changes_last_month": {"name": "number_of_schema_changes_last_month", "description": "The number of schema changes (creating tables or schemas and altering tables) in the past 30 days.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "errors_since_last_completed_sync": {"name": "errors_since_last_completed_sync", "description": "Aggregated line-separated list of error messages (in JSON format) raised synce the last  sync completion. \n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "warnings_since_last_completed_sync": {"name": "warnings_since_last_completed_sync", "description": "Aggregated line-separated list of warning messages (in JSON format) raised synce the last  sync completion. \n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.079627, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status", "raw_code": "with transformation_removal as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__log') }}\n    where transformation_id is null\n\n),\n\nconnector_log as (\n    select \n        *,\n        sum( case when event_subtype in ('sync_start') then 1 else 0 end) over ( partition by connector_id \n            order by created_at rows unbounded preceding) as sync_batch_id\n    from transformation_removal\n    -- only looking at errors, warnings, and syncs here\n    where event_type = 'SEVERE'\n        or event_type = 'WARNING'\n        or event_subtype like 'sync%'\n        or (event_subtype = 'status' \n            and {{ fivetran_utils.json_parse(string=\"message_data\", string_path=[\"status\"]) }} = 'RESCHEDULED'\n            \n            and {{ fivetran_utils.json_parse(string=\"message_data\", string_path=[\"reason\"]) }} like '%intended behavior%'\n            ) -- for priority-first syncs. these should be captured by event_type = 'WARNING' but let's make sure\n        or (event_subtype = 'status' \n            and {{ fivetran_utils.json_parse(string=\"message_data\", string_path=[\"status\"]) }} = 'SUCCESSFUL'\n        )\n        -- whole reason is \"We have rescheduled the connector to force flush data from the forward sync into your destination. This is intended behavior and means that the connector is working as expected.\"\n),\n\nschema_changes as (\n\n    select\n        connector_id,\n        count(*) as number_of_schema_changes_last_month\n\n    from {{ ref('stg_fivetran_platform__log') }}\n\n    where \n        {{ dbt.datediff('created_at', dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp(), 'day') }} <= 30\n        and event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n\n    group by connector_id\n\n),\n\nconnector as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__connector') }}\n\n),\n\ndestination as (\n\n    select * \n    from {{ ref('stg_fivetran_platform__destination') }}\n),\n\nconnector_metrics as (\n\n    select\n        connector.connector_id,\n        connector.connector_name,\n        connector.connector_type,\n        connector.destination_id,\n        connector.is_paused,\n        connector.set_up_at,\n        max(case when connector_log.event_subtype = 'sync_start' then connector_log.created_at else null end) as last_sync_started_at,\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.created_at else null end) as last_sync_completed_at,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"status\"]) }} ='SUCCESSFUL'\n            then connector_log.created_at else null end) as last_successful_sync_completed_at,\n\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.sync_batch_id else null end) as last_sync_batch_id,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"status\"]) }} ='RESCHEDULED'\n                and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"reason\"]) }} like '%intended behavior%'\n            then connector_log.created_at else null end) as last_priority_first_sync_completed_at,\n                \n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.created_at else null end) as last_error_at,\n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.sync_batch_id else null end) as last_error_batch,\n        max(case when event_type = 'WARNING' then connector_log.created_at else null end) as last_warning_at\n\n    from connector \n    left join connector_log \n        on connector_log.connector_id = connector.connector_id\n    group by connector.connector_id, connector.connector_name, connector.connector_type, connector.destination_id, connector.is_paused, connector.set_up_at\n),\n\nconnector_health_status as (\n\n    select\n        *,\n        case \n            -- connector is paused\n            when is_paused {{ ' = 1' if target.type == 'sqlserver' else '' }} then 'paused'\n\n            -- a sync has never been attempted\n            when last_sync_started_at is null then 'incomplete'\n\n            -- a priority-first sync has occurred, but a normal sync has not\n            when last_priority_first_sync_completed_at is not null and last_sync_completed_at is null then 'priority first sync'\n\n            -- a priority sync has occurred more recently than a normal one (may occurr if the connector has been paused and resumed)\n            when last_priority_first_sync_completed_at > last_sync_completed_at then 'priority first sync'\n\n            -- a sync has been attempted, but not completed, and it's not due to errors. also a priority-first sync hasn't\n            when last_sync_completed_at is null and last_error_at is null then 'initial sync in progress'\n\n            -- the last attempted sync had an error\n            when last_sync_batch_id = last_error_batch then 'broken'\n\n            -- there's never been a successful sync and there have been errors\n            when last_sync_completed_at is null and last_error_at is not null then 'broken'\n\n        else 'connected' end as connector_health\n\n    from connector_metrics\n),\n\n-- Joining with log to grab pertinent error/warning messagees\nconnector_recent_logs as (\n\n    select \n        connector_health_status.connector_id,\n        connector_health_status.connector_name,\n        connector_health_status.connector_type,\n        connector_health_status.destination_id,\n        connector_health_status.connector_health,\n        connector_health_status.last_successful_sync_completed_at,\n        connector_health_status.last_sync_started_at,\n        connector_health_status.last_sync_completed_at,\n        connector_health_status.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n    from connector_health_status \n    left join connector_log \n        on connector_log.connector_id = connector_health_status.connector_id\n        -- limiting relevance to since the last successful sync completion (if there has been one)\n        and connector_log.created_at > coalesce(connector_health_status.last_sync_completed_at, connector_health_status.last_priority_first_sync_completed_at, '2000-01-01') \n        -- only looking at errors and warnings (excluding syncs - both normal and priority first)\n        and connector_log.event_type != 'INFO' \n        -- need to explicitly avoid priority first statuses because they are of event_type WARNING\n        and not (connector_log.event_subtype = 'status' \n            and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"status\"]) }} ='RESCHEDULED'\n            and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"reason\"]) }} like '%intended behavior%')\n\n    group by -- remove duplicates\n        connector_health_status.connector_id,\n        connector_health_status.connector_name,\n        connector_health_status.connector_type,\n        connector_health_status.destination_id,\n        connector_health_status.connector_health,\n        connector_health_status.last_successful_sync_completed_at,\n        connector_health_status.last_sync_started_at,\n        connector_health_status.last_sync_completed_at,\n        connector_health_status.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n),\n\nfinal as (\n\n    select\n        connector_recent_logs.connector_id,\n        connector_recent_logs.connector_name,\n        connector_recent_logs.connector_type,\n        connector_recent_logs.destination_id,\n        destination.destination_name,\n        connector_recent_logs.connector_health,\n        connector_recent_logs.last_successful_sync_completed_at,\n        connector_recent_logs.last_sync_started_at,\n        connector_recent_logs.last_sync_completed_at,\n        connector_recent_logs.set_up_at,\n        coalesce(schema_changes.number_of_schema_changes_last_month, 0) as number_of_schema_changes_last_month\n        \n        {% if var('fivetran_platform_using_sync_alert_messages', true) %}\n        , {{ fivetran_utils.string_agg(\"case when connector_recent_logs.event_type = 'SEVERE' then connector_recent_logs.message_data else null end\", \"'\\\\n'\") }} as errors_since_last_completed_sync\n        , {{ fivetran_utils.string_agg(\"case when connector_recent_logs.event_type = 'WARNING' then connector_recent_logs.message_data else null end\", \"'\\\\n'\") }} as warnings_since_last_completed_sync\n        {% endif %}\n\n    from connector_recent_logs\n    left join schema_changes \n        on connector_recent_logs.connector_id = schema_changes.connector_id \n\n    join destination on destination.destination_id = connector_recent_logs.destination_id\n    group by \n        connector_recent_logs.connector_id, \n        connector_recent_logs.connector_name, \n        connector_recent_logs.connector_type, \n        connector_recent_logs.destination_id, \n        destination.destination_name, \n        connector_recent_logs.connector_health, \n        connector_recent_logs.last_successful_sync_completed_at, \n        connector_recent_logs.last_sync_started_at, \n        connector_recent_logs.last_sync_completed_at, \n        connector_recent_logs.set_up_at, \n        number_of_schema_changes_last_month\n)\n\nselect * from final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "stg_fivetran_platform__connector", "package": null, "version": null}, {"name": "stg_fivetran_platform__destination", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_utils.json_parse", "macro.dbt.current_timestamp_backcompat", "macro.dbt.datediff", "macro.fivetran_utils.string_agg"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__connector_status.sql", "compiled": true, "compiled_code": "with transformation_removal as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n    where transformation_id is null\n\n),\n\nconnector_log as (\n    select \n        *,\n        sum( case when event_subtype in ('sync_start') then 1 else 0 end) over ( partition by connector_id \n            order by created_at rows unbounded preceding) as sync_batch_id\n    from transformation_removal\n    -- only looking at errors, warnings, and syncs here\n    where event_type = 'SEVERE'\n        or event_type = 'WARNING'\n        or event_subtype like 'sync%'\n        or (event_subtype = 'status' \n            and \n\n  parse_json( message_data )['status'] = 'RESCHEDULED'\n            \n            and \n\n  parse_json( message_data )['reason'] like '%intended behavior%'\n            ) -- for priority-first syncs. these should be captured by event_type = 'WARNING' but let's make sure\n        or (event_subtype = 'status' \n            and \n\n  parse_json( message_data )['status'] = 'SUCCESSFUL'\n        )\n        -- whole reason is \"We have rescheduled the connector to force flush data from the forward sync into your destination. This is intended behavior and means that the connector is working as expected.\"\n),\n\nschema_changes as (\n\n    select\n        connector_id,\n        count(*) as number_of_schema_changes_last_month\n\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n\n    where \n        datediff(\n        day,\n        created_at,\n        \n  current_timestamp::timestamp\n\n        ) <= 30\n        and event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n\n    group by connector_id\n\n),\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector\n\n),\n\ndestination as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\n),\n\nconnector_metrics as (\n\n    select\n        connector.connector_id,\n        connector.connector_name,\n        connector.connector_type,\n        connector.destination_id,\n        connector.is_paused,\n        connector.set_up_at,\n        max(case when connector_log.event_subtype = 'sync_start' then connector_log.created_at else null end) as last_sync_started_at,\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.created_at else null end) as last_sync_completed_at,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and \n\n  parse_json( connector_log.message_data )['status'] ='SUCCESSFUL'\n            then connector_log.created_at else null end) as last_successful_sync_completed_at,\n\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.sync_batch_id else null end) as last_sync_batch_id,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and \n\n  parse_json( connector_log.message_data )['status'] ='RESCHEDULED'\n                and \n\n  parse_json( connector_log.message_data )['reason'] like '%intended behavior%'\n            then connector_log.created_at else null end) as last_priority_first_sync_completed_at,\n                \n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.created_at else null end) as last_error_at,\n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.sync_batch_id else null end) as last_error_batch,\n        max(case when event_type = 'WARNING' then connector_log.created_at else null end) as last_warning_at\n\n    from connector \n    left join connector_log \n        on connector_log.connector_id = connector.connector_id\n    group by connector.connector_id, connector.connector_name, connector.connector_type, connector.destination_id, connector.is_paused, connector.set_up_at\n),\n\nconnector_health_status as (\n\n    select\n        *,\n        case \n            -- connector is paused\n            when is_paused  then 'paused'\n\n            -- a sync has never been attempted\n            when last_sync_started_at is null then 'incomplete'\n\n            -- a priority-first sync has occurred, but a normal sync has not\n            when last_priority_first_sync_completed_at is not null and last_sync_completed_at is null then 'priority first sync'\n\n            -- a priority sync has occurred more recently than a normal one (may occurr if the connector has been paused and resumed)\n            when last_priority_first_sync_completed_at > last_sync_completed_at then 'priority first sync'\n\n            -- a sync has been attempted, but not completed, and it's not due to errors. also a priority-first sync hasn't\n            when last_sync_completed_at is null and last_error_at is null then 'initial sync in progress'\n\n            -- the last attempted sync had an error\n            when last_sync_batch_id = last_error_batch then 'broken'\n\n            -- there's never been a successful sync and there have been errors\n            when last_sync_completed_at is null and last_error_at is not null then 'broken'\n\n        else 'connected' end as connector_health\n\n    from connector_metrics\n),\n\n-- Joining with log to grab pertinent error/warning messagees\nconnector_recent_logs as (\n\n    select \n        connector_health_status.connector_id,\n        connector_health_status.connector_name,\n        connector_health_status.connector_type,\n        connector_health_status.destination_id,\n        connector_health_status.connector_health,\n        connector_health_status.last_successful_sync_completed_at,\n        connector_health_status.last_sync_started_at,\n        connector_health_status.last_sync_completed_at,\n        connector_health_status.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n    from connector_health_status \n    left join connector_log \n        on connector_log.connector_id = connector_health_status.connector_id\n        -- limiting relevance to since the last successful sync completion (if there has been one)\n        and connector_log.created_at > coalesce(connector_health_status.last_sync_completed_at, connector_health_status.last_priority_first_sync_completed_at, '2000-01-01') \n        -- only looking at errors and warnings (excluding syncs - both normal and priority first)\n        and connector_log.event_type != 'INFO' \n        -- need to explicitly avoid priority first statuses because they are of event_type WARNING\n        and not (connector_log.event_subtype = 'status' \n            and \n\n  parse_json( connector_log.message_data )['status'] ='RESCHEDULED'\n            and \n\n  parse_json( connector_log.message_data )['reason'] like '%intended behavior%')\n\n    group by -- remove duplicates\n        connector_health_status.connector_id,\n        connector_health_status.connector_name,\n        connector_health_status.connector_type,\n        connector_health_status.destination_id,\n        connector_health_status.connector_health,\n        connector_health_status.last_successful_sync_completed_at,\n        connector_health_status.last_sync_started_at,\n        connector_health_status.last_sync_completed_at,\n        connector_health_status.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n),\n\nfinal as (\n\n    select\n        connector_recent_logs.connector_id,\n        connector_recent_logs.connector_name,\n        connector_recent_logs.connector_type,\n        connector_recent_logs.destination_id,\n        destination.destination_name,\n        connector_recent_logs.connector_health,\n        connector_recent_logs.last_successful_sync_completed_at,\n        connector_recent_logs.last_sync_started_at,\n        connector_recent_logs.last_sync_completed_at,\n        connector_recent_logs.set_up_at,\n        coalesce(schema_changes.number_of_schema_changes_last_month, 0) as number_of_schema_changes_last_month\n        \n        \n        , \n    listagg(case when connector_recent_logs.event_type = 'SEVERE' then connector_recent_logs.message_data else null end, '\\n')\n\n as errors_since_last_completed_sync\n        , \n    listagg(case when connector_recent_logs.event_type = 'WARNING' then connector_recent_logs.message_data else null end, '\\n')\n\n as warnings_since_last_completed_sync\n        \n\n    from connector_recent_logs\n    left join schema_changes \n        on connector_recent_logs.connector_id = schema_changes.connector_id \n\n    join destination on destination.destination_id = connector_recent_logs.destination_id\n    group by \n        connector_recent_logs.connector_id, \n        connector_recent_logs.connector_name, \n        connector_recent_logs.connector_type, \n        connector_recent_logs.destination_id, \n        destination.destination_name, \n        connector_recent_logs.connector_health, \n        connector_recent_logs.last_successful_sync_completed_at, \n        connector_recent_logs.last_sync_started_at, \n        connector_recent_logs.last_sync_completed_at, \n        connector_recent_logs.set_up_at, \n        number_of_schema_changes_last_month\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__usage_mar_destination_history": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__usage_mar_destination_history", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__usage_mar_destination_history.sql", "original_file_path": "models/fivetran_platform__usage_mar_destination_history.sql", "unique_id": "model.fivetran_log.fivetran_platform__usage_mar_destination_history", "fqn": ["fivetran_log", "fivetran_platform__usage_mar_destination_history"], "alias": "fivetran_platform__usage_mar_destination_history", "checksum": {"name": "sha256", "checksum": "c8bd713eb09e0098db781c6a9493100015de0460ad7f1256205b6a63d5a210d6"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of each destination's usage and active volume, per month. Includes the  usage per million MAR and MAR per usage. Usage either refers to a dollar or credit amount, depending on customer's pricing model. Read more about the relationship between usage and MAR [here](https://www.fivetran.com/legal/service-consumption-table).\n", "columns": {"measured_month": {"name": "measured_month", "description": "The month (yyyy-mm-01) of the usage/MAR measurement.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse housing the active rows.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination as it appears in the UI.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "free_monthly_active_rows": {"name": "free_monthly_active_rows", "description": "The number of free active rows measured in the destination for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_monthly_active_rows": {"name": "paid_monthly_active_rows", "description": "The number of paid active rows measured in the destination for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_monthly_active_rows": {"name": "total_monthly_active_rows", "description": "The total number of active rows measured in the destination for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "credits_spent_per_million_mar": {"name": "credits_spent_per_million_mar", "description": "The ratio of credits spent that month per every million active rows synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mar_per_credit_spent": {"name": "mar_per_credit_spent", "description": "The ratio of the month's active volume to credits spent.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "amount_spent_per_million_mar": {"name": "amount_spent_per_million_mar", "description": "The ratio of amount spent that month per every million active rows synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mar_per_amount_spent": {"name": "mar_per_amount_spent", "description": "The ratio of the month's active volume to amount spent.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "credits_spent": {"name": "credits_spent", "description": "The number of credits used by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dollars_spent": {"name": "dollars_spent", "description": "The dollar amount used by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.082718, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__usage_mar_destination_history", "raw_code": "with table_mar as (\n    \n    select *\n    from {{ ref('fivetran_platform__mar_table_history') }}\n),\n\ncredits_used as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__credits_used') }}\n),\n\nuseage_cost as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__usage_cost') }}\n),\n\ndestination_mar as (\n\n    select \n        cast(measured_month as date) as measured_month,\n        destination_id,\n        destination_name,\n        sum(free_monthly_active_rows) as free_monthly_active_rows,\n        sum(paid_monthly_active_rows) as paid_monthly_active_rows,\n        sum(total_monthly_active_rows) as total_monthly_active_rows\n    from table_mar\n    group by measured_month, destination_id, destination_name\n),\n\nusage as (\n\n    select \n        coalesce(credits_used.destination_id, useage_cost.destination_id) as destination_id,\n        credits_used.credits_spent,\n        useage_cost.dollars_spent,\n        cast(concat(coalesce(credits_used.measured_month,useage_cost.measured_month), '-01') as date) as measured_month -- match date format to join with MAR table\n    from credits_used\n    full outer join useage_cost\n        on useage_cost.measured_month = credits_used.measured_month\n        and useage_cost.destination_id = credits_used.destination_id\n),\n\njoin_usage_mar as (\n\n    select \n        destination_mar.measured_month,\n        destination_mar.destination_id,\n        destination_mar.destination_name,\n        usage.credits_spent,\n        usage.dollars_spent,\n        destination_mar.free_monthly_active_rows,\n        destination_mar.paid_monthly_active_rows,\n        destination_mar.total_monthly_active_rows,\n\n        -- credit and usage mar calculations\n        round( cast(nullif(usage.credits_spent,0) * 1000000.0 as {{ dbt.type_numeric() }}) / cast(nullif(destination_mar.total_monthly_active_rows,0) as {{ dbt.type_numeric() }}), 2) as credits_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as {{ dbt.type_numeric() }}) / cast(nullif(usage.credits_spent,0) as {{ dbt.type_numeric() }}), 0) as mar_per_credit_spent,\n        round( cast(nullif(usage.dollars_spent,0) * 1000000.0 as {{ dbt.type_numeric() }}) / cast(nullif(destination_mar.total_monthly_active_rows,0) as {{ dbt.type_numeric() }}), 2) as amount_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as {{ dbt.type_numeric() }}) / cast(nullif(usage.dollars_spent,0) as {{ dbt.type_numeric() }}), 0) as mar_per_amount_spent\n    from destination_mar \n    left join usage \n        on destination_mar.measured_month = cast(usage.measured_month as date)\n        and destination_mar.destination_id = usage.destination_id\n)\n\nselect * \nfrom join_usage_mar\n{% if target.type != 'sqlserver' %} -- sql server doesn't support ordering CTEs\norder by measured_month desc\n{% endif %}", "language": "sql", "refs": [{"name": "fivetran_platform__mar_table_history", "package": null, "version": null}, {"name": "stg_fivetran_platform__credits_used", "package": null, "version": null}, {"name": "stg_fivetran_platform__usage_cost", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_numeric"], "nodes": ["model.fivetran_log.fivetran_platform__mar_table_history", "model.fivetran_log.stg_fivetran_platform__credits_used", "model.fivetran_log.stg_fivetran_platform__usage_cost"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__usage_mar_destination_history.sql", "compiled": true, "compiled_code": "with table_mar as (\n    \n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__mar_table_history\n),\n\ncredits_used as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__credits_used\n),\n\nuseage_cost as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__usage_cost\n),\n\ndestination_mar as (\n\n    select \n        cast(measured_month as date) as measured_month,\n        destination_id,\n        destination_name,\n        sum(free_monthly_active_rows) as free_monthly_active_rows,\n        sum(paid_monthly_active_rows) as paid_monthly_active_rows,\n        sum(total_monthly_active_rows) as total_monthly_active_rows\n    from table_mar\n    group by measured_month, destination_id, destination_name\n),\n\nusage as (\n\n    select \n        coalesce(credits_used.destination_id, useage_cost.destination_id) as destination_id,\n        credits_used.credits_spent,\n        useage_cost.dollars_spent,\n        cast(concat(coalesce(credits_used.measured_month,useage_cost.measured_month), '-01') as date) as measured_month -- match date format to join with MAR table\n    from credits_used\n    full outer join useage_cost\n        on useage_cost.measured_month = credits_used.measured_month\n        and useage_cost.destination_id = credits_used.destination_id\n),\n\njoin_usage_mar as (\n\n    select \n        destination_mar.measured_month,\n        destination_mar.destination_id,\n        destination_mar.destination_name,\n        usage.credits_spent,\n        usage.dollars_spent,\n        destination_mar.free_monthly_active_rows,\n        destination_mar.paid_monthly_active_rows,\n        destination_mar.total_monthly_active_rows,\n\n        -- credit and usage mar calculations\n        round( cast(nullif(usage.credits_spent,0) * 1000000.0 as numeric(28,6)) / cast(nullif(destination_mar.total_monthly_active_rows,0) as numeric(28,6)), 2) as credits_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as numeric(28,6)) / cast(nullif(usage.credits_spent,0) as numeric(28,6)), 0) as mar_per_credit_spent,\n        round( cast(nullif(usage.dollars_spent,0) * 1000000.0 as numeric(28,6)) / cast(nullif(destination_mar.total_monthly_active_rows,0) as numeric(28,6)), 2) as amount_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as numeric(28,6)) / cast(nullif(usage.dollars_spent,0) as numeric(28,6)), 0) as mar_per_amount_spent\n    from destination_mar \n    left join usage \n        on destination_mar.measured_month = cast(usage.measured_month as date)\n        and destination_mar.destination_id = usage.destination_id\n)\n\nselect * \nfrom join_usage_mar\n -- sql server doesn't support ordering CTEs\norder by measured_month desc\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__audit_table": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__audit_table", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__audit_table.sql", "original_file_path": "models/fivetran_platform__audit_table.sql", "unique_id": "model.fivetran_log.fivetran_platform__audit_table", "fqn": ["fivetran_log", "fivetran_platform__audit_table"], "alias": "fivetran_platform__audit_table", "checksum": {"name": "sha256", "checksum": "6c8c30a02dc78a01d8e32e13a90d0b2f8a4eec8e0b5b35e8364beb2888a3a830"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "incremental", "incremental_strategy": "delete+insert", "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": "unique_table_sync_key", "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "partition_by": ["sync_start_day"], "file_format": "parquet"}, "tags": [], "description": "Table replacing the deprecated `fivetran_audit` table. For each table written to in a sync, captures timestamps and row quantities around table syncs. Each record represents a table being written to in a connector sync. Note: the quantities here will not match the deprecated `fivetran_audit` table completely, as `fivetran_audit` reported on pre-duplicated data loads.\n", "columns": {"unique_table_sync_key": {"name": "unique_table_sync_key", "description": "Primary key of this table, hashed on `schema_name`, `connector_id`, `destination_id`, `table_name`, and `unique_table_sync_key`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "Name of the schema. In cases when the schema is not provided the connector_name is used.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Name of the table being written to.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination that the table is being written to.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "write_to_table_start": {"name": "write_to_table_start", "description": "Timestamp of when Fivetran began to write to this table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "write_to_table_end": {"name": "write_to_table_end", "description": "Timestamp of when Fivetran finished writing to this table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_start": {"name": "sync_start", "description": "Timestamp of when this connector-level sync began.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_end": {"name": "sync_end", "description": "Timestamp of when this connector-level sync finished, if successful.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sum_rows_replaced_or_inserted": {"name": "sum_rows_replaced_or_inserted", "description": "Sum of the rows replaced or inserted into this table during a sync.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sum_rows_updated": {"name": "sum_rows_updated", "description": "Sum of the rows updated in this table during a sync.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sum_rows_deleted": {"name": "sum_rows_deleted", "description": "Sum of the rows deleted from this table during a sync.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_start_day": {"name": "sync_start_day", "description": "The `sync_start` field truncated to the `day`. This field is used for partitioning in Databricks while using the `insert_overwrite` incremental method.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "incremental", "schema": "fivetran_platform", "unique_key": "unique_table_sync_key", "partition_by": ["sync_start_day"], "incremental_strategy": "delete+insert", "file_format": "parquet"}, "created_at": 1702408016.08557, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_table", "raw_code": "{{ config(\n    materialized='incremental',\n    unique_key='unique_table_sync_key',\n    partition_by={\n        'field': 'sync_start',\n        'data_type': 'timestamp',\n        'granularity': 'day'\n    } if target.type == 'bigquery' else ['sync_start_day'],\n    incremental_strategy='insert_overwrite' if target.type in ('bigquery', 'spark', 'databricks') else 'delete+insert',\n    file_format='parquet'\n) }}\n\nwith sync_log as (\n    \n    select \n        *,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['table']) }} as table_name\n    from {{ ref('stg_fivetran_platform__log') }}\n    where event_subtype in ('sync_start', 'sync_end', 'write_to_table_start', 'write_to_table_end', 'records_modified')\n\n    {% if is_incremental() %}\n\n    -- Capture the latest timestamp in a call statement instead of a subquery for optimizing BQ costs on incremental runs\n    {%- call statement('max_sync_start', fetch_result=True) -%}\n        select cast(max(sync_start) as date) from {{ this }}\n    {%- endcall -%}\n\n    -- load the result from the above query into a new variable\n    {%- set query_result = load_result('max_sync_start') -%}\n\n    -- the query_result is stored as a dataframe. Therefore, we want to now store it as a singular value.\n    {%- set max_sync_start = query_result['data'][0][0] -%}\n\n    -- compare the new batch of data to the latest sync already stored in this model\n    and cast(created_at as date) > '{{ max_sync_start }}'\n\n    {% endif %}\n),\n\n\nconnector as (\n\n    select *\n    from {{ ref('fivetran_platform__connector_status') }}\n),\n\nadd_connector_info as (\n\n    select \n        sync_log.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n    from sync_log \n    left join connector\n        on connector.connector_id = sync_log.connector_id\n),\n\nsync_timestamps as (\n\n    select\n        connector_id,\n        connector_name,\n        table_name,\n        event_subtype,\n        destination_id,\n        destination_name,\n        created_at as write_to_table_start,\n        min(case when event_subtype = 'write_to_table_end' then created_at else null end) \n            over (partition by connector_id, table_name order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as write_to_table_end,\n\n        max(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between UNBOUNDED PRECEDING and CURRENT ROW) as sync_start,\n\n        min(case when event_subtype = 'sync_end' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as sync_end, -- coalesce with next_sync_start\n\n        min(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as next_sync_start\n    from add_connector_info\n),\n\n-- this will be the base for every record in the final CTE\nlimit_to_table_starts as (\n\n    select *\n    from sync_timestamps \n    where event_subtype = 'write_to_table_start'\n),\n\nrecords_modified_log as (\n\n    select \n        connector_id,\n        created_at,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['table']) }} as table_name,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['schema']) }} as schema_name,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['operationType']) }} as operation_type,\n        cast ({{ fivetran_utils.json_parse(string='message_data', string_path=['count']) }} as {{ dbt.type_int() }}) as row_count\n    from sync_log \n    where event_subtype = 'records_modified'\n\n),\n\nsum_records_modified as (\n\n    select\n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name) as schema_name,\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end as sync_end,\n        sum(case when records_modified_log.operation_type = 'REPLACED_OR_INSERTED' then records_modified_log.row_count else 0 end) as sum_rows_replaced_or_inserted,\n        sum(case when records_modified_log.operation_type = 'UPDATED' then records_modified_log.row_count else 0 end) as sum_rows_updated,\n        sum(case when records_modified_log.operation_type = 'DELETED' then records_modified_log.row_count else 0 end) as sum_rows_deleted\n    from limit_to_table_starts\n    left join records_modified_log on \n        limit_to_table_starts.connector_id = records_modified_log.connector_id\n        and limit_to_table_starts.table_name = records_modified_log.table_name\n\n        -- confine it to one sync\n        and records_modified_log.created_at > limit_to_table_starts.sync_start \n        and records_modified_log.created_at < coalesce(limit_to_table_starts.sync_end, limit_to_table_starts.next_sync_start) \n\n    group by \n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name),\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end\n),\n\nfinal as (\n\n    select \n        *,\n        {{ dbt_utils.generate_surrogate_key(['schema_name','connector_id', 'destination_id', 'table_name', 'write_to_table_start']) }} as unique_table_sync_key, -- for incremental materialization \n        {{ dbt.date_trunc('day', 'sync_start') }} as sync_start_day -- for partitioning in databricks\n    from sum_records_modified\n)\n\nselect *\nfrom final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "fivetran_platform__connector_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_utils.json_parse", "macro.dbt.is_incremental", "macro.dbt.type_int", "macro.dbt_utils.generate_surrogate_key", "macro.dbt.date_trunc", "macro.dbt.statement"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.fivetran_platform__connector_status"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__audit_table.sql", "compiled": true, "compiled_code": "\n\nwith sync_log as (\n    \n    select \n        *,\n        \n\n  parse_json( message_data )['table'] as table_name\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n    where event_subtype in ('sync_start', 'sync_end', 'write_to_table_start', 'write_to_table_end', 'records_modified')\n\n    \n\n    -- Capture the latest timestamp in a call statement instead of a subquery for optimizing BQ costs on incremental runs-- load the result from the above query into a new variable-- the query_result is stored as a dataframe. Therefore, we want to now store it as a singular value.-- compare the new batch of data to the latest sync already stored in this model\n    and cast(created_at as date) > '2021-12-10'\n\n    \n),\n\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status\n),\n\nadd_connector_info as (\n\n    select \n        sync_log.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n    from sync_log \n    left join connector\n        on connector.connector_id = sync_log.connector_id\n),\n\nsync_timestamps as (\n\n    select\n        connector_id,\n        connector_name,\n        table_name,\n        event_subtype,\n        destination_id,\n        destination_name,\n        created_at as write_to_table_start,\n        min(case when event_subtype = 'write_to_table_end' then created_at else null end) \n            over (partition by connector_id, table_name order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as write_to_table_end,\n\n        max(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between UNBOUNDED PRECEDING and CURRENT ROW) as sync_start,\n\n        min(case when event_subtype = 'sync_end' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as sync_end, -- coalesce with next_sync_start\n\n        min(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as next_sync_start\n    from add_connector_info\n),\n\n-- this will be the base for every record in the final CTE\nlimit_to_table_starts as (\n\n    select *\n    from sync_timestamps \n    where event_subtype = 'write_to_table_start'\n),\n\nrecords_modified_log as (\n\n    select \n        connector_id,\n        created_at,\n        \n\n  parse_json( message_data )['table'] as table_name,\n        \n\n  parse_json( message_data )['schema'] as schema_name,\n        \n\n  parse_json( message_data )['operationType'] as operation_type,\n        cast (\n\n  parse_json( message_data )['count'] as integer) as row_count\n    from sync_log \n    where event_subtype = 'records_modified'\n\n),\n\nsum_records_modified as (\n\n    select\n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name) as schema_name,\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end as sync_end,\n        sum(case when records_modified_log.operation_type = 'REPLACED_OR_INSERTED' then records_modified_log.row_count else 0 end) as sum_rows_replaced_or_inserted,\n        sum(case when records_modified_log.operation_type = 'UPDATED' then records_modified_log.row_count else 0 end) as sum_rows_updated,\n        sum(case when records_modified_log.operation_type = 'DELETED' then records_modified_log.row_count else 0 end) as sum_rows_deleted\n    from limit_to_table_starts\n    left join records_modified_log on \n        limit_to_table_starts.connector_id = records_modified_log.connector_id\n        and limit_to_table_starts.table_name = records_modified_log.table_name\n\n        -- confine it to one sync\n        and records_modified_log.created_at > limit_to_table_starts.sync_start \n        and records_modified_log.created_at < coalesce(limit_to_table_starts.sync_end, limit_to_table_starts.next_sync_start) \n\n    group by \n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name),\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end\n),\n\nfinal as (\n\n    select \n        *,\n        md5(cast(coalesce(cast(schema_name as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(connector_id as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(destination_id as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(table_name as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(write_to_table_start as TEXT), '_dbt_utils_surrogate_key_null_') as TEXT)) as unique_table_sync_key, -- for incremental materialization \n        date_trunc('day', sync_start) as sync_start_day -- for partitioning in databricks\n    from sum_records_modified\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__mar_table_history": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "fivetran_platform__mar_table_history", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__mar_table_history.sql", "original_file_path": "models/fivetran_platform__mar_table_history.sql", "unique_id": "model.fivetran_log.fivetran_platform__mar_table_history", "fqn": ["fivetran_log", "fivetran_platform__mar_table_history"], "alias": "fivetran_platform__mar_table_history", "checksum": {"name": "sha256", "checksum": "19952f83e6fb1e0c1841adb3fd61e7a556c06f118c09d79bce00a90d40c76fb4"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of each table's monthly active rows (MAR) for all connectors, destinations, and schemas, per month. Read more about how monthly active rows are defined and calculated  [here](https://fivetran.com/docs/getting-started/consumption-based-pricing).\n", "columns": {"connector_name": {"name": "connector_name", "description": "Name of the connector loading this table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "System-generated uniqu ID of the connector loading this table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "Name of the schema in which the table lives.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Name of the table whose MAR was measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm-01) of the measurement.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_measured_at": {"name": "last_measured_at", "description": "Timestamp of when the last MAR measurement for the month was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "free_monthly_active_rows": {"name": "free_monthly_active_rows", "description": "The number of free active rows measured in the table for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_monthly_active_rows": {"name": "paid_monthly_active_rows", "description": "The number of paid active rows measured in the table for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_monthly_active_rows": {"name": "total_monthly_active_rows", "description": "The total number of active rows measured in the table for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination as it appears in the UI.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.0813289, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__mar_table_history", "raw_code": "with incremental_mar as (\n\n    select\n        *,\n        {{ dbt.date_trunc('month', 'measured_date') }} as measured_month\n\n    from {{ ref('stg_fivetran_platform__incremental_mar') }}\n),\n\nconnector as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__connector') }}\n),\n\ndestination as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__destination') }}\n),\n\nordered_mar as (\n\n    select\n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        max(measured_date) as last_measured_at,\n        sum(incremental_rows) as incremental_rows,\n        sum(coalesce(case when lower(free_type) = 'paid'\n            then incremental_rows\n        end, 0)) as paid_monthly_active_rows,\n        sum(coalesce(case when lower(free_type) != 'paid'\n            then incremental_rows\n        end, 0)) as free_monthly_active_rows\n\n    from incremental_mar\n    group by connector_name, schema_name, table_name, destination_id, measured_month\n),\n\nlatest_mar as (\n    select \n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        cast(last_measured_at as date) as last_measured_at,\n        free_monthly_active_rows,\n        paid_monthly_active_rows,\n        (free_monthly_active_rows + paid_monthly_active_rows) as total_monthly_active_rows\n\n    from ordered_mar\n),\n\nmar_join as (\n\n    select\n        latest_mar.*,\n        connector.connector_type,\n        connector.connector_id,\n        destination.destination_name\n\n    from latest_mar\n    join connector\n        on latest_mar.connector_name = connector.connector_name\n        and latest_mar.destination_id = connector.destination_id\n    join destination on latest_mar.destination_id = destination.destination_id\n)\n\nselect * from mar_join\n{% if target.type != 'sqlserver' %} -- can't order CTEs in sqlserver\norder by measured_month desc, destination_id, connector_name\n{% endif %}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__incremental_mar", "package": null, "version": null}, {"name": "stg_fivetran_platform__connector", "package": null, "version": null}, {"name": "stg_fivetran_platform__destination", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.date_trunc"], "nodes": ["model.fivetran_log.stg_fivetran_platform__incremental_mar", "model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__mar_table_history.sql", "compiled": true, "compiled_code": "with incremental_mar as (\n\n    select\n        *,\n        date_trunc('month', measured_date) as measured_month\n\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__incremental_mar\n),\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector\n),\n\ndestination as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\n),\n\nordered_mar as (\n\n    select\n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        max(measured_date) as last_measured_at,\n        sum(incremental_rows) as incremental_rows,\n        sum(coalesce(case when lower(free_type) = 'paid'\n            then incremental_rows\n        end, 0)) as paid_monthly_active_rows,\n        sum(coalesce(case when lower(free_type) != 'paid'\n            then incremental_rows\n        end, 0)) as free_monthly_active_rows\n\n    from incremental_mar\n    group by connector_name, schema_name, table_name, destination_id, measured_month\n),\n\nlatest_mar as (\n    select \n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        cast(last_measured_at as date) as last_measured_at,\n        free_monthly_active_rows,\n        paid_monthly_active_rows,\n        (free_monthly_active_rows + paid_monthly_active_rows) as total_monthly_active_rows\n\n    from ordered_mar\n),\n\nmar_join as (\n\n    select\n        latest_mar.*,\n        connector.connector_type,\n        connector.connector_id,\n        destination.destination_name\n\n    from latest_mar\n    join connector\n        on latest_mar.connector_name = connector.connector_name\n        and latest_mar.destination_id = connector.destination_id\n    join destination on latest_mar.destination_id = destination.destination_id\n)\n\nselect * from mar_join\n -- can't order CTEs in sqlserver\norder by measured_month desc, destination_id, connector_name\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__user": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__user", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__user.sql", "original_file_path": "models/staging/stg_fivetran_platform__user.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__user", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__user"], "alias": "stg_fivetran_platform__user", "checksum": {"name": "sha256", "checksum": "a061bd0449c3600b417d561bac0464e00be250488cdd3d266e3693aec4cee7b3"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of users given access to this Fivetran account.", "columns": {"user_id": {"name": "user_id", "description": "Unique ID of the user's account", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the user was created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "Email associated with the user.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "has_disabled_email_notifications": {"name": "has_disabled_email_notifications", "description": "Boolean of whether they have disabled all email notifications.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "User's last name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "User's first name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "phone": {"name": "phone", "description": "Phone number associated with user.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "is_verified": {"name": "is_verified", "description": "Boolean that indicates whether the user has verified their email address in the account creation process.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform", "enabled": true}, "created_at": 1702408016.2057998, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__user", "raw_code": "{{ config(enabled=var('fivetran_platform_using_user', True)) }}\n\nwith base as (\n\n    select * \n    from {{ var('user') }}\n),\n\nfields as (\n\n    select\n        id as user_id,\n        cast(created_at as {{ dbt.type_timestamp() }}) as created_at,\n        email,\n        email_disabled as has_disabled_email_notifications,\n        family_name as last_name,\n        given_name as first_name,\n        phone,\n        verified as is_verified\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "user"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.user"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__user.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.user\n),\n\nfields as (\n\n    select\n        id as user_id,\n        cast(created_at as timestamp) as created_at,\n        email,\n        email_disabled as has_disabled_email_notifications,\n        family_name as last_name,\n        given_name as first_name,\n        phone,\n        verified as is_verified\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__destination_membership": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__destination_membership", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__destination_membership.sql", "original_file_path": "models/staging/stg_fivetran_platform__destination_membership.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__destination_membership", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__destination_membership"], "alias": "stg_fivetran_platform__destination_membership", "checksum": {"name": "sha256", "checksum": "da8ba27410a264f15f17cd9fd774299fb5fc88fa2f07f898ead71aed3f7f91e8"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of the users given access to this destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the ID of the `destination` that the user is  amember of.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "Foreign key referencing the ID of the `user` belonging to the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "activated_at": {"name": "activated_at", "description": "Timestamp of when the user was activated in the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "joined_at": {"name": "joined_at", "description": "Timestamp when the user was added to the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_role": {"name": "destination_role", "description": "The user's permissions for this individual destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform", "enabled": true}, "created_at": 1702408016.2050781, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination_membership", "raw_code": "{{ config(enabled=var('fivetran_platform_using_destination_membership', True)) }}\n\nwith base as (\n    \n    select * from {{ var('destination_membership') }}\n),\n\nfields as (\n\n    select\n        destination_id,\n        user_id,\n        cast(activated_at as {{ dbt.type_timestamp() }}) as activated_at,\n        cast(joined_at as {{ dbt.type_timestamp() }}) as joined_at,\n        role as destination_role\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "destination_membership"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.destination_membership"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__destination_membership.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n    \n    select * from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.destination_membership\n),\n\nfields as (\n\n    select\n        destination_id,\n        user_id,\n        cast(activated_at as timestamp) as activated_at,\n        cast(joined_at as timestamp) as joined_at,\n        role as destination_role\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__credits_used": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__credits_used", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__credits_used.sql", "original_file_path": "models/staging/stg_fivetran_platform__credits_used.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__credits_used", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__credits_used"], "alias": "stg_fivetran_platform__credits_used", "checksum": {"name": "sha256", "checksum": "a3cbd320d43b57e49856ef3d120ba91addccaa9280d74645ff168c94af2cdc7d"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of the credits used by the customer per month for each destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that was used.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm) of the usage activity.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "credits_spent": {"name": "credits_spent", "description": "The total credits used by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.203042, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__credits_used", "raw_code": "{% if var('fivetran_platform__credits_pricing', does_table_exist('credits_used')) %}\n\nwith base as (\n\n    select * \n    from {{ var('credits_used') }}\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        credits_consumed as credits_spent\n    from base\n)\n\nselect * \nfrom fields\n\n{% else %}\n\nselect\n    cast(null as {{ dbt.type_string() }}) as destination_id,\n    cast(null as {{ dbt.type_string() }}) as measured_month,\n    cast(null as {{ dbt.type_int() }}) as credits_spent\n\n{% endif %}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_log.does_table_exist", "macro.dbt.type_string", "macro.dbt.type_int"], "nodes": []}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__credits_used.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.credits_used\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        credits_consumed as credits_spent\n    from base\n)\n\nselect * \nfrom fields\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__usage_cost": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__usage_cost", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__usage_cost.sql", "original_file_path": "models/staging/stg_fivetran_platform__usage_cost.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__usage_cost", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__usage_cost"], "alias": "stg_fivetran_platform__usage_cost", "checksum": {"name": "sha256", "checksum": "740b47d6acccb2dd3708fe6bdd5c1bde9c127cc3eefa8bee2ddd8cec30b9d1c8"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of the amount spent by the customer per month for each destination. Amount is represented in USD.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that was used.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm) of the usage activity.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dollars_spent": {"name": "dollars_spent", "description": "The total amount spent by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.203359, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__usage_cost", "raw_code": "{% if var('fivetran_platform__usage_pricing', does_table_exist('usage_cost')) %}\nwith base as (\n\n    select * \n    from {{ var('usage_cost') }}\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        amount as dollars_spent\n    from base\n)\n\nselect * \nfrom fields\n\n{% else %}\n\nselect\n    cast(null as {{ dbt.type_string() }}) as destination_id,\n    cast(null as {{ dbt.type_string() }}) as measured_month,\n    cast(null as {{ dbt.type_int() }}) as dollars_spent\n\n{% endif %}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_log.does_table_exist", "macro.dbt.type_string", "macro.dbt.type_int"], "nodes": []}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__usage_cost.sql", "compiled": true, "compiled_code": "\nwith base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.usage_cost\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        amount as dollars_spent\n    from base\n)\n\nselect * \nfrom fields\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__destination": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__destination", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__destination.sql", "original_file_path": "models/staging/stg_fivetran_platform__destination.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__destination", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__destination"], "alias": "stg_fivetran_platform__destination", "checksum": {"name": "sha256", "checksum": "59e204b797ea6e878de36084e5d3bede69c4f652a31ba542528434ae07ea29c8"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of the destinations that have data loaded into them. For each declared source, there will be just one record.", "columns": {"destination_id": {"name": "destination_id", "description": "Unique ID of the destination warehouse", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "account_id": {"name": "account_id", "description": "Foreign key referencing the fivetran `account` associated with the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the destination was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination warehouse.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "region": {"name": "region", "description": "Geographical region of the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.203732, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination", "raw_code": "with base as (\n\n    select * \n    from {{ var('destination') }}\n),\n\nfields as (\n\n    select\n        id as destination_id,\n        account_id,\n        cast(created_at as {{ dbt.type_timestamp() }}) as created_at,\n        name as destination_name,\n        region\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "destination"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.destination"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__destination.sql", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.destination\n),\n\nfields as (\n\n    select\n        id as destination_id,\n        account_id,\n        cast(created_at as timestamp) as created_at,\n        name as destination_name,\n        region\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__log": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__log", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__log.sql", "original_file_path": "models/staging/stg_fivetran_platform__log.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__log", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__log"], "alias": "stg_fivetran_platform__log", "checksum": {"name": "sha256", "checksum": "3d7152127b8635b875e7bba19eeca061435b6c0550540fed56cd174a4b3dbd24"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of logged events related to data syncs. More info on error logs  [here](https://fivetran.com/docs/logs/fivetran-log#errorlogs)\n", "columns": {"log_id": {"name": "log_id", "description": "Unique ID of the log record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_id": {"name": "sync_id", "description": "Identifies which sync the event is associated with.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the event was logged.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "The name of the `connector` that the logged event pertains to.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_type": {"name": "event_type", "description": "The umbrella event type. Events can be classified as a warning, an error, or just an information log.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_data": {"name": "message_data", "description": "The details of the event in JSON format.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_subtype": {"name": "event_subtype", "description": "The routine involved in the log, defined [here](https://fivetran.com/docs/logs#logevents).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "transformation_id": {"name": "transformation_id", "description": "Foreign key referencing the `transformation` if the event refers to a transformation run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.2042081, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log", "raw_code": "with base as (\n\n    select * \n    from {{ ref('stg_fivetran_platform__log_tmp') }}\n),\n\nfields as (\n    select\n        {{\n            fivetran_utils.fill_staging_columns(\n                source_columns=adapter.get_columns_in_relation(ref('stg_fivetran_platform__log_tmp')),\n                staging_columns=get_log_columns()\n            )\n        }}\n    from base\n),\n\nfinal as (\n\n    select\n        id as log_id, \n        sync_id,\n        cast(time_stamp as {{ dbt.type_timestamp() }}) as created_at,\n        connector_id, -- Note: the connector_id column used to erroneously equal the connector_name, NOT its id.\n        case when transformation_id is not null and event is null then 'TRANSFORMATION'\n        else event end as event_type, \n        message_data,\n        case \n        when transformation_id is not null and message_data like '%has succeeded%' then 'transformation run success'\n        when transformation_id is not null and message_data like '%has failed%' then 'transformation run failed'\n        else message_event end as event_subtype,\n        transformation_id\n    from fields\n)\n\nselect * \nfrom final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log_tmp", "package": null, "version": null}, {"name": "stg_fivetran_platform__log_tmp", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_log.get_log_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt.type_timestamp"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log_tmp"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__log.sql", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log_tmp\n),\n\nfields as (\n    select\n        \n    \n    \n    _fivetran_synced\n    \n as \n    \n    _fivetran_synced\n    \n, \n    \n    \n    connector_id\n    \n as \n    \n    connector_id\n    \n, \n    \n    \n    event\n    \n as \n    \n    event\n    \n, \n    \n    \n    id\n    \n as \n    \n    id\n    \n, \n    \n    \n    message_data\n    \n as \n    \n    message_data\n    \n, \n    \n    \n    message_event\n    \n as \n    \n    message_event\n    \n, \n    \n    \n    sync_id\n    \n as \n    \n    sync_id\n    \n, \n    \n    \n    time_stamp\n    \n as \n    \n    time_stamp\n    \n, \n    \n    \n    transformation_id\n    \n as \n    \n    transformation_id\n    \n\n\n\n    from base\n),\n\nfinal as (\n\n    select\n        id as log_id, \n        sync_id,\n        cast(time_stamp as timestamp) as created_at,\n        connector_id, -- Note: the connector_id column used to erroneously equal the connector_name, NOT its id.\n        case when transformation_id is not null and event is null then 'TRANSFORMATION'\n        else event end as event_type, \n        message_data,\n        case \n        when transformation_id is not null and message_data like '%has succeeded%' then 'transformation run success'\n        when transformation_id is not null and message_data like '%has failed%' then 'transformation run failed'\n        else message_event end as event_subtype,\n        transformation_id\n    from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__incremental_mar": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__incremental_mar", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__incremental_mar.sql", "original_file_path": "models/staging/stg_fivetran_platform__incremental_mar.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__incremental_mar", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__incremental_mar"], "alias": "stg_fivetran_platform__incremental_mar", "checksum": {"name": "sha256", "checksum": "e9d206751314e30b94366c9d94ed110146767669605db72745ff1807226304f0"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of **monthly active row (MAR)** measurements made by table per date.  Each measurement is calculated cumulatively for the month and includes all types of mar (paid, free, etc.)\n", "columns": {"connector_name": {"name": "connector_name", "description": "The *name* of the connector being measured. Note - this is erroneously named and will be fixed soon by Fivetran.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` whose table is being measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "free_type": {"name": "free_type", "description": "If it is free MAR, the value indicates the type of free MAR. For paid MAR, the value is `PAID`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_date": {"name": "measured_date", "description": "Timestamp of when the MAR measurement was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "incremental_rows": {"name": "incremental_rows", "description": "The number of new distinct primary keys on the current day synced for the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_type": {"name": "sync_type", "description": "This defines whether the sync for which MAR calculated is HISTORICAL or INCREMENTAL. Currently, the available value is UNKNOWN.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "The name of the connector's schema that houses the measured table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "The name of the table whose MAR was measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Timestamp of when the record was last updated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.2021298, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__incremental_mar", "raw_code": "with base as (\n\n    select * \n    from {{ var('incremental_mar') }}\n),\n\nfields as (\n\n    select\n        connector_id as connector_name,\n        destination_id,\n        free_type,\n        cast(measured_date as {{ dbt.type_timestamp() }}) as measured_date,\n        schema_name,\n        sync_type,\n        table_name,\n        updated_at,\n        _fivetran_synced,\n        incremental_rows\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "incremental_mar"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.incremental_mar"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__incremental_mar.sql", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.incremental_mar\n),\n\nfields as (\n\n    select\n        connector_id as connector_name,\n        destination_id,\n        free_type,\n        cast(measured_date as timestamp) as measured_date,\n        schema_name,\n        sync_type,\n        table_name,\n        updated_at,\n        _fivetran_synced,\n        incremental_rows\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__connector": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__connector", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__connector.sql", "original_file_path": "models/staging/stg_fivetran_platform__connector.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__connector", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__connector"], "alias": "stg_fivetran_platform__connector", "checksum": {"name": "sha256", "checksum": "26bc8050ae36226bbee0e978acbd6e5bdaccbb2d73f66d609bcd82f199c4b6ef"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of all connectors loading data into warehouses. Note that deleted connectors  are not removed, but can be identified by having an older _fivetran_synced field relative  to other connectors.\n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated destination-unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connecting_user_id": {"name": "connecting_user_id", "description": "Foreign key referencing the `user` who set up the connection.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Individual name of the connector. Note that this could be different from the `incremental_mar.schema_name`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "is_paused": {"name": "is_paused", "description": "Boolean that is true if the connector's sync is currently paused.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "set_up_at": {"name": "set_up_at", "description": "Timestamp of when the connection was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.2027159, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector", "raw_code": "with base as (\n\n    select * \n    from {{ ref('stg_fivetran_platform__connector_tmp') }}\n),\n\nfields as (\n    select\n        {{\n            fivetran_utils.fill_staging_columns(\n                source_columns=adapter.get_columns_in_relation(ref('stg_fivetran_platform__connector_tmp')),\n                staging_columns=get_connector_columns()\n            )\n        }}\n        ,row_number() over ( partition by connector_name, destination_id order by _fivetran_synced desc ) as nth_last_record\n    from base\n),\n\nfinal as (\n\n    select \n        connector_id,\n        connector_name,\n        coalesce(connector_type_id, connector_type) as connector_type,\n        destination_id,\n        connecting_user_id,\n        paused as is_paused,\n        signed_up as set_up_at\n    from fields\n\n    -- Only look at the most recent one\n    where nth_last_record = 1\n)\n\nselect * \nfrom final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__connector_tmp", "package": null, "version": null}, {"name": "stg_fivetran_platform__connector_tmp", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_log.get_connector_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.fivetran_log.stg_fivetran_platform__connector_tmp"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__connector.sql", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector_tmp\n),\n\nfields as (\n    select\n        \n    cast(null as boolean) as \n    \n    _fivetran_deleted\n    \n , \n    \n    \n    _fivetran_synced\n    \n as \n    \n    _fivetran_synced\n    \n, \n    \n    \n    connecting_user_id\n    \n as \n    \n    connecting_user_id\n    \n, \n    \n    \n    connector_id\n    \n as \n    \n    connector_id\n    \n, \n    \n    \n    connector_name\n    \n as \n    \n    connector_name\n    \n, \n    \n    \n    connector_type\n    \n as \n    \n    connector_type\n    \n, \n    cast(null as TEXT) as \n    \n    connector_type_id\n    \n , \n    \n    \n    destination_id\n    \n as \n    \n    destination_id\n    \n, \n    \n    \n    paused\n    \n as \n    \n    paused\n    \n, \n    cast(null as integer) as \n    \n    service_version\n    \n , \n    \n    \n    signed_up\n    \n as \n    \n    signed_up\n    \n\n\n\n        ,row_number() over ( partition by connector_name, destination_id order by _fivetran_synced desc ) as nth_last_record\n    from base\n),\n\nfinal as (\n\n    select \n        connector_id,\n        connector_name,\n        coalesce(connector_type_id, connector_type) as connector_type,\n        destination_id,\n        connecting_user_id,\n        paused as is_paused,\n        signed_up as set_up_at\n    from fields\n\n    -- Only look at the most recent one\n    where nth_last_record = 1\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__account": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__account", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__account.sql", "original_file_path": "models/staging/stg_fivetran_platform__account.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__account", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__account"], "alias": "stg_fivetran_platform__account", "checksum": {"name": "sha256", "checksum": "877d7ad3b526b29b2806da63bbb80eceaab46ac8b530a132361bb0c2ab74a20a"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of information on this Fivetran account.", "columns": {"account_id": {"name": "account_id", "description": "Unique ID of the account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "country": {"name": "country", "description": "Country of the account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the account was created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "account_name": {"name": "account_name", "description": "Name of the Fivetran account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of the Fivetran account (ie trial, frozen).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702408016.20473, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__account", "raw_code": "with base as (\n    \n    select * \n    from {{ var('account') }}\n),\n\nfields as (\n\n    select\n        id as account_id,\n        country,\n        cast(created_at as {{ dbt.type_timestamp() }}) as created_at,\n        name as account_name,\n        status\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "account"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.account"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__account.sql", "compiled": true, "compiled_code": "with base as (\n    \n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.account\n),\n\nfields as (\n\n    select\n        id as account_id,\n        country,\n        cast(created_at as timestamp) as created_at,\n        name as account_name,\n        status\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__connector_tmp": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__connector_tmp", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/tmp/stg_fivetran_platform__connector_tmp.sql", "original_file_path": "models/staging/tmp/stg_fivetran_platform__connector_tmp.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__connector_tmp", "fqn": ["fivetran_log", "staging", "tmp", "stg_fivetran_platform__connector_tmp"], "alias": "stg_fivetran_platform__connector_tmp", "checksum": {"name": "sha256", "checksum": "37733092912c2e3514778a0a8826e3c673dc46b5202e6319f1f193da6e453a9e"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "fivetran_platform"}, "created_at": 1702408016.031316, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector_tmp", "raw_code": "select *\nfrom {{ var('connector') }}", "language": "sql", "refs": [], "sources": [["fivetran_platform", "connector"]], "metrics": [], "depends_on": {"macros": [], "nodes": ["source.fivetran_log.fivetran_platform.connector"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/tmp/stg_fivetran_platform__connector_tmp.sql", "compiled": true, "compiled_code": "select *\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.connector", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__log_tmp": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_fivetran_platform", "name": "stg_fivetran_platform__log_tmp", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/tmp/stg_fivetran_platform__log_tmp.sql", "original_file_path": "models/staging/tmp/stg_fivetran_platform__log_tmp.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__log_tmp", "fqn": ["fivetran_log", "staging", "tmp", "stg_fivetran_platform__log_tmp"], "alias": "stg_fivetran_platform__log_tmp", "checksum": {"name": "sha256", "checksum": "9e05b5b47bbe8eb4004c8113700379a9432e90318d78d548db6f933fd549ed1b"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "fivetran_platform"}, "created_at": 1702408016.037715, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log_tmp", "raw_code": "select *\nfrom {{ var('log') }}", "language": "sql", "refs": [], "sources": [["fivetran_platform", "log"]], "metrics": [], "depends_on": {"macros": [], "nodes": ["source.fivetran_log.fivetran_platform.log"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/tmp/stg_fivetran_platform__log_tmp.sql", "compiled": true, "compiled_code": "select *\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.log", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_id", "destination_id"], "model": "{{ get_where_subquery(ref('fivetran_platform__connector_status')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id"], "alias": "dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43"}, "created_at": 1702408016.1323252, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__connector_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__connector_status"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status\n    group by connector_id, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__connector_status", "attached_node": "model.fivetran_log.fivetran_platform__connector_status"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_id", "destination_id", "schema_name", "table_name", "measured_month"], "model": "{{ get_where_subquery(ref('fivetran_platform__mar_table_history')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month"], "alias": "dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8"}, "created_at": 1702408016.1396532, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__mar_table_history", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__mar_table_history"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, schema_name, table_name, measured_month\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__mar_table_history\n    group by connector_id, destination_id, schema_name, table_name, measured_month\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__mar_table_history", "attached_node": "model.fivetran_log.fivetran_platform__mar_table_history"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["destination_id", "measured_month"], "model": "{{ get_where_subquery(ref('fivetran_platform__usage_mar_destination_history')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month"], "alias": "dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b"}, "created_at": 1702408016.142329, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__usage_mar_destination_history", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        destination_id, measured_month\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__usage_mar_destination_history\n    group by destination_id, measured_month\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__usage_mar_destination_history", "attached_node": "model.fivetran_log.fivetran_platform__usage_mar_destination_history"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_id", "destination_id", "date_day"], "model": "{{ get_where_subquery(ref('fivetran_platform__connector_daily_events')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day"], "alias": "dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1"}, "created_at": 1702408016.1448169, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__connector_daily_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__connector_daily_events"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, date_day\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_daily_events\n    group by connector_id, destination_id, date_day\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__connector_daily_events", "attached_node": "model.fivetran_log.fivetran_platform__connector_daily_events"}, "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "unique_table_sync_key", "model": "{{ get_where_subquery(ref('fivetran_platform__audit_table')) }}"}, "namespace": null}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "unique_fivetran_platform__audit_table_unique_table_sync_key", "resource_type": "test", "package_name": "fivetran_log", "path": "unique_fivetran_platform__audit_table_unique_table_sync_key.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7", "fqn": ["fivetran_log", "unique_fivetran_platform__audit_table_unique_table_sync_key"], "alias": "unique_fivetran_platform__audit_table_unique_table_sync_key", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702408016.147464, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "fivetran_platform__audit_table", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__audit_table"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/unique_fivetran_platform__audit_table_unique_table_sync_key.sql", "compiled": true, "compiled_code": "\n    \n    \n\nselect\n    unique_table_sync_key as unique_field,\n    count(*) as n_records\n\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_table\nwhere unique_table_sync_key is not null\ngroup by unique_table_sync_key\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "unique_table_sync_key", "file_key_name": "models.fivetran_platform__audit_table", "attached_node": "model.fivetran_log.fivetran_platform__audit_table"}, "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "unique_table_sync_key", "model": "{{ get_where_subquery(ref('fivetran_platform__audit_table')) }}"}, "namespace": null}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "not_null_fivetran_platform__audit_table_unique_table_sync_key", "resource_type": "test", "package_name": "fivetran_log", "path": "not_null_fivetran_platform__audit_table_unique_table_sync_key.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af", "fqn": ["fivetran_log", "not_null_fivetran_platform__audit_table_unique_table_sync_key"], "alias": "not_null_fivetran_platform__audit_table_unique_table_sync_key", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702408016.148594, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "fivetran_platform__audit_table", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__audit_table"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/not_null_fivetran_platform__audit_table_unique_table_sync_key.sql", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect unique_table_sync_key\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_table\nwhere unique_table_sync_key is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "unique_table_sync_key", "file_key_name": "models.fivetran_platform__audit_table", "attached_node": "model.fivetran_log.fivetran_platform__audit_table"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_id", "destination_id", "message_data", "created_at"], "model": "{{ get_where_subquery(ref('fivetran_platform__schema_changelog')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at"], "alias": "dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd"}, "created_at": 1702408016.1497269, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__schema_changelog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__schema_changelog"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, message_data, created_at\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__schema_changelog\n    group by connector_id, destination_id, message_data, created_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__schema_changelog", "attached_node": "model.fivetran_log.fivetran_platform__schema_changelog"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at.be572689a3": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["log_id", "occurred_at"], "model": "{{ get_where_subquery(ref('fivetran_platform__audit_user_activity')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_fec574df3883d2c29de1d09d9c7c0b8f.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at.be572689a3", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at"], "alias": "dbt_utils_unique_combination_o_fec574df3883d2c29de1d09d9c7c0b8f", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_fec574df3883d2c29de1d09d9c7c0b8f", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_fec574df3883d2c29de1d09d9c7c0b8f"}, "created_at": 1702408016.152384, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_fec574df3883d2c29de1d09d9c7c0b8f\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__audit_user_activity", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__audit_user_activity"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_fec574df3883d2c29de1d09d9c7c0b8f.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        log_id, occurred_at\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_user_activity\n    group by log_id, occurred_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__audit_user_activity", "attached_node": "model.fivetran_log.fivetran_platform__audit_user_activity"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_name", "destination_id"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__connector')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id"], "alias": "dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62"}, "created_at": 1702408016.206317, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__connector", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__connector"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_name, destination_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector\n    group by connector_name, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__connector", "attached_node": "model.fivetran_log.stg_fivetran_platform__connector"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["measured_month", "destination_id"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__credits_used')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id"], "alias": "dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68"}, "created_at": 1702408016.2090151, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__credits_used", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__credits_used"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        measured_month, destination_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__credits_used\n    group by measured_month, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__credits_used", "attached_node": "model.fivetran_log.stg_fivetran_platform__credits_used"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["measured_month", "destination_id"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__usage_cost')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id"], "alias": "dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945"}, "created_at": 1702408016.211615, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__usage_cost", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__usage_cost"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        measured_month, destination_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__usage_cost\n    group by measured_month, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__usage_cost", "attached_node": "model.fivetran_log.stg_fivetran_platform__usage_cost"}, "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "destination_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__destination')) }}"}, "namespace": null}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "unique_stg_fivetran_platform__destination_destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "unique_stg_fivetran_platform__destination_destination_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed", "fqn": ["fivetran_log", "staging", "unique_stg_fivetran_platform__destination_destination_id"], "alias": "unique_stg_fivetran_platform__destination_destination_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702408016.2142348, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__destination", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__destination"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/unique_stg_fivetran_platform__destination_destination_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\nselect\n    destination_id as unique_field,\n    count(*) as n_records\n\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\nwhere destination_id is not null\ngroup by destination_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "destination_id", "file_key_name": "models.stg_fivetran_platform__destination", "attached_node": "model.fivetran_log.stg_fivetran_platform__destination"}, "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "destination_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__destination')) }}"}, "namespace": null}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "not_null_stg_fivetran_platform__destination_destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "not_null_stg_fivetran_platform__destination_destination_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780", "fqn": ["fivetran_log", "staging", "not_null_stg_fivetran_platform__destination_destination_id"], "alias": "not_null_stg_fivetran_platform__destination_destination_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702408016.215345, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__destination", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__destination"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/not_null_stg_fivetran_platform__destination_destination_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect destination_id\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\nwhere destination_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "destination_id", "file_key_name": "models.stg_fivetran_platform__destination", "attached_node": "model.fivetran_log.stg_fivetran_platform__destination"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["log_id", "created_at"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__log')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at"], "alias": "dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5"}, "created_at": 1702408016.216467, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        log_id, created_at\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n    group by log_id, created_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__log", "attached_node": "model.fivetran_log.stg_fivetran_platform__log"}, "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "account_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__account')) }}"}, "namespace": null}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "unique_stg_fivetran_platform__account_account_id", "resource_type": "test", "package_name": "fivetran_log", "path": "unique_stg_fivetran_platform__account_account_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc", "fqn": ["fivetran_log", "staging", "unique_stg_fivetran_platform__account_account_id"], "alias": "unique_stg_fivetran_platform__account_account_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702408016.219504, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__account", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__account"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/unique_stg_fivetran_platform__account_account_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\nselect\n    account_id as unique_field,\n    count(*) as n_records\n\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__account\nwhere account_id is not null\ngroup by account_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "account_id", "file_key_name": "models.stg_fivetran_platform__account", "attached_node": "model.fivetran_log.stg_fivetran_platform__account"}, "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "account_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__account')) }}"}, "namespace": null}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "not_null_stg_fivetran_platform__account_account_id", "resource_type": "test", "package_name": "fivetran_log", "path": "not_null_stg_fivetran_platform__account_account_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e", "fqn": ["fivetran_log", "staging", "not_null_stg_fivetran_platform__account_account_id"], "alias": "not_null_stg_fivetran_platform__account_account_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702408016.2206101, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__account", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__account"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/not_null_stg_fivetran_platform__account_account_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect account_id\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__account\nwhere account_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "account_id", "file_key_name": "models.stg_fivetran_platform__account", "attached_node": "model.fivetran_log.stg_fivetran_platform__account"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["destination_id", "user_id"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__destination_membership')) }}"}, "namespace": "dbt_utils"}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id"], "alias": "dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede"}, "created_at": 1702408016.2217338, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__destination_membership", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__destination_membership"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        destination_id, user_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination_membership\n    group by destination_id, user_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__destination_membership", "attached_node": "model.fivetran_log.stg_fivetran_platform__destination_membership"}, "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "user_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__user')) }}"}, "namespace": null}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "unique_stg_fivetran_platform__user_user_id", "resource_type": "test", "package_name": "fivetran_log", "path": "unique_stg_fivetran_platform__user_user_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9", "fqn": ["fivetran_log", "staging", "unique_stg_fivetran_platform__user_user_id"], "alias": "unique_stg_fivetran_platform__user_user_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702408016.22436, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__user", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__user"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/unique_stg_fivetran_platform__user_user_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\nselect\n    user_id as unique_field,\n    count(*) as n_records\n\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__user\nwhere user_id is not null\ngroup by user_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "user_id", "file_key_name": "models.stg_fivetran_platform__user", "attached_node": "model.fivetran_log.stg_fivetran_platform__user"}, "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "user_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__user')) }}"}, "namespace": null}, "database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1_dbt_test__audit", "name": "not_null_stg_fivetran_platform__user_user_id", "resource_type": "test", "package_name": "fivetran_log", "path": "not_null_stg_fivetran_platform__user_user_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0", "fqn": ["fivetran_log", "staging", "not_null_stg_fivetran_platform__user_user_id"], "alias": "not_null_stg_fivetran_platform__user_user_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702408016.2255008, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__user", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__user"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/not_null_stg_fivetran_platform__user_user_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect user_id\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__user\nwhere user_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "user_id", "file_key_name": "models.stg_fivetran_platform__user", "attached_node": "model.fivetran_log.stg_fivetran_platform__user"}}, "sources": {"source.fivetran_log.fivetran_platform.incremental_mar": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "incremental_mar", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.incremental_mar", "fqn": ["fivetran_log", "staging", "fivetran_platform", "incremental_mar"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "incremental_mar", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 96, "period": "hour"}, "filter": null}, "external": null, "description": "Table of **monthly active row (MAR)** measurements made by table per date.  Each measurement is calculated cumulatively for the month and includes all types of mar (paid, free, etc.)\n", "columns": {"connector_id": {"name": "connector_id", "description": "The *name* of the connector being measured. Note - this is erroneously named and will be fixed soon by Fivetran.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` whose table is being measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "free_type": {"name": "free_type", "description": "If it is free MAR, the value indicates the type of free MAR. For paid MAR, the value is `PAID`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_date": {"name": "measured_date", "description": "Timestamp of when the MAR measurement was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "incremental_rows": {"name": "incremental_rows", "description": "The number of new distinct primary keys on the current day synced for the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_type": {"name": "sync_type", "description": "This defines whether the sync for which MAR calculated is HISTORICAL or INCREMENTAL. Currently, the available value is UNKNOWN.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "The name of the connector's schema that houses the measured table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "The name of the table whose MAR was measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Timestamp of when the record was last updated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.incremental_mar", "created_at": 1702408016.227144}, "source.fivetran_log.fivetran_platform.connector": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "connector", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.connector", "fqn": ["fivetran_log", "staging", "fivetran_platform", "connector"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "connector", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of all connectors loading data into warehouses. Note that deleted connectors  are not removed, but can be identified by having an older _fivetran_synced field relative  to other connectors.\n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connecting_user_id": {"name": "connecting_user_id", "description": "Foreign key referencing the `user` who set up the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Individual name of the connector. Note that this could be different from the `incremental_mar.schema_name`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paused": {"name": "paused", "description": "Boolean that is true if the connector's sync is currently paused.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "signed_up": {"name": "signed_up", "description": "Timestamp of when the connection was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.connector", "created_at": 1702408016.2272599}, "source.fivetran_log.fivetran_platform.credits_used": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "credits_used", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.credits_used", "fqn": ["fivetran_log", "staging", "fivetran_platform", "credits_used"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "credits_used", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of the credits used by the customer per month within each destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the credits were used on", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm) in which the credits were consumed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "credits_consumed": {"name": "credits_consumed", "description": "The number of credits used by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.credits_used", "created_at": 1702408016.2273479}, "source.fivetran_log.fivetran_platform.usage_cost": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "usage_cost", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.usage_cost", "fqn": ["fivetran_log", "staging", "fivetran_platform", "usage_cost"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "usage_cost", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of the credits used by the customer per month within each destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the credits were used on", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm) in which the credits were consumed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "amount": {"name": "amount", "description": "The dollar amount associated with the cost of your connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.usage_cost", "created_at": 1702408016.2274308}, "source.fivetran_log.fivetran_platform.destination": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "destination", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.destination", "fqn": ["fivetran_log", "staging", "fivetran_platform", "destination"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "destination", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of the destinations that have data loaded into them. For each declared source, there will be just one record.", "columns": {"id": {"name": "id", "description": "Unique ID of the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "account_id": {"name": "account_id", "description": "Foreign key referencing the fivetran `account` associated with the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the destination was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "Name of the destination warehouse.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "region": {"name": "region", "description": "Geographical region of the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.destination", "created_at": 1702408016.227516}, "source.fivetran_log.fivetran_platform.log": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "log", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.log", "fqn": ["fivetran_log", "staging", "fivetran_platform", "log"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "log", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 96, "period": "hour"}, "filter": null}, "external": null, "description": "Table of logged events related to data syncs. More info on error logs [here](https://fivetran.com/docs/logs/fivetran-log#errorlogs).", "columns": {"id": {"name": "id", "description": "Contains either `connector_name` (for app/api logs), `transformation_id` (for transformation logs),  or the value `\"system\"` (for system generated logs).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "time_stamp": {"name": "time_stamp", "description": "Timestamp of when the event was logged.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "The *name* of the connector being logged. Note - this is erroneously named and will be fixed soon by Fivetran.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event": {"name": "event", "description": "The umbrella event type. Events can be classified as a warning, an error, or just an information log.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_data": {"name": "message_data", "description": "The details of the event in JSON format.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_event": {"name": "message_event", "description": "The routine involved in the log, defined [here](https://fivetran.com/docs/logs#logevents).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "transformation_id": {"name": "transformation_id", "description": "Foreign key referencing the `transformation` if the event refers to a transformation run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_id": {"name": "sync_id", "description": "Identifies which sync the event is associated with.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.log", "created_at": 1702408016.227607}, "source.fivetran_log.fivetran_platform.account": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "account", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.account", "fqn": ["fivetran_log", "staging", "fivetran_platform", "account"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "account", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of information on this Fivetran account.", "columns": {"id": {"name": "id", "description": "Unique ID of the account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "country": {"name": "country", "description": "Country of the account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the account was created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "Name of the Fivetran account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of the Fivetran account (ie trial, frozen).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.account", "created_at": 1702408016.227691}, "source.fivetran_log.fivetran_platform.destination_membership": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "destination_membership", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.destination_membership", "fqn": ["fivetran_log", "staging", "fivetran_platform", "destination_membership"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "destination_membership", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of the users given access to this destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the ID of the `destination` that the user is a member of.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "Foreign key referencing the ID of the `user` who has access to the destination", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "activated_at": {"name": "activated_at", "description": "Timestamp of when the user was activated in the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "joined_at": {"name": "joined_at", "description": "Timestamp of when the user was added to the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "role": {"name": "role", "description": "The user's permissions for this individual destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {"enabled": true}, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.destination_membership", "created_at": 1702408016.2277818}, "source.fivetran_log.fivetran_platform.user": {"database": "DBT_PACKAGE_TESTING", "schema": "fivetran_platform_integration_tests_1", "name": "user", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.user", "fqn": ["fivetran_log", "staging", "fivetran_platform", "user"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "user", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of users given access to this Fivetran account.", "columns": {"id": {"name": "id", "description": "Unique ID of the user's account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the user was created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "Email associated with the user.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "email_disabled": {"name": "email_disabled", "description": "Boolean of whether they have disabled all email notifications.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "family_name": {"name": "family_name", "description": "User's last name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "given_name": {"name": "given_name", "description": "User's first name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "phone": {"name": "phone", "description": "Phone number associated with user.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "verified": {"name": "verified", "description": "Boolean that indicates whether the user has verified their email address in the account creation process.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {"enabled": true}, "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.user", "created_at": 1702408016.2278779}}, "macros": {"macro.dbt_snowflake.snowflake__get_catalog": {"name": "snowflake__get_catalog", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog", "macro_sql": "{% macro snowflake__get_catalog(information_schema, schemas) -%}\n\n    {% set query %}\n        with tables as (\n            {{ snowflake__get_catalog_tables_sql(information_schema) }}\n            {{ snowflake__get_catalog_schemas_where_clause_sql(schemas) }}\n        ),\n        columns as (\n            {{ snowflake__get_catalog_columns_sql(information_schema) }}\n            {{ snowflake__get_catalog_schemas_where_clause_sql(schemas) }}\n        )\n        {{ snowflake__get_catalog_results_sql() }}\n    {%- endset -%}\n\n    {{ return(run_query(query)) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog_tables_sql", "macro.dbt_snowflake.snowflake__get_catalog_schemas_where_clause_sql", "macro.dbt_snowflake.snowflake__get_catalog_columns_sql", "macro.dbt_snowflake.snowflake__get_catalog_results_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.886265, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_relations": {"name": "snowflake__get_catalog_relations", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_relations", "macro_sql": "{% macro snowflake__get_catalog_relations(information_schema, relations) -%}\n\n    {% set query %}\n        with tables as (\n            {{ snowflake__get_catalog_tables_sql(information_schema) }}\n            {{ snowflake__get_catalog_relations_where_clause_sql(relations) }}\n        ),\n        columns as (\n            {{ snowflake__get_catalog_columns_sql(information_schema) }}\n            {{ snowflake__get_catalog_relations_where_clause_sql(relations) }}\n        )\n        {{ snowflake__get_catalog_results_sql() }}\n    {%- endset -%}\n\n    {{ return(run_query(query)) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog_tables_sql", "macro.dbt_snowflake.snowflake__get_catalog_relations_where_clause_sql", "macro.dbt_snowflake.snowflake__get_catalog_columns_sql", "macro.dbt_snowflake.snowflake__get_catalog_results_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.886687, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_tables_sql": {"name": "snowflake__get_catalog_tables_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_tables_sql", "macro_sql": "{% macro snowflake__get_catalog_tables_sql(information_schema) -%}\n    select\n        table_catalog as \"table_database\",\n        table_schema as \"table_schema\",\n        table_name as \"table_name\",\n        coalesce(table_type, 'DYNAMIC TABLE') as \"table_type\",\n        comment as \"table_comment\",\n\n        -- note: this is the _role_ that owns the table\n        table_owner as \"table_owner\",\n\n        'Clustering Key' as \"stats:clustering_key:label\",\n        clustering_key as \"stats:clustering_key:value\",\n        'The key used to cluster this table' as \"stats:clustering_key:description\",\n        (clustering_key is not null) as \"stats:clustering_key:include\",\n\n        'Row Count' as \"stats:row_count:label\",\n        row_count as \"stats:row_count:value\",\n        'An approximate count of rows in this table' as \"stats:row_count:description\",\n        (row_count is not null) as \"stats:row_count:include\",\n\n        'Approximate Size' as \"stats:bytes:label\",\n        bytes as \"stats:bytes:value\",\n        'Approximate size of the table as reported by Snowflake' as \"stats:bytes:description\",\n        (bytes is not null) as \"stats:bytes:include\",\n\n        'Last Modified' as \"stats:last_modified:label\",\n        to_varchar(convert_timezone('UTC', last_altered), 'yyyy-mm-dd HH24:MI'||'UTC') as \"stats:last_modified:value\",\n        'The timestamp for last update/change' as \"stats:last_modified:description\",\n        (last_altered is not null and table_type='BASE TABLE') as \"stats:last_modified:include\"\n    from {{ information_schema }}.tables\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.88689, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_columns_sql": {"name": "snowflake__get_catalog_columns_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_columns_sql", "macro_sql": "{% macro snowflake__get_catalog_columns_sql(information_schema) -%}\n    select\n        table_catalog as \"table_database\",\n        table_schema as \"table_schema\",\n        table_name as \"table_name\",\n\n        column_name as \"column_name\",\n        ordinal_position as \"column_index\",\n        data_type as \"column_type\",\n        comment as \"column_comment\"\n    from {{ information_schema }}.columns\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.8870149, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_results_sql": {"name": "snowflake__get_catalog_results_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_results_sql", "macro_sql": "{% macro snowflake__get_catalog_results_sql() -%}\n    select *\n    from tables\n    join columns using (\"table_database\", \"table_schema\", \"table_name\")\n    order by \"column_index\"\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.887102, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_schemas_where_clause_sql": {"name": "snowflake__get_catalog_schemas_where_clause_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_schemas_where_clause_sql", "macro_sql": "{% macro snowflake__get_catalog_schemas_where_clause_sql(schemas) -%}\n    where ({%- for schema in schemas -%}\n        upper(\"table_schema\") = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n    {%- endfor -%})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.8873658, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_relations_where_clause_sql": {"name": "snowflake__get_catalog_relations_where_clause_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_relations_where_clause_sql", "macro_sql": "{% macro snowflake__get_catalog_relations_where_clause_sql(relations) -%}\n    where (\n        {%- for relation in relations -%}\n            {% if relation.schema and relation.identifier %}\n                (\n                    upper(\"table_schema\") = upper('{{ relation.schema }}')\n                    and upper(\"table_name\") = upper('{{ relation.identifier }}')\n                )\n            {% elif relation.schema %}\n                (\n                    upper(\"table_schema\") = upper('{{ relation.schema }}')\n                )\n            {% else %}\n                {% do exceptions.raise_compiler_error(\n                    '`get_catalog_relations` requires a list of relations, each with a schema'\n                ) %}\n            {% endif %}\n\n            {%- if not loop.last %} or {% endif -%}\n        {%- endfor -%}\n    )\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.887891, "supported_languages": null}, "macro.dbt_snowflake.get_column_comment_sql": {"name": "get_column_comment_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.get_column_comment_sql", "macro_sql": "{% macro get_column_comment_sql(column_name, column_dict) -%}\n  {% if (column_name|upper in column_dict) -%}\n    {% set matched_column = column_name|upper -%}\n  {% elif (column_name|lower in column_dict) -%}\n    {% set matched_column = column_name|lower -%}\n  {% elif (column_name in column_dict) -%}\n    {% set matched_column = column_name -%}\n  {% else -%}\n    {% set matched_column = None -%}\n  {% endif -%}\n  {% if matched_column -%}\n    {{ adapter.quote(column_name) }} COMMENT $${{ column_dict[matched_column]['description'] | replace('$', '[$]') }}$$\n  {%- else -%}\n    {{ adapter.quote(column_name) }} COMMENT $$$$\n  {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.898263, "supported_languages": null}, "macro.dbt_snowflake.get_persist_docs_column_list": {"name": "get_persist_docs_column_list", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.get_persist_docs_column_list", "macro_sql": "{% macro get_persist_docs_column_list(model_columns, query_columns) %}\n(\n  {% for column_name in query_columns %}\n    {{ get_column_comment_sql(column_name, model_columns) }}\n    {{- \", \" if not loop.last else \"\" }}\n  {% endfor %}\n)\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.get_column_comment_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.898577, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_columns_in_relation": {"name": "snowflake__get_columns_in_relation", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_columns_in_relation", "macro_sql": "{% macro snowflake__get_columns_in_relation(relation) -%}\n  {%- set sql -%}\n    describe table {{ relation }}\n  {%- endset -%}\n  {%- set result = run_query(sql) -%}\n\n  {% set maximum = 10000 %}\n  {% if (result | length) >= maximum %}\n    {% set msg %}\n      Too many columns in relation {{ relation }}! dbt can only get\n      information about relations with fewer than {{ maximum }} columns.\n    {% endset %}\n    {% do exceptions.raise_compiler_error(msg) %}\n  {% endif %}\n\n  {% set columns = [] %}\n  {% for row in result %}\n    {% do columns.append(api.Column.from_description(row['name'], row['type'])) %}\n  {% endfor %}\n  {% do return(columns) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.8993979, "supported_languages": null}, "macro.dbt_snowflake.snowflake__list_schemas": {"name": "snowflake__list_schemas", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__list_schemas", "macro_sql": "{% macro snowflake__list_schemas(database) -%}\n  {# 10k limit from here: https://docs.snowflake.net/manuals/sql-reference/sql/show-schemas.html#usage-notes #}\n  {% set maximum = 10000 %}\n  {% set sql -%}\n    show terse schemas in database {{ database }}\n    limit {{ maximum }}\n  {%- endset %}\n  {% set result = run_query(sql) %}\n  {% if (result | length) >= maximum %}\n    {% set msg %}\n      Too many schemas in database {{ database }}! dbt can only get\n      information about databases with fewer than {{ maximum }} schemas.\n    {% endset %}\n    {% do exceptions.raise_compiler_error(msg) %}\n  {% endif %}\n  {{ return(result) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.899991, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_paginated_relations_array": {"name": "snowflake__get_paginated_relations_array", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_paginated_relations_array", "macro_sql": "{% macro snowflake__get_paginated_relations_array(max_iter, max_results_per_iter, max_total_results, schema_relation, watermark) %}\n\n  {% set paginated_relations = [] %}\n\n  {% for _ in range(0, max_iter) %}\n\n      {%- set paginated_sql -%}\n         show terse objects in {{ schema_relation }} limit {{ max_results_per_iter }} from '{{ watermark.table_name }}'\n      {%- endset -%}\n\n      {%- set paginated_result = run_query(paginated_sql) %}\n      {%- set paginated_n = (paginated_result | length) -%}\n\n      {#\n        terminating condition: if there are 0 records in the result we reached\n        the end exactly on the previous iteration\n      #}\n      {%- if paginated_n == 0 -%}\n        {%- break -%}\n      {%- endif -%}\n\n      {#\n        terminating condition: At some point the user needs to be reasonable with how\n        many objects are contained in their schemas. Since there was already\n        one iteration before attempting pagination, loop.index == max_iter means\n        the limit has been surpassed.\n      #}\n\n      {%- if loop.index == max_iter -%}\n        {%- set msg -%}\n           dbt will list a maximum of {{ max_total_results }} objects in schema {{ schema_relation }}.\n           Your schema exceeds this limit. Please contact support@getdbt.com for troubleshooting tips,\n           or review and reduce the number of objects contained.\n        {%- endset -%}\n\n        {% do exceptions.raise_compiler_error(msg) %}\n      {%- endif -%}\n\n      {%- do paginated_relations.append(paginated_result) -%}\n      {% set watermark.table_name = paginated_result.columns[1].values()[-1] %}\n\n      {#\n        terminating condition: paginated_n < max_results_per_iter means we reached the end\n      #}\n      {%- if paginated_n < max_results_per_iter -%}\n         {%- break -%}\n      {%- endif -%}\n    {%- endfor -%}\n\n  {{ return(paginated_relations) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.901149, "supported_languages": null}, "macro.dbt_snowflake.snowflake__list_relations_without_caching": {"name": "snowflake__list_relations_without_caching", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__list_relations_without_caching", "macro_sql": "{% macro snowflake__list_relations_without_caching(schema_relation, max_iter=10, max_results_per_iter=10000) %}\n\n  {%- set max_total_results = max_results_per_iter * max_iter -%}\n\n  {%- set sql -%}\n    show terse objects in {{ schema_relation }} limit {{ max_results_per_iter }}\n  {%- endset -%}\n\n  {%- set result = run_query(sql) -%}\n\n  {%- set n = (result | length) -%}\n  {%- set watermark = namespace(table_name=result.columns[1].values()[-1]) -%}\n  {%- set paginated = namespace(result=[]) -%}\n\n  {% if n >= max_results_per_iter %}\n\n    {% set paginated.result = snowflake__get_paginated_relations_array(\n         max_iter,\n         max_results_per_iter,\n         max_total_results,\n         schema_relation,\n         watermark\n       )\n    %}\n\n  {% endif %}\n\n  {%- set all_results_array = [result] + paginated.result -%}\n  {%- set result = result.merge(all_results_array) -%}\n  {%- do return(result) -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt_snowflake.snowflake__get_paginated_relations_array"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.902099, "supported_languages": null}, "macro.dbt_snowflake.snowflake__check_schema_exists": {"name": "snowflake__check_schema_exists", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__check_schema_exists", "macro_sql": "{% macro snowflake__check_schema_exists(information_schema, schema) -%}\n  {% call statement('check_schema_exists', fetch_result=True) -%}\n        select count(*)\n        from {{ information_schema }}.schemata\n        where upper(schema_name) = upper('{{ schema }}')\n            and upper(catalog_name) = upper('{{ information_schema.database }}')\n  {%- endcall %}\n  {{ return(load_result('check_schema_exists').table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.902443, "supported_languages": null}, "macro.dbt_snowflake.snowflake__alter_column_type": {"name": "snowflake__alter_column_type", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__alter_column_type", "macro_sql": "{% macro snowflake__alter_column_type(relation, column_name, new_column_type) -%}\n  {% call statement('alter_column_type') %}\n    alter table {{ relation }} alter {{ adapter.quote(column_name) }} set data type {{ new_column_type }};\n  {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.902702, "supported_languages": null}, "macro.dbt_snowflake.snowflake__alter_relation_comment": {"name": "snowflake__alter_relation_comment", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__alter_relation_comment", "macro_sql": "{% macro snowflake__alter_relation_comment(relation, relation_comment) -%}\n    {%- if relation.is_dynamic_table -%}\n        {%- set relation_type = 'dynamic table' -%}\n    {%- else -%}\n        {%- set relation_type = relation.type -%}\n    {%- endif -%}\n    comment on {{ relation_type }} {{ relation }} IS $${{ relation_comment | replace('$', '[$]') }}$$;\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9030468, "supported_languages": null}, "macro.dbt_snowflake.snowflake__alter_column_comment": {"name": "snowflake__alter_column_comment", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__alter_column_comment", "macro_sql": "{% macro snowflake__alter_column_comment(relation, column_dict) -%}\n    {% set existing_columns = adapter.get_columns_in_relation(relation) | map(attribute=\"name\") | list %}\n    {% if relation.is_dynamic_table -%}\n        {% set relation_type = \"table\" %}\n    {% else -%}\n        {% set relation_type = relation.type %}\n    {% endif %}\n    alter {{ relation_type }} {{ relation }} alter\n    {% for column_name in existing_columns if (column_name in existing_columns) or (column_name|lower in existing_columns) %}\n        {{ get_column_comment_sql(column_name, column_dict) }} {{- ',' if not loop.last else ';' }}\n    {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.get_column_comment_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.903733, "supported_languages": null}, "macro.dbt_snowflake.get_current_query_tag": {"name": "get_current_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.get_current_query_tag", "macro_sql": "{% macro get_current_query_tag() -%}\n  {{ return(run_query(\"show parameters like 'query_tag' in session\").rows[0]['value']) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9039261, "supported_languages": null}, "macro.dbt_snowflake.set_query_tag": {"name": "set_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.set_query_tag", "macro_sql": "{% macro set_query_tag() -%}\n    {{ return(adapter.dispatch('set_query_tag', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__set_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.904093, "supported_languages": null}, "macro.dbt_snowflake.snowflake__set_query_tag": {"name": "snowflake__set_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__set_query_tag", "macro_sql": "{% macro snowflake__set_query_tag() -%}\n  {% set new_query_tag = config.get('query_tag') %}\n  {% if new_query_tag %}\n    {% set original_query_tag = get_current_query_tag() %}\n    {{ log(\"Setting query_tag to '\" ~ new_query_tag ~ \"'. Will reset to '\" ~ original_query_tag ~ \"' after materialization.\") }}\n    {% do run_query(\"alter session set query_tag = '{}'\".format(new_query_tag)) %}\n    {{ return(original_query_tag)}}\n  {% endif %}\n  {{ return(none)}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.get_current_query_tag", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9045792, "supported_languages": null}, "macro.dbt_snowflake.unset_query_tag": {"name": "unset_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.unset_query_tag", "macro_sql": "{% macro unset_query_tag(original_query_tag) -%}\n    {{ return(adapter.dispatch('unset_query_tag', 'dbt')(original_query_tag)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.904769, "supported_languages": null}, "macro.dbt_snowflake.snowflake__unset_query_tag": {"name": "snowflake__unset_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__unset_query_tag", "macro_sql": "{% macro snowflake__unset_query_tag(original_query_tag) -%}\n  {% set new_query_tag = config.get('query_tag') %}\n  {% if new_query_tag %}\n    {% if original_query_tag %}\n      {{ log(\"Resetting query_tag to '\" ~ original_query_tag ~ \"'.\") }}\n      {% do run_query(\"alter session set query_tag = '{}'\".format(original_query_tag)) %}\n    {% else %}\n      {{ log(\"No original query_tag, unsetting parameter.\") }}\n      {% do run_query(\"alter session unset query_tag\") %}\n    {% endif %}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9052632, "supported_languages": null}, "macro.dbt_snowflake.snowflake__alter_relation_add_remove_columns": {"name": "snowflake__alter_relation_add_remove_columns", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__alter_relation_add_remove_columns", "macro_sql": "{% macro snowflake__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n\n    {% if relation.is_dynamic_table -%}\n        {% set relation_type = \"dynamic table\" %}\n    {% else -%}\n        {% set relation_type = relation.type %}\n    {% endif %}\n\n    {% if add_columns %}\n\n    {% set sql -%}\n       alter {{ relation_type }} {{ relation }} add column\n          {% for column in add_columns %}\n            {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n          {% endfor %}\n    {%- endset -%}\n\n    {% do run_query(sql) %}\n\n    {% endif %}\n\n    {% if remove_columns %}\n\n    {% set sql -%}\n        alter {{ relation_type }} {{ relation }} drop column\n            {% for column in remove_columns %}\n                {{ column.name }}{{ ',' if not loop.last }}\n            {% endfor %}\n    {%- endset -%}\n\n    {% do run_query(sql) %}\n\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9061718, "supported_languages": null}, "macro.dbt_snowflake.snowflake_dml_explicit_transaction": {"name": "snowflake_dml_explicit_transaction", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake_dml_explicit_transaction", "macro_sql": "{% macro snowflake_dml_explicit_transaction(dml) %}\n  {#\n    Use this macro to wrap all INSERT, MERGE, UPDATE, DELETE, and TRUNCATE\n    statements before passing them into run_query(), or calling in the 'main' statement\n    of a materialization\n  #}\n  {% set dml_transaction -%}\n    begin;\n    {{ dml }};\n    commit;\n  {%- endset %}\n\n  {% do return(dml_transaction) %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.906393, "supported_languages": null}, "macro.dbt_snowflake.snowflake__truncate_relation": {"name": "snowflake__truncate_relation", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__truncate_relation", "macro_sql": "{% macro snowflake__truncate_relation(relation) -%}\n  {% set truncate_dml %}\n    truncate table {{ relation }}\n  {% endset %}\n  {% call statement('truncate_relation') -%}\n    {{ snowflake_dml_explicit_transaction(truncate_dml) }}\n  {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.906645, "supported_languages": null}, "macro.dbt_snowflake.snowflake__copy_grants": {"name": "snowflake__copy_grants", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/apply_grants.sql", "original_file_path": "macros/apply_grants.sql", "unique_id": "macro.dbt_snowflake.snowflake__copy_grants", "macro_sql": "{% macro snowflake__copy_grants() %}\n    {% set copy_grants = config.get('copy_grants', False) %}\n    {{ return(copy_grants) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.90694, "supported_languages": null}, "macro.dbt_snowflake.snowflake__support_multiple_grantees_per_dcl_statement": {"name": "snowflake__support_multiple_grantees_per_dcl_statement", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/apply_grants.sql", "original_file_path": "macros/apply_grants.sql", "unique_id": "macro.dbt_snowflake.snowflake__support_multiple_grantees_per_dcl_statement", "macro_sql": "\n\n{%- macro snowflake__support_multiple_grantees_per_dcl_statement() -%}\n    {{ return(False) }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.907058, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_relation_last_modified": {"name": "snowflake__get_relation_last_modified", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/metadata.sql", "original_file_path": "macros/metadata.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_relation_last_modified", "macro_sql": "{% macro snowflake__get_relation_last_modified(information_schema, relations) -%}\n\n  {%- call statement('last_modified', fetch_result=True) -%}\n        select table_schema as schema,\n               table_name as identifier,\n               last_altered as last_modified,\n               {{ current_timestamp() }} as snapshotted_at\n        from {{ information_schema }}.tables\n        where (\n          {%- for relation in relations -%}\n            (upper(table_schema) = upper('{{ relation.schema }}') and\n             upper(table_name) = upper('{{ relation.identifier }}')){%- if not loop.last %} or {% endif -%}\n          {%- endfor -%}\n        )\n  {%- endcall -%}\n\n  {{ return(load_result('last_modified')) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.907756, "supported_languages": null}, "macro.dbt_snowflake.materialization_test_snowflake": {"name": "materialization_test_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/test.sql", "original_file_path": "macros/materializations/test.sql", "unique_id": "macro.dbt_snowflake.materialization_test_snowflake", "macro_sql": "{%- materialization test, adapter='snowflake' -%}\n\n    {% set original_query_tag = set_query_tag() %}\n    {% set relations = materialization_test_default() %}\n    {% do unset_query_tag(original_query_tag) %}\n    {{ return(relations) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.materialization_test_default", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.908118, "supported_languages": ["sql"]}, "macro.dbt_snowflake.snowflake__get_merge_sql": {"name": "snowflake__get_merge_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_merge_sql", "macro_sql": "{% macro snowflake__get_merge_sql(target, source_sql, unique_key, dest_columns, incremental_predicates) -%}\n\n    {#\n       Workaround for Snowflake not being happy with a merge on a constant-false predicate.\n       When no unique_key is provided, this macro will do a regular insert. If a unique_key\n       is provided, then this macro will do a proper merge instead.\n    #}\n\n    {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute='name')) -%}\n    {%- set sql_header = config.get('sql_header', none) -%}\n\n    {%- set dml -%}\n    {%- if unique_key is none -%}\n\n        {{ sql_header if sql_header is not none }}\n\n        insert into {{ target }} ({{ dest_cols_csv }})\n        (\n            select {{ dest_cols_csv }}\n            from {{ source_sql }}\n        )\n\n    {%- else -%}\n\n        {{ default__get_merge_sql(target, source_sql, unique_key, dest_columns, incremental_predicates) }}\n\n    {%- endif -%}\n    {%- endset -%}\n\n    {% do return(snowflake_dml_explicit_transaction(dml)) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv", "macro.dbt.default__get_merge_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.909515, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_delete_insert_merge_sql": {"name": "snowflake__get_delete_insert_merge_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_delete_insert_merge_sql", "macro_sql": "{% macro snowflake__get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) %}\n    {% set dml = default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) %}\n    {% do return(snowflake_dml_explicit_transaction(dml)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_delete_insert_merge_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.909835, "supported_languages": null}, "macro.dbt_snowflake.snowflake__snapshot_merge_sql": {"name": "snowflake__snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "unique_id": "macro.dbt_snowflake.snowflake__snapshot_merge_sql", "macro_sql": "{% macro snowflake__snapshot_merge_sql(target, source, insert_cols) %}\n    {% set dml = default__snapshot_merge_sql(target, source, insert_cols) %}\n    {% do return(snowflake_dml_explicit_transaction(dml)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__snapshot_merge_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9101079, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_incremental_append_sql": {"name": "snowflake__get_incremental_append_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_incremental_append_sql", "macro_sql": "{% macro snowflake__get_incremental_append_sql(get_incremental_append_sql) %}\n    {% set dml = default__get_incremental_append_sql(get_incremental_append_sql) %}\n    {% do return(snowflake_dml_explicit_transaction(dml)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_append_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.91032, "supported_languages": null}, "macro.dbt_snowflake.snowflake__load_csv_rows": {"name": "snowflake__load_csv_rows", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "unique_id": "macro.dbt_snowflake.snowflake__load_csv_rows", "macro_sql": "{% macro snowflake__load_csv_rows(model, agate_table) %}\n    {% set batch_size = get_batch_size() %}\n    {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n    {% set bindings = [] %}\n\n    {% set statements = [] %}\n\n    {% for chunk in agate_table.rows | batch(batch_size) %}\n        {% set bindings = [] %}\n\n        {% for row in chunk %}\n            {% do bindings.extend(row) %}\n        {% endfor %}\n\n        {% set sql %}\n            insert into {{ this.render() }} ({{ cols_sql }}) values\n            {% for row in chunk -%}\n                ({%- for column in agate_table.column_names -%}\n                    %s\n                    {%- if not loop.last%},{%- endif %}\n                {%- endfor -%})\n                {%- if not loop.last%},{%- endif %}\n            {%- endfor %}\n        {% endset %}\n\n        {% do adapter.add_query('BEGIN', auto_begin=False) %}\n        {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n        {% do adapter.add_query('COMMIT', auto_begin=False) %}\n\n        {% if loop.index0 == 0 %}\n            {% do statements.append(sql) %}\n        {% endif %}\n    {% endfor %}\n\n    {# Return SQL so we can render it out into the compiled files #}\n    {{ return(statements[0]) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.912678, "supported_languages": null}, "macro.dbt_snowflake.materialization_seed_snowflake": {"name": "materialization_seed_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "unique_id": "macro.dbt_snowflake.materialization_seed_snowflake", "macro_sql": "{% materialization seed, adapter='snowflake' %}\n    {% set original_query_tag = set_query_tag() %}\n\n    {% set relations = materialization_seed_default() %}\n\n    {% do unset_query_tag(original_query_tag) %}\n\n    {{ return(relations) }}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.materialization_seed_default", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.912988, "supported_languages": ["sql"]}, "macro.dbt_snowflake.materialization_view_snowflake": {"name": "materialization_view_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "unique_id": "macro.dbt_snowflake.materialization_view_snowflake", "macro_sql": "{% materialization view, adapter='snowflake' -%}\n\n    {% set original_query_tag = set_query_tag() %}\n    {% set to_return = snowflake__create_or_replace_view() %}\n\n    {% set target_relation = this.incorporate(type='view') %}\n\n    {% do persist_docs(target_relation, model, for_columns=false) %}\n\n    {% do unset_query_tag(original_query_tag) %}\n\n    {% do return(to_return) %}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt_snowflake.snowflake__create_or_replace_view", "macro.dbt.persist_docs", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9135401, "supported_languages": ["sql"]}, "macro.dbt_snowflake.materialization_table_snowflake": {"name": "materialization_table_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_snowflake.materialization_table_snowflake", "macro_sql": "{% materialization table, adapter='snowflake', supported_languages=['sql', 'python']%}\n\n  {% set original_query_tag = set_query_tag() %}\n\n  {%- set identifier = model['alias'] -%}\n  {%- set language = model['language'] -%}\n\n  {% set grant_config = config.get('grants') %}\n\n  {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n  {%- set target_relation = api.Relation.create(identifier=identifier,\n                                                schema=schema,\n                                                database=database, type='table') -%}\n\n  {{ run_hooks(pre_hooks) }}\n\n  {#-- Drop the relation if it was a view to \"convert\" it in a table. This may lead to\n    -- downtime, but it should be a relatively infrequent occurrence  #}\n  {% if old_relation is not none and not old_relation.is_table %}\n    {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n    {{ drop_relation_if_exists(old_relation) }}\n  {% endif %}\n\n  {% call statement('main', language=language) -%}\n      {{ create_table_as(False, target_relation, compiled_code, language) }}\n  {%- endcall %}\n\n  {{ run_hooks(post_hooks) }}\n\n  {% set should_revoke = should_revoke(old_relation, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {% do unset_query_tag(original_query_tag) %}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.915818, "supported_languages": ["sql", "python"]}, "macro.dbt_snowflake.py_write_table": {"name": "py_write_table", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_snowflake.py_write_table", "macro_sql": "{% macro py_write_table(compiled_code, target_relation, temporary=False, table_type=none) %}\n{#- The following logic is only for backwards-compatiblity with deprecated `temporary` parameter -#}\n{% if table_type is not none %}\n    {#- Just use the table_type as-is -#}\n{% elif temporary -%}\n    {#- Case 1 when the deprecated `temporary` parameter is used without the replacement `table_type` parameter -#}\n    {%- set table_type = \"temporary\" -%}\n{% else %}\n    {#- Case 2 when the deprecated `temporary` parameter is used without the replacement `table_type` parameter -#}\n    {#- Snowflake treats \"\" as meaning \"permanent\" -#}\n    {%- set table_type = \"\" -%}\n{%- endif %}\n{{ compiled_code }}\ndef materialize(session, df, target_relation):\n    # make sure pandas exists\n    import importlib.util\n    package_name = 'pandas'\n    if importlib.util.find_spec(package_name):\n        import pandas\n        if isinstance(df, pandas.core.frame.DataFrame):\n          session.use_database(target_relation.database)\n          session.use_schema(target_relation.schema)\n          # session.write_pandas does not have overwrite function\n          df = session.createDataFrame(df)\n    {% set target_relation_name = resolve_model_name(target_relation) %}\n    df.write.mode(\"overwrite\").save_as_table('{{ target_relation_name }}', table_type='{{table_type}}')\n\ndef main(session):\n    dbt = dbtObj(session.table)\n    df = model(dbt, session)\n    materialize(session, df, dbt.this)\n    return \"OK\"\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.916328, "supported_languages": null}, "macro.dbt_snowflake.py_script_comment": {"name": "py_script_comment", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_snowflake.py_script_comment", "macro_sql": "{% macro py_script_comment()%}\n# To run this in snowsight, you need to select entry point to be main\n# And you may have to modify the return type to text to get the result back\n# def main(session):\n#     dbt = dbtObj(session.table)\n#     df = model(dbt, session)\n#     return df.collect()\n\n# to run this in local notebook, you need to create a session following examples https://github.com/Snowflake-Labs/sfguide-getting-started-snowpark-python\n# then you can do the following to run model\n# dbt = dbtObj(session.table)\n# df = model(dbt, session)\n{%endmacro%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.916436, "supported_languages": null}, "macro.dbt_snowflake.dbt_snowflake_get_tmp_relation_type": {"name": "dbt_snowflake_get_tmp_relation_type", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_snowflake.dbt_snowflake_get_tmp_relation_type", "macro_sql": "{% macro dbt_snowflake_get_tmp_relation_type(strategy, unique_key, language) %}\n{%- set tmp_relation_type = config.get('tmp_relation_type') -%}\n  /* {#\n       High-level principles:\n       If we are running multiple statements (DELETE + INSERT),\n       and we want to guarantee identical inputs to both statements,\n       then we must first save the model query results as a temporary table\n       (which presumably comes with a performance cost).\n       If we are running a single statement (MERGE or INSERT alone),\n       we _may_ save the model query definition as a view instead,\n       for (presumably) faster overall incremental processing.\n\n       Low-level specifics:\n       If an invalid option is specified, then we will raise an\n       excpetion with corresponding message.\n\n       Languages other than SQL (like Python) will use a temporary table.\n       With the default strategy of merge, the user may choose between a temporary\n       table and view (defaulting to view).\n\n       The append strategy can use a view because it will run a single INSERT statement.\n\n       When unique_key is none, the delete+insert strategy can use a view beacuse a\n       single INSERT statement is run with no DELETES as part of the statement.\n       Otherwise, play it safe by using a temporary table.\n  #} */\n\n  {% if language == \"python\" and tmp_relation_type is not none %}\n    {% do exceptions.raise_compiler_error(\n      \"Python models currently only support 'table' for tmp_relation_type but \"\n       ~ tmp_relation_type ~ \" was specified.\"\n    ) %}\n  {% endif %}\n\n  {% if strategy == \"delete+insert\" and tmp_relation_type is not none and tmp_relation_type != \"table\" and unique_key is not none %}\n    {% do exceptions.raise_compiler_error(\n      \"In order to maintain consistent results when `unique_key` is not none,\n      the `delete+insert` strategy only supports `table` for `tmp_relation_type` but \"\n      ~ tmp_relation_type ~ \" was specified.\"\n      )\n  %}\n  {% endif %}\n\n  {% if language != \"sql\" %}\n    {{ return(\"table\") }}\n  {% elif tmp_relation_type == \"table\" %}\n    {{ return(\"table\") }}\n  {% elif tmp_relation_type == \"view\" %}\n    {{ return(\"view\") }}\n  {% elif strategy in (\"default\", \"merge\", \"append\") %}\n    {{ return(\"view\") }}\n  {% elif strategy == \"delete+insert\" and unique_key is none %}\n    {{ return(\"view\") }}\n  {% else %}\n    {{ return(\"table\") }}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.918999, "supported_languages": null}, "macro.dbt_snowflake.materialization_incremental_snowflake": {"name": "materialization_incremental_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_snowflake.materialization_incremental_snowflake", "macro_sql": "{% materialization incremental, adapter='snowflake', supported_languages=['sql', 'python'] -%}\n\n  {% set original_query_tag = set_query_tag() %}\n\n  {#-- Set vars --#}\n  {%- set full_refresh_mode = (should_full_refresh()) -%}\n  {%- set language = model['language'] -%}\n  {% set target_relation = this %}\n  {% set existing_relation = load_relation(this) %}\n\n  {#-- The temp relation will be a view (faster) or temp table, depending on upsert/merge strategy --#}\n  {%- set unique_key = config.get('unique_key') -%}\n  {% set incremental_strategy = config.get('incremental_strategy') or 'default' %}\n  {% set tmp_relation_type = dbt_snowflake_get_tmp_relation_type(incremental_strategy, unique_key, language) %}\n  {% set tmp_relation = make_temp_relation(this).incorporate(type=tmp_relation_type) %}\n\n  {% set grant_config = config.get('grants') %}\n\n  {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %}\n\n  {{ run_hooks(pre_hooks) }}\n\n  {% if existing_relation is none %}\n    {%- call statement('main', language=language) -%}\n      {{ create_table_as(False, target_relation, compiled_code, language) }}\n    {%- endcall -%}\n\n  {% elif existing_relation.is_view %}\n    {#-- Can't overwrite a view with a table - we must drop --#}\n    {{ log(\"Dropping relation \" ~ target_relation ~ \" because it is a view and this model is a table.\") }}\n    {% do adapter.drop_relation(existing_relation) %}\n    {%- call statement('main', language=language) -%}\n      {{ create_table_as(False, target_relation, compiled_code, language) }}\n    {%- endcall -%}\n  {% elif full_refresh_mode %}\n    {%- call statement('main', language=language) -%}\n      {{ create_table_as(False, target_relation, compiled_code, language) }}\n    {%- endcall -%}\n\n  {% else %}\n    {#-- Create the temp relation, either as a view or as a temp table --#}\n    {% if tmp_relation_type == 'view' %}\n        {%- call statement('create_tmp_relation') -%}\n          {{ snowflake__create_view_as_with_temp_flag(tmp_relation, compiled_code, True) }}\n        {%- endcall -%}\n    {% else %}\n        {%- call statement('create_tmp_relation', language=language) -%}\n          {{ create_table_as(True, tmp_relation, compiled_code, language) }}\n        {%- endcall -%}\n    {% endif %}\n\n    {% do adapter.expand_target_column_types(\n           from_relation=tmp_relation,\n           to_relation=target_relation) %}\n    {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n    {% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}\n    {% if not dest_columns %}\n      {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n    {% endif %}\n\n    {#-- Get the incremental_strategy, the macro to use for the strategy, and build the sql --#}\n    {% set incremental_predicates = config.get('predicates', none) or config.get('incremental_predicates', none) %}\n    {% set strategy_sql_macro_func = adapter.get_incremental_strategy_macro(context, incremental_strategy) %}\n    {% set strategy_arg_dict = ({'target_relation': target_relation, 'temp_relation': tmp_relation, 'unique_key': unique_key, 'dest_columns': dest_columns, 'incremental_predicates': incremental_predicates }) %}\n\n    {%- call statement('main') -%}\n      {{ strategy_sql_macro_func(strategy_arg_dict) }}\n    {%- endcall -%}\n  {% endif %}\n\n  {% do drop_relation_if_exists(tmp_relation) %}\n\n  {{ run_hooks(post_hooks) }}\n\n  {% set target_relation = target_relation.incorporate(type='table') %}\n\n  {% set should_revoke =\n   should_revoke(existing_relation.is_table, full_refresh_mode) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {% do unset_query_tag(original_query_tag) %}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.should_full_refresh", "macro.dbt.load_relation", "macro.dbt_snowflake.dbt_snowflake_get_tmp_relation_type", "macro.dbt.make_temp_relation", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt_snowflake.snowflake__create_view_as_with_temp_flag", "macro.dbt.process_schema_changes", "macro.dbt.drop_relation_if_exists", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.958792, "supported_languages": ["sql", "python"]}, "macro.dbt_snowflake.snowflake__get_incremental_default_sql": {"name": "snowflake__get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_incremental_default_sql", "macro_sql": "{% macro snowflake__get_incremental_default_sql(arg_dict) %}\n  {{ return(get_incremental_merge_sql(arg_dict)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_incremental_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9590049, "supported_languages": null}, "macro.dbt_snowflake.materialization_snapshot_snowflake": {"name": "materialization_snapshot_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "unique_id": "macro.dbt_snowflake.materialization_snapshot_snowflake", "macro_sql": "{% materialization snapshot, adapter='snowflake' %}\n    {% set original_query_tag = set_query_tag() %}\n    {% set relations = materialization_snapshot_default() %}\n\n    {% do unset_query_tag(original_query_tag) %}\n\n    {{ return(relations) }}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.materialization_snapshot_default", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.959401, "supported_languages": ["sql"]}, "macro.dbt_snowflake.materialization_dynamic_table_snowflake": {"name": "materialization_dynamic_table_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.materialization_dynamic_table_snowflake", "macro_sql": "{% materialization dynamic_table, adapter='snowflake' %}\n\n    {% set query_tag = set_query_tag() %}\n\n    {% set existing_relation = load_cached_relation(this) %}\n    {% set target_relation = this.incorporate(type=this.DynamicTable) %}\n\n    {{ run_hooks(pre_hooks) }}\n\n    {% set build_sql = dynamic_table_get_build_sql(existing_relation, target_relation) %}\n\n    {% if build_sql == '' %}\n        {{ dynamic_table_execute_no_op(target_relation) }}\n    {% else %}\n        {{ dynamic_table_execute_build_sql(build_sql, existing_relation, target_relation) }}\n    {% endif %}\n\n    {{ run_hooks(post_hooks) }}\n\n    {% do unset_query_tag(query_tag) %}\n\n    {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.load_cached_relation", "macro.dbt.run_hooks", "macro.dbt_snowflake.dynamic_table_get_build_sql", "macro.dbt_snowflake.dynamic_table_execute_no_op", "macro.dbt_snowflake.dynamic_table_execute_build_sql", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.96301, "supported_languages": ["sql"]}, "macro.dbt_snowflake.dynamic_table_get_build_sql": {"name": "dynamic_table_get_build_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.dynamic_table_get_build_sql", "macro_sql": "{% macro dynamic_table_get_build_sql(existing_relation, target_relation) %}\n\n    {% set full_refresh_mode = should_full_refresh() %}\n\n    -- determine the scenario we're in: create, full_refresh, alter, refresh data\n    {% if existing_relation is none %}\n        {% set build_sql = get_create_sql(target_relation, sql) %}\n    {% elif full_refresh_mode or not existing_relation.is_dynamic_table %}\n        {% set build_sql = get_replace_sql(existing_relation, target_relation, sql) %}\n    {% else %}\n\n        -- get config options\n        {% set on_configuration_change = config.get('on_configuration_change') %}\n        {% set configuration_changes = snowflake__get_dynamic_table_configuration_changes(existing_relation, config) %}\n\n        {% if configuration_changes is none %}\n            {% set build_sql = '' %}\n            {{ exceptions.warn(\"No configuration changes were identified on: `\" ~ target_relation ~ \"`. Continuing.\") }}\n\n        {% elif on_configuration_change == 'apply' %}\n            {% set build_sql = snowflake__get_alter_dynamic_table_as_sql(existing_relation, configuration_changes, target_relation, sql) %}\n        {% elif on_configuration_change == 'continue' %}\n            {% set build_sql = '' %}\n            {{ exceptions.warn(\"Configuration changes were identified and `on_configuration_change` was set to `continue` for `\" ~ target_relation ~ \"`\") }}\n        {% elif on_configuration_change == 'fail' %}\n            {{ exceptions.raise_fail_fast_error(\"Configuration changes were identified and `on_configuration_change` was set to `fail` for `\" ~ target_relation ~ \"`\") }}\n\n        {% else %}\n            -- this only happens if the user provides a value other than `apply`, 'continue', 'fail'\n            {{ exceptions.raise_compiler_error(\"Unexpected configuration scenario: `\" ~ on_configuration_change ~ \"`\") }}\n\n        {% endif %}\n\n    {% endif %}\n\n    {% do return(build_sql) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.get_create_sql", "macro.dbt.get_replace_sql", "macro.dbt_snowflake.snowflake__get_dynamic_table_configuration_changes", "macro.dbt_snowflake.snowflake__get_alter_dynamic_table_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9643772, "supported_languages": null}, "macro.dbt_snowflake.dynamic_table_execute_no_op": {"name": "dynamic_table_execute_no_op", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.dynamic_table_execute_no_op", "macro_sql": "{% macro dynamic_table_execute_no_op(relation) %}\n    {% do store_raw_result(\n        name=\"main\",\n        message=\"skip \" ~ relation,\n        code=\"skip\",\n        rows_affected=\"-1\"\n    ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9646258, "supported_languages": null}, "macro.dbt_snowflake.dynamic_table_execute_build_sql": {"name": "dynamic_table_execute_build_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.dynamic_table_execute_build_sql", "macro_sql": "{% macro dynamic_table_execute_build_sql(build_sql, existing_relation, target_relation) %}\n\n    {% set grant_config = config.get('grants') %}\n\n    {% call statement(name=\"main\") %}\n        {{ build_sql }}\n    {% endcall %}\n\n    {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n    {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n    {% do persist_docs(target_relation, model) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.96513, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_dynamic_table_configuration_changes": {"name": "snowflake__get_dynamic_table_configuration_changes", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_dynamic_table_configuration_changes", "macro_sql": "{% macro snowflake__get_dynamic_table_configuration_changes(existing_relation, new_config) -%}\n    {% set _existing_dynamic_table = snowflake__describe_dynamic_table(existing_relation) %}\n    {% set _configuration_changes = existing_relation.dynamic_table_config_changeset(_existing_dynamic_table, new_config) %}\n    {% do return(_configuration_changes) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__describe_dynamic_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9654138, "supported_languages": null}, "macro.dbt_snowflake.snowflake__can_clone_table": {"name": "snowflake__can_clone_table", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/clone.sql", "original_file_path": "macros/materializations/clone.sql", "unique_id": "macro.dbt_snowflake.snowflake__can_clone_table", "macro_sql": "{% macro snowflake__can_clone_table() %}\n    {{ return(True) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.965667, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_or_replace_clone": {"name": "snowflake__create_or_replace_clone", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/clone.sql", "original_file_path": "macros/materializations/clone.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_or_replace_clone", "macro_sql": "{% macro snowflake__create_or_replace_clone(this_relation, defer_relation) %}\n    create or replace\n      {{ \"transient\" if config.get(\"transient\", true) }}\n      table {{ this_relation }}\n      clone {{ defer_relation }}\n      {{ \"copy grants\" if config.get(\"copy_grants\", false) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.965965, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_drop_sql": {"name": "snowflake__get_drop_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_drop_sql", "macro_sql": "{% macro snowflake__get_drop_sql(relation) %}\n\n    {% if relation.is_dynamic_table %}\n        {{ snowflake__get_drop_dynamic_table_sql(relation) }}\n\n    {% else %}\n        {{ default__get_drop_sql(relation) }}\n\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_drop_dynamic_table_sql", "macro.dbt.default__get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.966285, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_replace_sql": {"name": "snowflake__get_replace_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/replace.sql", "original_file_path": "macros/relations/replace.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_replace_sql", "macro_sql": "{% macro snowflake__get_replace_sql(existing_relation, target_relation, sql) %}\n\n    {% if existing_relation.is_dynamic_table and target_relation.is_dynamic_table %}\n        {{ snowflake__get_replace_dynamic_table_sql(target_relation, sql) }}\n\n    {% else %}\n        {{ default__get_replace_sql(existing_relation, target_relation, sql) }}\n\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_replace_dynamic_table_sql", "macro.dbt.default__get_replace_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9666939, "supported_languages": null}, "macro.dbt_snowflake.snowflake__rename_relation": {"name": "snowflake__rename_relation", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt_snowflake.snowflake__rename_relation", "macro_sql": "{% macro snowflake__rename_relation(from_relation, to_relation) -%}\n  {% call statement('rename_relation') -%}\n    alter table {{ from_relation }} rename to {{ to_relation }}\n  {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.96695, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_create_sql": {"name": "snowflake__get_create_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/create.sql", "original_file_path": "macros/relations/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_create_sql", "macro_sql": "{% macro snowflake__get_create_sql(relation, sql) %}\n\n    {% if relation.is_dynamic_table %}\n        {{ snowflake__get_create_dynamic_table_as_sql(relation, sql) }}\n\n    {% else %}\n        {{ default__get_create_sql(relation, sql) }}\n\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_create_dynamic_table_as_sql", "macro.dbt.default__get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9673011, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_drop_table_sql": {"name": "snowflake__get_drop_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_drop_table_sql", "macro_sql": "{% macro snowflake__get_drop_table_sql(relation) %}\n    drop table if exists {{ relation }} cascade\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.96744, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_replace_table_sql": {"name": "snowflake__get_replace_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_replace_table_sql", "macro_sql": "{% macro snowflake__get_replace_table_sql(relation, sql) %}\n    {{ snowflake__create_table_as(False, relation, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.967633, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_rename_table_sql": {"name": "snowflake__get_rename_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_rename_table_sql", "macro_sql": "{%- macro snowflake__get_rename_table_sql(relation, new_name) -%}\n    alter table {{ relation }} rename to {{ new_name }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.967808, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_table_as": {"name": "snowflake__create_table_as", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_table_as", "macro_sql": "{% macro snowflake__create_table_as(temporary, relation, compiled_code, language='sql') -%}\n  {%- set transient = config.get('transient', default=true) -%}\n\n  {% if temporary -%}\n    {%- set table_type = \"temporary\" -%}\n  {%- elif transient -%}\n    {%- set table_type = \"transient\" -%}\n  {%- else -%}\n    {%- set table_type = \"\" -%}\n  {%- endif %}\n\n  {%- if language == 'sql' -%}\n    {%- set cluster_by_keys = config.get('cluster_by', default=none) -%}\n    {%- set enable_automatic_clustering = config.get('automatic_clustering', default=false) -%}\n    {%- set copy_grants = config.get('copy_grants', default=false) -%}\n\n    {%- if cluster_by_keys is not none and cluster_by_keys is string -%}\n      {%- set cluster_by_keys = [cluster_by_keys] -%}\n    {%- endif -%}\n    {%- if cluster_by_keys is not none -%}\n      {%- set cluster_by_string = cluster_by_keys|join(\", \")-%}\n    {% else %}\n      {%- set cluster_by_string = none -%}\n    {%- endif -%}\n    {%- set sql_header = config.get('sql_header', none) -%}\n\n    {{ sql_header if sql_header is not none }}\n\n        create or replace {{ table_type }} table {{ relation }}\n        {%- set contract_config = config.get('contract') -%}\n        {%- if contract_config.enforced -%}\n          {{ get_assert_columns_equivalent(sql) }}\n          {{ get_table_columns_and_constraints() }}\n          {% set compiled_code = get_select_subquery(compiled_code) %}\n        {% endif %}\n        {% if copy_grants and not temporary -%} copy grants {%- endif %} as\n        (\n          {%- if cluster_by_string is not none -%}\n            select * from (\n              {{ compiled_code }}\n              ) order by ({{ cluster_by_string }})\n          {%- else -%}\n            {{ compiled_code }}\n          {%- endif %}\n        );\n      {% if cluster_by_string is not none and not temporary -%}\n        alter table {{relation}} cluster by ({{cluster_by_string}});\n      {%- endif -%}\n      {% if enable_automatic_clustering and cluster_by_string is not none and not temporary  -%}\n        alter table {{relation}} resume recluster;\n      {%- endif -%}\n\n  {%- elif language == 'python' -%}\n    {{ py_write_table(compiled_code=compiled_code, target_relation=relation, table_type=table_type) }}\n  {%- else -%}\n      {% do exceptions.raise_compiler_error(\"snowflake__create_table_as macro didn't get supported language, it got %s\" % language) %}\n  {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent", "macro.dbt.get_table_columns_and_constraints", "macro.dbt.get_select_subquery", "macro.dbt_snowflake.py_write_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.971835, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_drop_view_sql": {"name": "snowflake__get_drop_view_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_drop_view_sql", "macro_sql": "{% macro snowflake__get_drop_view_sql(relation) %}\n    drop view if exists {{ relation }} cascade\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.971993, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_replace_view_sql": {"name": "snowflake__get_replace_view_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_replace_view_sql", "macro_sql": "{% macro snowflake__get_replace_view_sql(relation, sql) %}\n    {{ snowflake__create_view_as(relation, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.972179, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_rename_view_sql": {"name": "snowflake__get_rename_view_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_rename_view_sql", "macro_sql": "{%- macro snowflake__get_rename_view_sql(relation, new_name) -%}\n    alter view {{ relation }} rename to {{ new_name }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.972351, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_view_as_with_temp_flag": {"name": "snowflake__create_view_as_with_temp_flag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_view_as_with_temp_flag", "macro_sql": "{% macro snowflake__create_view_as_with_temp_flag(relation, sql, is_temporary=False) -%}\n  {%- set secure = config.get('secure', default=false) -%}\n  {%- set copy_grants = config.get('copy_grants', default=false) -%}\n  {%- set sql_header = config.get('sql_header', none) -%}\n\n  {{ sql_header if sql_header is not none }}\n  create or replace {% if secure -%}\n    secure\n  {%- endif %} {% if is_temporary -%}\n    temporary\n  {%- endif %} view {{ relation }}\n  {% if config.persist_column_docs() -%}\n    {% set model_columns = model.columns %}\n    {% set query_columns = get_columns_in_query(sql) %}\n    {{ get_persist_docs_column_list(model_columns, query_columns) }}\n\n  {%- endif %}\n  {%- set contract_config = config.get('contract') -%}\n  {%- if contract_config.enforced -%}\n    {{ get_assert_columns_equivalent(sql) }}\n  {%- endif %}\n  {% if copy_grants -%} copy grants {%- endif %} as (\n    {{ sql }}\n  );\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_columns_in_query", "macro.dbt_snowflake.get_persist_docs_column_list", "macro.dbt.get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.974127, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_view_as": {"name": "snowflake__create_view_as", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_view_as", "macro_sql": "{% macro snowflake__create_view_as(relation, sql) -%}\n  {{ snowflake__create_view_as_with_temp_flag(relation, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_view_as_with_temp_flag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.974282, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_or_replace_view": {"name": "snowflake__create_or_replace_view", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_or_replace_view", "macro_sql": "{% macro snowflake__create_or_replace_view() %}\n  {%- set identifier = model['alias'] -%}\n\n  {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n  {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n  {%- set target_relation = api.Relation.create(\n      identifier=identifier, schema=schema, database=database,\n      type='view') -%}\n  {% set grant_config = config.get('grants') %}\n\n  {{ run_hooks(pre_hooks) }}\n\n  -- If there's a table with the same name and we weren't told to full refresh,\n  -- that's an error. If we were told to full refresh, drop it. This behavior differs\n  -- for Snowflake and BigQuery, so multiple dispatch is used.\n  {%- if old_relation is not none and not old_relation.is_view -%}\n    {{ handle_existing_table(should_full_refresh(), old_relation) }}\n  {%- endif -%}\n\n  -- build model\n  {% call statement('main') -%}\n    {{ get_create_view_as_sql(target_relation, sql) }}\n  {%- endcall %}\n\n  {% set should_revoke = should_revoke(exists_as_view, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {{ run_hooks(post_hooks) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9754329, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_drop_dynamic_table_sql": {"name": "snowflake__get_drop_dynamic_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/drop.sql", "original_file_path": "macros/relations/dynamic_table/drop.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_drop_dynamic_table_sql", "macro_sql": "{% macro snowflake__get_drop_dynamic_table_sql(relation) %}\n    drop dynamic table if exists {{ relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.975583, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_replace_dynamic_table_sql": {"name": "snowflake__get_replace_dynamic_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/replace.sql", "original_file_path": "macros/relations/dynamic_table/replace.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_replace_dynamic_table_sql", "macro_sql": "{% macro snowflake__get_replace_dynamic_table_sql(relation, sql) %}\n\n    create or replace dynamic table {{ relation }}\n        target_lag = '{{ config.get(\"target_lag\") }}'\n        warehouse = {{ config.get(\"snowflake_warehouse\") }}\n        as (\n            {{ sql }}\n        )\n    ;\n    {{ snowflake__refresh_dynamic_table(relation) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__refresh_dynamic_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.975978, "supported_languages": null}, "macro.dbt_snowflake.snowflake__describe_dynamic_table": {"name": "snowflake__describe_dynamic_table", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/describe.sql", "original_file_path": "macros/relations/dynamic_table/describe.sql", "unique_id": "macro.dbt_snowflake.snowflake__describe_dynamic_table", "macro_sql": "{% macro snowflake__describe_dynamic_table(relation) %}\n    {%- set _dynamic_table_sql -%}\n        show dynamic tables\n            like '{{ relation.identifier }}'\n            in schema {{ relation.database }}.{{ relation.schema }}\n        ;\n        select\n            \"name\",\n            \"schema_name\",\n            \"database_name\",\n            \"text\",\n            \"target_lag\",\n            \"warehouse\"\n        from table(result_scan(last_query_id()))\n    {%- endset %}\n    {% set _dynamic_table = run_query(_dynamic_table_sql) %}\n\n    {% do return({'dynamic_table': _dynamic_table}) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.976545, "supported_languages": null}, "macro.dbt_snowflake.snowflake__refresh_dynamic_table": {"name": "snowflake__refresh_dynamic_table", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/refresh.sql", "original_file_path": "macros/relations/dynamic_table/refresh.sql", "unique_id": "macro.dbt_snowflake.snowflake__refresh_dynamic_table", "macro_sql": "{% macro snowflake__refresh_dynamic_table(relation) -%}\n    {{- log('Applying REFRESH to: ' ~ relation) -}}\n\n    alter dynamic table {{ relation }} refresh\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9767601, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_alter_dynamic_table_as_sql": {"name": "snowflake__get_alter_dynamic_table_as_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/alter.sql", "original_file_path": "macros/relations/dynamic_table/alter.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_alter_dynamic_table_as_sql", "macro_sql": "{% macro snowflake__get_alter_dynamic_table_as_sql(\n    existing_relation,\n    configuration_changes,\n    target_relation,\n    sql\n) -%}\n    {{- log('Applying ALTER to: ' ~ existing_relation) -}}\n\n    {% if configuration_changes.requires_full_refresh %}\n        {{- get_replace_sql(existing_relation, target_relation, sql) -}}\n\n    {% else %}\n\n        {%- set target_lag = configuration_changes.target_lag -%}\n        {%- if target_lag -%}{{- log('Applying UPDATE TARGET_LAG to: ' ~ existing_relation) -}}{%- endif -%}\n        {%- set snowflake_warehouse = configuration_changes.snowflake_warehouse -%}\n        {%- if snowflake_warehouse -%}{{- log('Applying UPDATE WAREHOUSE to: ' ~ existing_relation) -}}{%- endif -%}\n\n        alter dynamic table {{ existing_relation }} set\n            {% if target_lag %}target_lag = '{{ target_lag.context }}'{% endif %}\n            {% if snowflake_warehouse %}warehouse = {{ snowflake_warehouse.context }}{% endif %}\n\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_replace_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.977841, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_create_dynamic_table_as_sql": {"name": "snowflake__get_create_dynamic_table_as_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/create.sql", "original_file_path": "macros/relations/dynamic_table/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_create_dynamic_table_as_sql", "macro_sql": "{% macro snowflake__get_create_dynamic_table_as_sql(relation, sql) -%}\n\n    create dynamic table {{ relation }}\n        target_lag = '{{ config.get(\"target_lag\") }}'\n        warehouse = {{ config.get(\"snowflake_warehouse\") }}\n        as (\n            {{ sql }}\n        )\n    ;\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9781818, "supported_languages": null}, "macro.dbt_snowflake.snowflake__current_timestamp": {"name": "snowflake__current_timestamp", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__current_timestamp", "macro_sql": "{% macro snowflake__current_timestamp() -%}\n  convert_timezone('UTC', current_timestamp())\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9784682, "supported_languages": null}, "macro.dbt_snowflake.snowflake__snapshot_string_as_time": {"name": "snowflake__snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__snapshot_string_as_time", "macro_sql": "{% macro snowflake__snapshot_string_as_time(timestamp) -%}\n  {%- set result = \"to_timestamp_ntz('\" ~ timestamp ~ \"')\" -%}\n  {{ return(result) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9786491, "supported_languages": null}, "macro.dbt_snowflake.snowflake__snapshot_get_time": {"name": "snowflake__snapshot_get_time", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__snapshot_get_time", "macro_sql": "{% macro snowflake__snapshot_get_time() -%}\n  to_timestamp_ntz({{ current_timestamp() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.97876, "supported_languages": null}, "macro.dbt_snowflake.snowflake__current_timestamp_backcompat": {"name": "snowflake__current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__current_timestamp_backcompat", "macro_sql": "{% macro snowflake__current_timestamp_backcompat() %}\n  current_timestamp::{{ type_timestamp() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.978868, "supported_languages": null}, "macro.dbt_snowflake.snowflake__current_timestamp_in_utc_backcompat": {"name": "snowflake__current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__current_timestamp_in_utc_backcompat", "macro_sql": "{% macro snowflake__current_timestamp_in_utc_backcompat() %}\n  convert_timezone('UTC', {{ snowflake__current_timestamp_backcompat() }})::{{ type_timestamp() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__current_timestamp_backcompat", "macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.979011, "supported_languages": null}, "macro.dbt_snowflake.snowflake__escape_single_quotes": {"name": "snowflake__escape_single_quotes", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt_snowflake.snowflake__escape_single_quotes", "macro_sql": "{% macro snowflake__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\", \"\\\\'\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.979202, "supported_languages": null}, "macro.dbt_snowflake.snowflake__right": {"name": "snowflake__right", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt_snowflake.snowflake__right", "macro_sql": "{% macro snowflake__right(string_text, length_expression) %}\n\n    case when {{ length_expression }} = 0\n        then ''\n    else\n        right(\n            {{ string_text }},\n            {{ length_expression }}\n        )\n    end\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.979448, "supported_languages": null}, "macro.dbt_snowflake.snowflake__safe_cast": {"name": "snowflake__safe_cast", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt_snowflake.snowflake__safe_cast", "macro_sql": "{% macro snowflake__safe_cast(field, type) %}\n    try_cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9796212, "supported_languages": null}, "macro.dbt_snowflake.snowflake__bool_or": {"name": "snowflake__bool_or", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt_snowflake.snowflake__bool_or", "macro_sql": "{% macro snowflake__bool_or(expression) -%}\n\n    boolor_agg({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9798179, "supported_languages": null}, "macro.dbt_snowflake.snowflake__array_construct": {"name": "snowflake__array_construct", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt_snowflake.snowflake__array_construct", "macro_sql": "{% macro snowflake__array_construct(inputs, data_type) -%}\n    array_construct( {{ inputs|join(' , ') }} )\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.98, "supported_languages": null}, "macro.dbt.run_hooks": {"name": "run_hooks", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.run_hooks", "macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n  {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction)  %}\n    {% if not inside_transaction and loop.first %}\n      {% call statement(auto_begin=inside_transaction) %}\n        commit;\n      {% endcall %}\n    {% endif %}\n    {% set rendered = render(hook.get('sql')) | trim %}\n    {% if (rendered | length) > 0 %}\n      {% call statement(auto_begin=inside_transaction) %}\n        {{ rendered }}\n      {% endcall %}\n    {% endif %}\n  {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.981099, "supported_languages": null}, "macro.dbt.make_hook_config": {"name": "make_hook_config", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.make_hook_config", "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n    {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9813042, "supported_languages": null}, "macro.dbt.before_begin": {"name": "before_begin", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.before_begin", "macro_sql": "{% macro before_begin(sql) %}\n    {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9814541, "supported_languages": null}, "macro.dbt.in_transaction": {"name": "in_transaction", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.in_transaction", "macro_sql": "{% macro in_transaction(sql) %}\n    {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.981596, "supported_languages": null}, "macro.dbt.after_commit": {"name": "after_commit", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.after_commit", "macro_sql": "{% macro after_commit(sql) %}\n    {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.98174, "supported_languages": null}, "macro.dbt.set_sql_header": {"name": "set_sql_header", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.set_sql_header", "macro_sql": "{% macro set_sql_header(config) -%}\n  {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.982111, "supported_languages": null}, "macro.dbt.should_full_refresh": {"name": "should_full_refresh", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.should_full_refresh", "macro_sql": "{% macro should_full_refresh() %}\n  {% set config_full_refresh = config.get('full_refresh') %}\n  {% if config_full_refresh is none %}\n    {% set config_full_refresh = flags.FULL_REFRESH %}\n  {% endif %}\n  {% do return(config_full_refresh) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.982419, "supported_languages": null}, "macro.dbt.should_store_failures": {"name": "should_store_failures", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.should_store_failures", "macro_sql": "{% macro should_store_failures() %}\n  {% set config_store_failures = config.get('store_failures') %}\n  {% if config_store_failures is none %}\n    {% set config_store_failures = flags.STORE_FAILURES %}\n  {% endif %}\n  {% do return(config_store_failures) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9827268, "supported_languages": null}, "macro.dbt.snapshot_merge_sql": {"name": "snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "unique_id": "macro.dbt.snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n  {{ adapter.dispatch('snapshot_merge_sql', 'dbt')(target, source, insert_cols) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__snapshot_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.983171, "supported_languages": null}, "macro.dbt.default__snapshot_merge_sql": {"name": "default__snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "unique_id": "macro.dbt.default__snapshot_merge_sql", "macro_sql": "{% macro default__snapshot_merge_sql(target, source, insert_cols) -%}\n    {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n    merge into {{ target }} as DBT_INTERNAL_DEST\n    using {{ source }} as DBT_INTERNAL_SOURCE\n    on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id\n\n    when matched\n     and DBT_INTERNAL_DEST.dbt_valid_to is null\n     and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n        then update\n        set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n\n    when not matched\n     and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'\n        then insert ({{ insert_cols_csv }})\n        values ({{ insert_cols_csv }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9834502, "supported_languages": null}, "macro.dbt.strategy_dispatch": {"name": "strategy_dispatch", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.strategy_dispatch", "macro_sql": "{% macro strategy_dispatch(name) -%}\n{% set original_name = name %}\n  {% if '.' in name %}\n    {% set package_name, name = name.split(\".\", 1) %}\n  {% else %}\n    {% set package_name = none %}\n  {% endif %}\n\n  {% if package_name is none %}\n    {% set package_context = context %}\n  {% elif package_name in context %}\n    {% set package_context = context[package_name] %}\n  {% else %}\n    {% set error_msg %}\n        Could not find package '{{package_name}}', called with '{{original_name}}'\n    {% endset %}\n    {{ exceptions.raise_compiler_error(error_msg | trim) }}\n  {% endif %}\n\n  {%- set search_name = 'snapshot_' ~ name ~ '_strategy' -%}\n\n  {% if search_name not in package_context %}\n    {% set error_msg %}\n        The specified strategy macro '{{name}}' was not found in package '{{ package_name }}'\n    {% endset %}\n    {{ exceptions.raise_compiler_error(error_msg | trim) }}\n  {% endif %}\n  {{ return(package_context[search_name]) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9870012, "supported_languages": null}, "macro.dbt.snapshot_hash_arguments": {"name": "snapshot_hash_arguments", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n  {{ adapter.dispatch('snapshot_hash_arguments', 'dbt')(args) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.987173, "supported_languages": null}, "macro.dbt.default__snapshot_hash_arguments": {"name": "default__snapshot_hash_arguments", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.default__snapshot_hash_arguments", "macro_sql": "{% macro default__snapshot_hash_arguments(args) -%}\n    md5({%- for arg in args -%}\n        coalesce(cast({{ arg }} as varchar ), '')\n        {% if not loop.last %} || '|' || {% endif %}\n    {%- endfor -%})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.987395, "supported_languages": null}, "macro.dbt.snapshot_timestamp_strategy": {"name": "snapshot_timestamp_strategy", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_timestamp_strategy", "macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n    {% set primary_key = config['unique_key'] %}\n    {% set updated_at = config['updated_at'] %}\n    {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n\n    {#/*\n        The snapshot relation might not have an {{ updated_at }} value if the\n        snapshot strategy is changed from `check` to `timestamp`. We\n        should use a dbt-created column for the comparison in the snapshot\n        table instead of assuming that the user-supplied {{ updated_at }}\n        will be present in the historical data.\n\n        See https://github.com/dbt-labs/dbt-core/issues/2350\n    */ #}\n    {% set row_changed_expr -%}\n        ({{ snapshotted_rel }}.dbt_valid_from < {{ current_rel }}.{{ updated_at }})\n    {%- endset %}\n\n    {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n    {% do return({\n        \"unique_key\": primary_key,\n        \"updated_at\": updated_at,\n        \"row_changed\": row_changed_expr,\n        \"scd_id\": scd_id_expr,\n        \"invalidate_hard_deletes\": invalidate_hard_deletes\n    }) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.988191, "supported_languages": null}, "macro.dbt.snapshot_string_as_time": {"name": "snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n    {{ adapter.dispatch('snapshot_string_as_time', 'dbt')(timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__snapshot_string_as_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.988362, "supported_languages": null}, "macro.dbt.default__snapshot_string_as_time": {"name": "default__snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.default__snapshot_string_as_time", "macro_sql": "{% macro default__snapshot_string_as_time(timestamp) %}\n    {% do exceptions.raise_not_implemented(\n        'snapshot_string_as_time macro not implemented for adapter '+adapter.type()\n    ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.988538, "supported_languages": null}, "macro.dbt.snapshot_check_all_get_existing_columns": {"name": "snapshot_check_all_get_existing_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists, check_cols_config) -%}\n    {%- if not target_exists -%}\n        {#-- no table yet -> return whatever the query does --#}\n        {{ return((false, query_columns)) }}\n    {%- endif -%}\n\n    {#-- handle any schema changes --#}\n    {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=node.alias) -%}\n\n    {% if check_cols_config == 'all' %}\n        {%- set query_columns = get_columns_in_query(node['compiled_code']) -%}\n\n    {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n        {#-- query for proper casing/quoting, to support comparison below --#}\n        {%- set select_check_cols_from_target -%}\n            {#-- N.B. The whitespace below is necessary to avoid edge case issue with comments --#}\n            {#-- See: https://github.com/dbt-labs/dbt-core/issues/6781 --#}\n            select {{ check_cols_config | join(', ') }} from (\n                {{ node['compiled_code'] }}\n            ) subq\n        {%- endset -%}\n        {% set query_columns = get_columns_in_query(select_check_cols_from_target) %}\n\n    {% else %}\n        {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n    {% endif %}\n\n    {%- set existing_cols = adapter.get_columns_in_relation(target_relation) | map(attribute = 'name') | list -%}\n    {%- set ns = namespace() -%} {#-- handle for-loop scoping with a namespace --#}\n    {%- set ns.column_added = false -%}\n\n    {%- set intersection = [] -%}\n    {%- for col in query_columns -%}\n        {%- if col in existing_cols -%}\n            {%- do intersection.append(adapter.quote(col)) -%}\n        {%- else -%}\n            {% set ns.column_added = true %}\n        {%- endif -%}\n    {%- endfor -%}\n    {{ return((ns.column_added, intersection)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.98998, "supported_languages": null}, "macro.dbt.snapshot_check_strategy": {"name": "snapshot_check_strategy", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_check_strategy", "macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n    {% set check_cols_config = config['check_cols'] %}\n    {% set primary_key = config['unique_key'] %}\n    {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n    {% set updated_at = config.get('updated_at', snapshot_get_time()) %}\n\n    {% set column_added = false %}\n\n    {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists, check_cols_config) %}\n\n    {%- set row_changed_expr -%}\n    (\n    {%- if column_added -%}\n        {{ get_true_sql() }}\n    {%- else -%}\n    {%- for col in check_cols -%}\n        {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }}\n        or\n        (\n            (({{ snapshotted_rel }}.{{ col }} is null) and not ({{ current_rel }}.{{ col }} is null))\n            or\n            ((not {{ snapshotted_rel }}.{{ col }} is null) and ({{ current_rel }}.{{ col }} is null))\n        )\n        {%- if not loop.last %} or {% endif -%}\n    {%- endfor -%}\n    {%- endif -%}\n    )\n    {%- endset %}\n\n    {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n    {% do return({\n        \"unique_key\": primary_key,\n        \"updated_at\": updated_at,\n        \"row_changed\": row_changed_expr,\n        \"scd_id\": scd_id_expr,\n        \"invalidate_hard_deletes\": invalidate_hard_deletes\n    }) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.snapshot_get_time", "macro.dbt.snapshot_check_all_get_existing_columns", "macro.dbt.get_true_sql", "macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.991317, "supported_languages": null}, "macro.dbt.create_columns": {"name": "create_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n  {{ adapter.dispatch('create_columns', 'dbt')(relation, columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.995445, "supported_languages": null}, "macro.dbt.default__create_columns": {"name": "default__create_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__create_columns", "macro_sql": "{% macro default__create_columns(relation, columns) %}\n  {% for column in columns %}\n    {% call statement() %}\n      alter table {{ relation }} add column \"{{ column.name }}\" {{ column.data_type }};\n    {% endcall %}\n  {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.995737, "supported_languages": null}, "macro.dbt.post_snapshot": {"name": "post_snapshot", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n  {{ adapter.dispatch('post_snapshot', 'dbt')(staging_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9959092, "supported_languages": null}, "macro.dbt.default__post_snapshot": {"name": "default__post_snapshot", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__post_snapshot", "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n    {# no-op #}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.995997, "supported_languages": null}, "macro.dbt.get_true_sql": {"name": "get_true_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.get_true_sql", "macro_sql": "{% macro get_true_sql() %}\n  {{ adapter.dispatch('get_true_sql', 'dbt')() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_true_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.996145, "supported_languages": null}, "macro.dbt.default__get_true_sql": {"name": "default__get_true_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__get_true_sql", "macro_sql": "{% macro default__get_true_sql() %}\n    {{ return('TRUE') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9962611, "supported_languages": null}, "macro.dbt.snapshot_staging_table": {"name": "snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.snapshot_staging_table", "macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n  {{ adapter.dispatch('snapshot_staging_table', 'dbt')(strategy, source_sql, target_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__snapshot_staging_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.996473, "supported_languages": null}, "macro.dbt.default__snapshot_staging_table": {"name": "default__snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__snapshot_staging_table", "macro_sql": "{% macro default__snapshot_staging_table(strategy, source_sql, target_relation) -%}\n\n    with snapshot_query as (\n\n        {{ source_sql }}\n\n    ),\n\n    snapshotted_data as (\n\n        select *,\n            {{ strategy.unique_key }} as dbt_unique_key\n\n        from {{ target_relation }}\n        where dbt_valid_to is null\n\n    ),\n\n    insertions_source_data as (\n\n        select\n            *,\n            {{ strategy.unique_key }} as dbt_unique_key,\n            {{ strategy.updated_at }} as dbt_updated_at,\n            {{ strategy.updated_at }} as dbt_valid_from,\n            nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,\n            {{ strategy.scd_id }} as dbt_scd_id\n\n        from snapshot_query\n    ),\n\n    updates_source_data as (\n\n        select\n            *,\n            {{ strategy.unique_key }} as dbt_unique_key,\n            {{ strategy.updated_at }} as dbt_updated_at,\n            {{ strategy.updated_at }} as dbt_valid_from,\n            {{ strategy.updated_at }} as dbt_valid_to\n\n        from snapshot_query\n    ),\n\n    {%- if strategy.invalidate_hard_deletes %}\n\n    deletes_source_data as (\n\n        select\n            *,\n            {{ strategy.unique_key }} as dbt_unique_key\n        from snapshot_query\n    ),\n    {% endif %}\n\n    insertions as (\n\n        select\n            'insert' as dbt_change_type,\n            source_data.*\n\n        from insertions_source_data as source_data\n        left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n        where snapshotted_data.dbt_unique_key is null\n           or (\n                snapshotted_data.dbt_unique_key is not null\n            and (\n                {{ strategy.row_changed }}\n            )\n        )\n\n    ),\n\n    updates as (\n\n        select\n            'update' as dbt_change_type,\n            source_data.*,\n            snapshotted_data.dbt_scd_id\n\n        from updates_source_data as source_data\n        join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n        where (\n            {{ strategy.row_changed }}\n        )\n    )\n\n    {%- if strategy.invalidate_hard_deletes -%}\n    ,\n\n    deletes as (\n\n        select\n            'delete' as dbt_change_type,\n            source_data.*,\n            {{ snapshot_get_time() }} as dbt_valid_from,\n            {{ snapshot_get_time() }} as dbt_updated_at,\n            {{ snapshot_get_time() }} as dbt_valid_to,\n            snapshotted_data.dbt_scd_id\n\n        from snapshotted_data\n        left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n        where source_data.dbt_unique_key is null\n    )\n    {%- endif %}\n\n    select * from insertions\n    union all\n    select * from updates\n    {%- if strategy.invalidate_hard_deletes %}\n    union all\n    select * from deletes\n    {%- endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.997372, "supported_languages": null}, "macro.dbt.build_snapshot_table": {"name": "build_snapshot_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.build_snapshot_table", "macro_sql": "{% macro build_snapshot_table(strategy, sql) -%}\n  {{ adapter.dispatch('build_snapshot_table', 'dbt')(strategy, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__build_snapshot_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9975638, "supported_languages": null}, "macro.dbt.default__build_snapshot_table": {"name": "default__build_snapshot_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__build_snapshot_table", "macro_sql": "{% macro default__build_snapshot_table(strategy, sql) %}\n\n    select *,\n        {{ strategy.scd_id }} as dbt_scd_id,\n        {{ strategy.updated_at }} as dbt_updated_at,\n        {{ strategy.updated_at }} as dbt_valid_from,\n        nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to\n    from (\n        {{ sql }}\n    ) sbq\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.997825, "supported_languages": null}, "macro.dbt.build_snapshot_staging_table": {"name": "build_snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n    {% set temp_relation = make_temp_relation(target_relation) %}\n\n    {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n    {% call statement('build_snapshot_staging_relation') %}\n        {{ create_table_as(True, temp_relation, select) }}\n    {% endcall %}\n\n    {% do return(temp_relation) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_temp_relation", "macro.dbt.snapshot_staging_table", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408014.9982579, "supported_languages": null}, "macro.dbt.materialization_snapshot_default": {"name": "materialization_snapshot_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot.sql", "original_file_path": "macros/materializations/snapshots/snapshot.sql", "unique_id": "macro.dbt.materialization_snapshot_default", "macro_sql": "{% materialization snapshot, default %}\n  {%- set config = model['config'] -%}\n\n  {%- set target_table = model.get('alias', model.get('name')) -%}\n\n  {%- set strategy_name = config.get('strategy') -%}\n  {%- set unique_key = config.get('unique_key') %}\n  -- grab current tables grants config for comparision later on\n  {%- set grant_config = config.get('grants') -%}\n\n  {% set target_relation_exists, target_relation = get_or_create_relation(\n          database=model.database,\n          schema=model.schema,\n          identifier=target_table,\n          type='table') -%}\n\n  {%- if not target_relation.is_table -%}\n    {% do exceptions.relation_wrong_type(target_relation, 'table') %}\n  {%- endif -%}\n\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  {% set strategy_macro = strategy_dispatch(strategy_name) %}\n  {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", config, target_relation_exists) %}\n\n  {% if not target_relation_exists %}\n\n      {% set build_sql = build_snapshot_table(strategy, model['compiled_code']) %}\n      {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n  {% else %}\n\n      {{ adapter.valid_snapshot_target(target_relation) }}\n\n      {% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}\n\n      -- this may no-op if the database does not require column expansion\n      {% do adapter.expand_target_column_types(from_relation=staging_table,\n                                               to_relation=target_relation) %}\n\n      {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n                                   | rejectattr('name', 'equalto', 'dbt_change_type')\n                                   | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n                                   | rejectattr('name', 'equalto', 'dbt_unique_key')\n                                   | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n                                   | list %}\n\n      {% do create_columns(target_relation, missing_columns) %}\n\n      {% set source_columns = adapter.get_columns_in_relation(staging_table)\n                                   | rejectattr('name', 'equalto', 'dbt_change_type')\n                                   | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n                                   | rejectattr('name', 'equalto', 'dbt_unique_key')\n                                   | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n                                   | list %}\n\n      {% set quoted_source_columns = [] %}\n      {% for column in source_columns %}\n        {% do quoted_source_columns.append(adapter.quote(column.name)) %}\n      {% endfor %}\n\n      {% set final_sql = snapshot_merge_sql(\n            target = target_relation,\n            source = staging_table,\n            insert_cols = quoted_source_columns\n         )\n      %}\n\n  {% endif %}\n\n  {% call statement('main') %}\n      {{ final_sql }}\n  {% endcall %}\n\n  {% set should_revoke = should_revoke(target_relation_exists, full_refresh_mode=False) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {% if not target_relation_exists %}\n    {% do create_indexes(target_relation) %}\n  {% endif %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  {{ adapter.commit() }}\n\n  {% if staging_table is defined %}\n      {% do post_snapshot(staging_table) %}\n  {% endif %}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.get_or_create_relation", "macro.dbt.run_hooks", "macro.dbt.strategy_dispatch", "macro.dbt.build_snapshot_table", "macro.dbt.create_table_as", "macro.dbt.build_snapshot_staging_table", "macro.dbt.create_columns", "macro.dbt.snapshot_merge_sql", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes", "macro.dbt.post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.004441, "supported_languages": ["sql"]}, "macro.dbt.materialization_test_default": {"name": "materialization_test_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/test.sql", "original_file_path": "macros/materializations/tests/test.sql", "unique_id": "macro.dbt.materialization_test_default", "macro_sql": "{%- materialization test, default -%}\n\n  {% set relations = [] %}\n\n  {% if should_store_failures() %}\n\n    {% set identifier = model['alias'] %}\n    {% set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n    {% set store_failures_as = config.get('store_failures_as') %}\n    -- if `--store-failures` is invoked via command line and `store_failures_as` is not set,\n    -- config.get('store_failures_as', 'table') returns None, not 'table'\n    {% if store_failures_as == none %}{% set store_failures_as = 'table' %}{% endif %}\n    {% if store_failures_as not in ['table', 'view'] %}\n        {{ exceptions.raise_compiler_error(\n            \"'\" ~ store_failures_as ~ \"' is not a valid value for `store_failures_as`. \"\n            \"Accepted values are: ['ephemeral', 'table', 'view']\"\n        ) }}\n    {% endif %}\n\n    {% set target_relation = api.Relation.create(\n        identifier=identifier, schema=schema, database=database, type=store_failures_as) -%} %}\n\n    {% if old_relation %}\n        {% do adapter.drop_relation(old_relation) %}\n    {% endif %}\n\n    {% call statement(auto_begin=True) %}\n        {{ get_create_sql(target_relation, sql) }}\n    {% endcall %}\n\n    {% do relations.append(target_relation) %}\n\n    {% set main_sql %}\n        select *\n        from {{ target_relation }}\n    {% endset %}\n\n    {{ adapter.commit() }}\n\n  {% else %}\n\n      {% set main_sql = sql %}\n\n  {% endif %}\n\n  {% set limit = config.get('limit') %}\n  {% set fail_calc = config.get('fail_calc') %}\n  {% set warn_if = config.get('warn_if') %}\n  {% set error_if = config.get('error_if') %}\n\n  {% call statement('main', fetch_result=True) -%}\n\n    {{ get_test_sql(main_sql, fail_calc, warn_if, error_if, limit)}}\n\n  {%- endcall %}\n\n  {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.should_store_failures", "macro.dbt.statement", "macro.dbt.get_create_sql", "macro.dbt.get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.007191, "supported_languages": ["sql"]}, "macro.dbt.get_test_sql": {"name": "get_test_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "unique_id": "macro.dbt.get_test_sql", "macro_sql": "{% macro get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n  {{ adapter.dispatch('get_test_sql', 'dbt')(main_sql, fail_calc, warn_if, error_if, limit) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.007652, "supported_languages": null}, "macro.dbt.default__get_test_sql": {"name": "default__get_test_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "unique_id": "macro.dbt.default__get_test_sql", "macro_sql": "{% macro default__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n    select\n      {{ fail_calc }} as failures,\n      {{ fail_calc }} {{ warn_if }} as should_warn,\n      {{ fail_calc }} {{ error_if }} as should_error\n    from (\n      {{ main_sql }}\n      {{ \"limit \" ~ limit if limit != none }}\n    ) dbt_internal_test\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.007967, "supported_languages": null}, "macro.dbt.get_where_subquery": {"name": "get_where_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "unique_id": "macro.dbt.get_where_subquery", "macro_sql": "{% macro get_where_subquery(relation) -%}\n    {% do return(adapter.dispatch('get_where_subquery', 'dbt')(relation)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_where_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.008341, "supported_languages": null}, "macro.dbt.default__get_where_subquery": {"name": "default__get_where_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "unique_id": "macro.dbt.default__get_where_subquery", "macro_sql": "{% macro default__get_where_subquery(relation) -%}\n    {% set where = config.get('where', '') %}\n    {% if where %}\n        {%- set filtered -%}\n            (select * from {{ relation }} where {{ where }}) dbt_subquery\n        {%- endset -%}\n        {% do return(filtered) %}\n    {%- else -%}\n        {% do return(relation) %}\n    {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0087218, "supported_languages": null}, "macro.dbt.materialization_materialized_view_default": {"name": "materialization_materialized_view_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialization_materialized_view_default", "macro_sql": "{% materialization materialized_view, default %}\n    {% set existing_relation = load_cached_relation(this) %}\n    {% set target_relation = this.incorporate(type=this.MaterializedView) %}\n    {% set intermediate_relation = make_intermediate_relation(target_relation) %}\n    {% set backup_relation_type = target_relation.MaterializedView if existing_relation is none else existing_relation.type %}\n    {% set backup_relation = make_backup_relation(target_relation, backup_relation_type) %}\n\n    {{ materialized_view_setup(backup_relation, intermediate_relation, pre_hooks) }}\n\n        {% set build_sql = materialized_view_get_build_sql(existing_relation, target_relation, backup_relation, intermediate_relation) %}\n\n        {% if build_sql == '' %}\n            {{ materialized_view_execute_no_op(target_relation) }}\n        {% else %}\n            {{ materialized_view_execute_build_sql(build_sql, existing_relation, target_relation, post_hooks) }}\n        {% endif %}\n\n    {{ materialized_view_teardown(backup_relation, intermediate_relation, post_hooks) }}\n\n    {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.materialized_view_setup", "macro.dbt.materialized_view_get_build_sql", "macro.dbt.materialized_view_execute_no_op", "macro.dbt.materialized_view_execute_build_sql", "macro.dbt.materialized_view_teardown"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0136478, "supported_languages": ["sql"]}, "macro.dbt.materialized_view_setup": {"name": "materialized_view_setup", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_setup", "macro_sql": "{% macro materialized_view_setup(backup_relation, intermediate_relation, pre_hooks) %}\n\n    -- backup_relation and intermediate_relation should not already exist in the database\n    -- it's possible these exist because of a previous run that exited unexpectedly\n    {% set preexisting_backup_relation = load_cached_relation(backup_relation) %}\n    {% set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) %}\n\n    -- drop the temp relations if they exist already in the database\n    {{ drop_relation_if_exists(preexisting_backup_relation) }}\n    {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n\n    {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.014064, "supported_languages": null}, "macro.dbt.materialized_view_teardown": {"name": "materialized_view_teardown", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_teardown", "macro_sql": "{% macro materialized_view_teardown(backup_relation, intermediate_relation, post_hooks) %}\n\n    -- drop the temp relations if they exist to leave the database clean for the next run\n    {{ drop_relation_if_exists(backup_relation) }}\n    {{ drop_relation_if_exists(intermediate_relation) }}\n\n    {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.014335, "supported_languages": null}, "macro.dbt.materialized_view_get_build_sql": {"name": "materialized_view_get_build_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_get_build_sql", "macro_sql": "{% macro materialized_view_get_build_sql(existing_relation, target_relation, backup_relation, intermediate_relation) %}\n\n    {% set full_refresh_mode = should_full_refresh() %}\n\n    -- determine the scenario we're in: create, full_refresh, alter, refresh data\n    {% if existing_relation is none %}\n        {% set build_sql = get_create_materialized_view_as_sql(target_relation, sql) %}\n    {% elif full_refresh_mode or not existing_relation.is_materialized_view %}\n        {% set build_sql = get_replace_sql(existing_relation, target_relation, sql) %}\n    {% else %}\n\n        -- get config options\n        {% set on_configuration_change = config.get('on_configuration_change') %}\n        {% set configuration_changes = get_materialized_view_configuration_changes(existing_relation, config) %}\n\n        {% if configuration_changes is none %}\n            {% set build_sql = refresh_materialized_view(target_relation) %}\n\n        {% elif on_configuration_change == 'apply' %}\n            {% set build_sql = get_alter_materialized_view_as_sql(target_relation, configuration_changes, sql, existing_relation, backup_relation, intermediate_relation) %}\n        {% elif on_configuration_change == 'continue' %}\n            {% set build_sql = '' %}\n            {{ exceptions.warn(\"Configuration changes were identified and `on_configuration_change` was set to `continue` for `\" ~ target_relation ~ \"`\") }}\n        {% elif on_configuration_change == 'fail' %}\n            {{ exceptions.raise_fail_fast_error(\"Configuration changes were identified and `on_configuration_change` was set to `fail` for `\" ~ target_relation ~ \"`\") }}\n\n        {% else %}\n            -- this only happens if the user provides a value other than `apply`, 'skip', 'fail'\n            {{ exceptions.raise_compiler_error(\"Unexpected configuration scenario\") }}\n\n        {% endif %}\n\n    {% endif %}\n\n    {% do return(build_sql) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.get_create_materialized_view_as_sql", "macro.dbt.get_replace_sql", "macro.dbt.get_materialized_view_configuration_changes", "macro.dbt.refresh_materialized_view", "macro.dbt.get_alter_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.015647, "supported_languages": null}, "macro.dbt.materialized_view_execute_no_op": {"name": "materialized_view_execute_no_op", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_execute_no_op", "macro_sql": "{% macro materialized_view_execute_no_op(target_relation) %}\n    {% do store_raw_result(\n        name=\"main\",\n        message=\"skip \" ~ target_relation,\n        code=\"skip\",\n        rows_affected=\"-1\"\n    ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.015886, "supported_languages": null}, "macro.dbt.materialized_view_execute_build_sql": {"name": "materialized_view_execute_build_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_execute_build_sql", "macro_sql": "{% macro materialized_view_execute_build_sql(build_sql, existing_relation, target_relation, post_hooks) %}\n\n    -- `BEGIN` happens here:\n    {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n    {% set grant_config = config.get('grants') %}\n\n    {% call statement(name=\"main\") %}\n        {{ build_sql }}\n    {% endcall %}\n\n    {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n    {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n    {% do persist_docs(target_relation, model) %}\n\n    {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n    {{ adapter.commit() }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.016553, "supported_languages": null}, "macro.dbt.materialization_view_default": {"name": "materialization_view_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/view.sql", "original_file_path": "macros/materializations/models/view.sql", "unique_id": "macro.dbt.materialization_view_default", "macro_sql": "{%- materialization view, default -%}\n\n  {%- set existing_relation = load_cached_relation(this) -%}\n  {%- set target_relation = this.incorporate(type='view') -%}\n  {%- set intermediate_relation =  make_intermediate_relation(target_relation) -%}\n\n  -- the intermediate_relation should not already exist in the database; get_relation\n  -- will return None in that case. Otherwise, we get a relation that we can drop\n  -- later, before we try to use this name for the current operation\n  {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n  /*\n     This relation (probably) doesn't exist yet. If it does exist, it's a leftover from\n     a previous run, and we're going to try to drop it immediately. At the end of this\n     materialization, we're going to rename the \"existing_relation\" to this identifier,\n     and then we're going to drop it. In order to make sure we run the correct one of:\n       - drop view ...\n       - drop table ...\n\n     We need to set the type of this relation to be the type of the existing_relation, if it exists,\n     or else \"view\" as a sane default if it does not. Note that if the existing_relation does not\n     exist, then there is nothing to move out of the way and subsequentally drop. In that case,\n     this relation will be effectively unused.\n  */\n  {%- set backup_relation_type = 'view' if existing_relation is none else existing_relation.type -%}\n  {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n  -- as above, the backup_relation should not already exist\n  {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n  -- grab current tables grants config for comparision later on\n  {% set grant_config = config.get('grants') %}\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  -- drop the temp relations if they exist already in the database\n  {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n  {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n  -- `BEGIN` happens here:\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  -- build model\n  {% call statement('main') -%}\n    {{ get_create_view_as_sql(intermediate_relation, sql) }}\n  {%- endcall %}\n\n  -- cleanup\n  -- move the existing view out of the way\n  {% if existing_relation is not none %}\n     /* Do the equivalent of rename_if_exists. 'existing_relation' could have been dropped\n        since the variable was first set. */\n    {% set existing_relation = load_cached_relation(existing_relation) %}\n    {% if existing_relation is not none %}\n        {{ adapter.rename_relation(existing_relation, backup_relation) }}\n    {% endif %}\n  {% endif %}\n  {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n  {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  {{ adapter.commit() }}\n\n  {{ drop_relation_if_exists(backup_relation) }}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.019542, "supported_languages": ["sql"]}, "macro.dbt.materialization_table_default": {"name": "materialization_table_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/table.sql", "original_file_path": "macros/materializations/models/table.sql", "unique_id": "macro.dbt.materialization_table_default", "macro_sql": "{% materialization table, default %}\n\n  {%- set existing_relation = load_cached_relation(this) -%}\n  {%- set target_relation = this.incorporate(type='table') %}\n  {%- set intermediate_relation =  make_intermediate_relation(target_relation) -%}\n  -- the intermediate_relation should not already exist in the database; get_relation\n  -- will return None in that case. Otherwise, we get a relation that we can drop\n  -- later, before we try to use this name for the current operation\n  {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n  /*\n      See ../view/view.sql for more information about this relation.\n  */\n  {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n  {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n  -- as above, the backup_relation should not already exist\n  {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n  -- grab current tables grants config for comparision later on\n  {% set grant_config = config.get('grants') %}\n\n  -- drop the temp relations if they exist already in the database\n  {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n  {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  -- `BEGIN` happens here:\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  -- build model\n  {% call statement('main') -%}\n    {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n  {%- endcall %}\n\n  -- cleanup\n  {% if existing_relation is not none %}\n     /* Do the equivalent of rename_if_exists. 'existing_relation' could have been dropped\n        since the variable was first set. */\n    {% set existing_relation = load_cached_relation(existing_relation) %}\n    {% if existing_relation is not none %}\n        {{ adapter.rename_relation(existing_relation, backup_relation) }}\n    {% endif %}\n  {% endif %}\n\n  {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n  {% do create_indexes(target_relation) %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  -- `COMMIT` happens here\n  {{ adapter.commit() }}\n\n  -- finally, drop the existing/backup relation after the commit\n  {{ drop_relation_if_exists(backup_relation) }}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt.create_indexes", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.022434, "supported_languages": ["sql"]}, "macro.dbt.get_quoted_csv": {"name": "get_quoted_csv", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.get_quoted_csv", "macro_sql": "{% macro get_quoted_csv(column_names) %}\n\n    {% set quoted = [] %}\n    {% for col in column_names -%}\n        {%- do quoted.append(adapter.quote(col)) -%}\n    {%- endfor %}\n\n    {%- set dest_cols_csv = quoted | join(', ') -%}\n    {{ return(dest_cols_csv) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0240629, "supported_languages": null}, "macro.dbt.diff_columns": {"name": "diff_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.diff_columns", "macro_sql": "{% macro diff_columns(source_columns, target_columns) %}\n\n  {% set result = [] %}\n  {% set source_names = source_columns | map(attribute = 'column') | list %}\n  {% set target_names = target_columns | map(attribute = 'column') | list %}\n\n   {# --check whether the name attribute exists in the target - this does not perform a data type check #}\n   {% for sc in source_columns %}\n     {% if sc.name not in target_names %}\n        {{ result.append(sc) }}\n     {% endif %}\n   {% endfor %}\n\n  {{ return(result) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.024627, "supported_languages": null}, "macro.dbt.diff_column_data_types": {"name": "diff_column_data_types", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.diff_column_data_types", "macro_sql": "{% macro diff_column_data_types(source_columns, target_columns) %}\n\n  {% set result = [] %}\n  {% for sc in source_columns %}\n    {% set tc = target_columns | selectattr(\"name\", \"equalto\", sc.name) | list | first %}\n    {% if tc %}\n      {% if sc.data_type != tc.data_type and not sc.can_expand_to(other_column=tc) %}\n        {{ result.append( { 'column_name': tc.name, 'new_type': sc.data_type } ) }}\n      {% endif %}\n    {% endif %}\n  {% endfor %}\n\n  {{ return(result) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0253062, "supported_languages": null}, "macro.dbt.get_merge_update_columns": {"name": "get_merge_update_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.get_merge_update_columns", "macro_sql": "{% macro get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) %}\n  {{ return(adapter.dispatch('get_merge_update_columns', 'dbt')(merge_update_columns, merge_exclude_columns, dest_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_merge_update_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0255492, "supported_languages": null}, "macro.dbt.default__get_merge_update_columns": {"name": "default__get_merge_update_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.default__get_merge_update_columns", "macro_sql": "{% macro default__get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) %}\n  {%- set default_cols = dest_columns | map(attribute=\"quoted\") | list -%}\n\n  {%- if merge_update_columns and merge_exclude_columns -%}\n    {{ exceptions.raise_compiler_error(\n        'Model cannot specify merge_update_columns and merge_exclude_columns. Please update model to use only one config'\n    )}}\n  {%- elif merge_update_columns -%}\n    {%- set update_columns = merge_update_columns -%}\n  {%- elif merge_exclude_columns -%}\n    {%- set update_columns = [] -%}\n    {%- for column in dest_columns -%}\n      {% if column.column | lower not in merge_exclude_columns | map(\"lower\") | list %}\n        {%- do update_columns.append(column.quoted) -%}\n      {% endif %}\n    {%- endfor -%}\n  {%- else -%}\n    {%- set update_columns = default_cols -%}\n  {%- endif -%}\n\n  {{ return(update_columns) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.026272, "supported_languages": null}, "macro.dbt.get_merge_sql": {"name": "get_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_merge_sql", "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, incremental_predicates=none) -%}\n   -- back compat for old kwarg name\n  {% set incremental_predicates = kwargs.get('predicates', incremental_predicates) %}\n  {{ adapter.dispatch('get_merge_sql', 'dbt')(target, source, unique_key, dest_columns, incremental_predicates) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.032711, "supported_languages": null}, "macro.dbt.default__get_merge_sql": {"name": "default__get_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_merge_sql", "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, incremental_predicates=none) -%}\n    {%- set predicates = [] if incremental_predicates is none else [] + incremental_predicates -%}\n    {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n    {%- set merge_update_columns = config.get('merge_update_columns') -%}\n    {%- set merge_exclude_columns = config.get('merge_exclude_columns') -%}\n    {%- set update_columns = get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) -%}\n    {%- set sql_header = config.get('sql_header', none) -%}\n\n    {% if unique_key %}\n        {% if unique_key is sequence and unique_key is not mapping and unique_key is not string %}\n            {% for key in unique_key %}\n                {% set this_key_match %}\n                    DBT_INTERNAL_SOURCE.{{ key }} = DBT_INTERNAL_DEST.{{ key }}\n                {% endset %}\n                {% do predicates.append(this_key_match) %}\n            {% endfor %}\n        {% else %}\n            {% set unique_key_match %}\n                DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }}\n            {% endset %}\n            {% do predicates.append(unique_key_match) %}\n        {% endif %}\n    {% else %}\n        {% do predicates.append('FALSE') %}\n    {% endif %}\n\n    {{ sql_header if sql_header is not none }}\n\n    merge into {{ target }} as DBT_INTERNAL_DEST\n        using {{ source }} as DBT_INTERNAL_SOURCE\n        on {{\"(\" ~ predicates | join(\") and (\") ~ \")\"}}\n\n    {% if unique_key %}\n    when matched then update set\n        {% for column_name in update_columns -%}\n            {{ column_name }} = DBT_INTERNAL_SOURCE.{{ column_name }}\n            {%- if not loop.last %}, {%- endif %}\n        {%- endfor %}\n    {% endif %}\n\n    when not matched then insert\n        ({{ dest_cols_csv }})\n    values\n        ({{ dest_cols_csv }})\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv", "macro.dbt.get_merge_update_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0343401, "supported_languages": null}, "macro.dbt.get_delete_insert_merge_sql": {"name": "get_delete_insert_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_delete_insert_merge_sql", "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) -%}\n  {{ adapter.dispatch('get_delete_insert_merge_sql', 'dbt')(target, source, unique_key, dest_columns, incremental_predicates) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0346081, "supported_languages": null}, "macro.dbt.default__get_delete_insert_merge_sql": {"name": "default__get_delete_insert_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_delete_insert_merge_sql", "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) -%}\n\n    {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n    {% if unique_key %}\n        {% if unique_key is sequence and unique_key is not string %}\n            delete from {{target }}\n            using {{ source }}\n            where (\n                {% for key in unique_key %}\n                    {{ source }}.{{ key }} = {{ target }}.{{ key }}\n                    {{ \"and \" if not loop.last}}\n                {% endfor %}\n                {% if incremental_predicates %}\n                    {% for predicate in incremental_predicates %}\n                        and {{ predicate }}\n                    {% endfor %}\n                {% endif %}\n            );\n        {% else %}\n            delete from {{ target }}\n            where (\n                {{ unique_key }}) in (\n                select ({{ unique_key }})\n                from {{ source }}\n            )\n            {%- if incremental_predicates %}\n                {% for predicate in incremental_predicates %}\n                    and {{ predicate }}\n                {% endfor %}\n            {%- endif -%};\n\n        {% endif %}\n    {% endif %}\n\n    insert into {{ target }} ({{ dest_cols_csv }})\n    (\n        select {{ dest_cols_csv }}\n        from {{ source }}\n    )\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0356412, "supported_languages": null}, "macro.dbt.get_insert_overwrite_merge_sql": {"name": "get_insert_overwrite_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_insert_overwrite_merge_sql", "macro_sql": "{% macro get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header=false) -%}\n  {{ adapter.dispatch('get_insert_overwrite_merge_sql', 'dbt')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.035916, "supported_languages": null}, "macro.dbt.default__get_insert_overwrite_merge_sql": {"name": "default__get_insert_overwrite_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n    {#-- The only time include_sql_header is True: --#}\n    {#-- BigQuery + insert_overwrite strategy + \"static\" partitions config --#}\n    {#-- We should consider including the sql header at the materialization level instead --#}\n\n    {%- set predicates = [] if predicates is none else [] + predicates -%}\n    {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n    {%- set sql_header = config.get('sql_header', none) -%}\n\n    {{ sql_header if sql_header is not none and include_sql_header }}\n\n    merge into {{ target }} as DBT_INTERNAL_DEST\n        using {{ source }} as DBT_INTERNAL_SOURCE\n        on FALSE\n\n    when not matched by source\n        {% if predicates %} and {{ predicates | join(' and ') }} {% endif %}\n        then delete\n\n    when not matched then insert\n        ({{ dest_cols_csv }})\n    values\n        ({{ dest_cols_csv }})\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0365791, "supported_languages": null}, "macro.dbt.is_incremental": {"name": "is_incremental", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/is_incremental.sql", "original_file_path": "macros/materializations/models/incremental/is_incremental.sql", "unique_id": "macro.dbt.is_incremental", "macro_sql": "{% macro is_incremental() %}\n    {#-- do not run introspective queries in parsing #}\n    {% if not execute %}\n        {{ return(False) }}\n    {% else %}\n        {% set relation = adapter.get_relation(this.database, this.schema, this.table) %}\n        {{ return(relation is not none\n                  and relation.type == 'table'\n                  and model.config.materialized == 'incremental'\n                  and not should_full_refresh()) }}\n    {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.037218, "supported_languages": null}, "macro.dbt.get_incremental_append_sql": {"name": "get_incremental_append_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_append_sql", "macro_sql": "{% macro get_incremental_append_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_append_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_incremental_append_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.038104, "supported_languages": null}, "macro.dbt.default__get_incremental_append_sql": {"name": "default__get_incremental_append_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_append_sql", "macro_sql": "{% macro default__get_incremental_append_sql(arg_dict) %}\n\n  {% do return(get_insert_into_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"dest_columns\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_insert_into_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.038353, "supported_languages": null}, "macro.dbt.get_incremental_delete_insert_sql": {"name": "get_incremental_delete_insert_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_delete_insert_sql", "macro_sql": "{% macro get_incremental_delete_insert_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_delete_insert_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_delete_insert_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.038545, "supported_languages": null}, "macro.dbt.default__get_incremental_delete_insert_sql": {"name": "default__get_incremental_delete_insert_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_delete_insert_sql", "macro_sql": "{% macro default__get_incremental_delete_insert_sql(arg_dict) %}\n\n  {% do return(get_delete_insert_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"unique_key\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.038846, "supported_languages": null}, "macro.dbt.get_incremental_merge_sql": {"name": "get_incremental_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_merge_sql", "macro_sql": "{% macro get_incremental_merge_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_merge_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0391, "supported_languages": null}, "macro.dbt.default__get_incremental_merge_sql": {"name": "default__get_incremental_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_merge_sql", "macro_sql": "{% macro default__get_incremental_merge_sql(arg_dict) %}\n\n  {% do return(get_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"unique_key\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.039407, "supported_languages": null}, "macro.dbt.get_incremental_insert_overwrite_sql": {"name": "get_incremental_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_insert_overwrite_sql", "macro_sql": "{% macro get_incremental_insert_overwrite_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_insert_overwrite_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_insert_overwrite_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.039597, "supported_languages": null}, "macro.dbt.default__get_incremental_insert_overwrite_sql": {"name": "default__get_incremental_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_insert_overwrite_sql", "macro_sql": "{% macro default__get_incremental_insert_overwrite_sql(arg_dict) %}\n\n  {% do return(get_insert_overwrite_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.039867, "supported_languages": null}, "macro.dbt.get_incremental_default_sql": {"name": "get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_default_sql", "macro_sql": "{% macro get_incremental_default_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_default_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_incremental_default_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0400581, "supported_languages": null}, "macro.dbt.default__get_incremental_default_sql": {"name": "default__get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_default_sql", "macro_sql": "{% macro default__get_incremental_default_sql(arg_dict) %}\n\n  {% do return(get_incremental_append_sql(arg_dict)) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_incremental_append_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.040212, "supported_languages": null}, "macro.dbt.get_insert_into_sql": {"name": "get_insert_into_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_insert_into_sql", "macro_sql": "{% macro get_insert_into_sql(target_relation, temp_relation, dest_columns) %}\n\n    {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n    insert into {{ target_relation }} ({{ dest_cols_csv }})\n    (\n        select {{ dest_cols_csv }}\n        from {{ temp_relation }}\n    )\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.040492, "supported_languages": null}, "macro.dbt.materialization_incremental_default": {"name": "materialization_incremental_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/incremental.sql", "original_file_path": "macros/materializations/models/incremental/incremental.sql", "unique_id": "macro.dbt.materialization_incremental_default", "macro_sql": "{% materialization incremental, default -%}\n\n  -- relations\n  {%- set existing_relation = load_cached_relation(this) -%}\n  {%- set target_relation = this.incorporate(type='table') -%}\n  {%- set temp_relation = make_temp_relation(target_relation)-%}\n  {%- set intermediate_relation = make_intermediate_relation(target_relation)-%}\n  {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n  {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n\n  -- configs\n  {%- set unique_key = config.get('unique_key') -%}\n  {%- set full_refresh_mode = (should_full_refresh()  or existing_relation.is_view) -%}\n  {%- set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') -%}\n\n  -- the temp_ and backup_ relations should not already exist in the database; get_relation\n  -- will return None in that case. Otherwise, we get a relation that we can drop\n  -- later, before we try to use this name for the current operation. This has to happen before\n  -- BEGIN, in a separate transaction\n  {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation)-%}\n  {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n   -- grab current tables grants config for comparision later on\n  {% set grant_config = config.get('grants') %}\n  {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n  {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  -- `BEGIN` happens here:\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  {% set to_drop = [] %}\n\n  {% if existing_relation is none %}\n      {% set build_sql = get_create_table_as_sql(False, target_relation, sql) %}\n  {% elif full_refresh_mode %}\n      {% set build_sql = get_create_table_as_sql(False, intermediate_relation, sql) %}\n      {% set need_swap = true %}\n  {% else %}\n    {% do run_query(get_create_table_as_sql(True, temp_relation, sql)) %}\n    {% do adapter.expand_target_column_types(\n             from_relation=temp_relation,\n             to_relation=target_relation) %}\n    {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n    {% set dest_columns = process_schema_changes(on_schema_change, temp_relation, existing_relation) %}\n    {% if not dest_columns %}\n      {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n    {% endif %}\n\n    {#-- Get the incremental_strategy, the macro to use for the strategy, and build the sql --#}\n    {% set incremental_strategy = config.get('incremental_strategy') or 'default' %}\n    {% set incremental_predicates = config.get('predicates', none) or config.get('incremental_predicates', none) %}\n    {% set strategy_sql_macro_func = adapter.get_incremental_strategy_macro(context, incremental_strategy) %}\n    {% set strategy_arg_dict = ({'target_relation': target_relation, 'temp_relation': temp_relation, 'unique_key': unique_key, 'dest_columns': dest_columns, 'incremental_predicates': incremental_predicates }) %}\n    {% set build_sql = strategy_sql_macro_func(strategy_arg_dict) %}\n\n  {% endif %}\n\n  {% call statement(\"main\") %}\n      {{ build_sql }}\n  {% endcall %}\n\n  {% if need_swap %}\n      {% do adapter.rename_relation(target_relation, backup_relation) %}\n      {% do adapter.rename_relation(intermediate_relation, target_relation) %}\n      {% do to_drop.append(backup_relation) %}\n  {% endif %}\n\n  {% set should_revoke = should_revoke(existing_relation, full_refresh_mode) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {% if existing_relation is none or existing_relation.is_view or should_full_refresh() %}\n    {% do create_indexes(target_relation) %}\n  {% endif %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  -- `COMMIT` happens here\n  {% do adapter.commit() %}\n\n  {% for rel in to_drop %}\n      {% do adapter.drop_relation(rel) %}\n  {% endfor %}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_temp_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.should_full_refresh", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.get_create_table_as_sql", "macro.dbt.run_query", "macro.dbt.process_schema_changes", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.045553, "supported_languages": ["sql"]}, "macro.dbt.incremental_validate_on_schema_change": {"name": "incremental_validate_on_schema_change", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.incremental_validate_on_schema_change", "macro_sql": "{% macro incremental_validate_on_schema_change(on_schema_change, default='ignore') %}\n\n   {% if on_schema_change not in ['sync_all_columns', 'append_new_columns', 'fail', 'ignore'] %}\n\n     {% set log_message = 'Invalid value for on_schema_change (%s) specified. Setting default value of %s.' % (on_schema_change, default) %}\n     {% do log(log_message) %}\n\n     {{ return(default) }}\n\n   {% else %}\n\n     {{ return(on_schema_change) }}\n\n   {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.051162, "supported_languages": null}, "macro.dbt.check_for_schema_changes": {"name": "check_for_schema_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.check_for_schema_changes", "macro_sql": "{% macro check_for_schema_changes(source_relation, target_relation) %}\n\n  {% set schema_changed = False %}\n\n  {%- set source_columns = adapter.get_columns_in_relation(source_relation) -%}\n  {%- set target_columns = adapter.get_columns_in_relation(target_relation) -%}\n  {%- set source_not_in_target = diff_columns(source_columns, target_columns) -%}\n  {%- set target_not_in_source = diff_columns(target_columns, source_columns) -%}\n\n  {% set new_target_types = diff_column_data_types(source_columns, target_columns) %}\n\n  {% if source_not_in_target != [] %}\n    {% set schema_changed = True %}\n  {% elif target_not_in_source != [] or new_target_types != [] %}\n    {% set schema_changed = True %}\n  {% elif new_target_types != [] %}\n    {% set schema_changed = True %}\n  {% endif %}\n\n  {% set changes_dict = {\n    'schema_changed': schema_changed,\n    'source_not_in_target': source_not_in_target,\n    'target_not_in_source': target_not_in_source,\n    'source_columns': source_columns,\n    'target_columns': target_columns,\n    'new_target_types': new_target_types\n  } %}\n\n  {% set msg %}\n    In {{ target_relation }}:\n        Schema changed: {{ schema_changed }}\n        Source columns not in target: {{ source_not_in_target }}\n        Target columns not in source: {{ target_not_in_source }}\n        New column types: {{ new_target_types }}\n  {% endset %}\n\n  {% do log(msg) %}\n\n  {{ return(changes_dict) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.diff_columns", "macro.dbt.diff_column_data_types"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0524, "supported_languages": null}, "macro.dbt.sync_column_schemas": {"name": "sync_column_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.sync_column_schemas", "macro_sql": "{% macro sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n\n  {%- set add_to_target_arr = schema_changes_dict['source_not_in_target'] -%}\n\n  {%- if on_schema_change == 'append_new_columns'-%}\n     {%- if add_to_target_arr | length > 0 -%}\n       {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, none) -%}\n     {%- endif -%}\n\n  {% elif on_schema_change == 'sync_all_columns' %}\n     {%- set remove_from_target_arr = schema_changes_dict['target_not_in_source'] -%}\n     {%- set new_target_types = schema_changes_dict['new_target_types'] -%}\n\n     {% if add_to_target_arr | length > 0 or remove_from_target_arr | length > 0 %}\n       {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, remove_from_target_arr) -%}\n     {% endif %}\n\n     {% if new_target_types != [] %}\n       {% for ntt in new_target_types %}\n         {% set column_name = ntt['column_name'] %}\n         {% set new_type = ntt['new_type'] %}\n         {% do alter_column_type(target_relation, column_name, new_type) %}\n       {% endfor %}\n     {% endif %}\n\n  {% endif %}\n\n  {% set schema_change_message %}\n    In {{ target_relation }}:\n        Schema change approach: {{ on_schema_change }}\n        Columns added: {{ add_to_target_arr }}\n        Columns removed: {{ remove_from_target_arr }}\n        Data types changed: {{ new_target_types }}\n  {% endset %}\n\n  {% do log(schema_change_message) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.alter_relation_add_remove_columns", "macro.dbt.alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.053623, "supported_languages": null}, "macro.dbt.process_schema_changes": {"name": "process_schema_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.process_schema_changes", "macro_sql": "{% macro process_schema_changes(on_schema_change, source_relation, target_relation) %}\n\n    {% if on_schema_change == 'ignore' %}\n\n     {{ return({}) }}\n\n    {% else %}\n\n      {% set schema_changes_dict = check_for_schema_changes(source_relation, target_relation) %}\n\n      {% if schema_changes_dict['schema_changed'] %}\n\n        {% if on_schema_change == 'fail' %}\n\n          {% set fail_msg %}\n              The source and target schemas on this incremental model are out of sync!\n              They can be reconciled in several ways:\n                - set the `on_schema_change` config to either append_new_columns or sync_all_columns, depending on your situation.\n                - Re-run the incremental model with `full_refresh: True` to update the target schema.\n                - update the schema manually and re-run the process.\n\n              Additional troubleshooting context:\n                 Source columns not in target: {{ schema_changes_dict['source_not_in_target'] }}\n                 Target columns not in source: {{ schema_changes_dict['target_not_in_source'] }}\n                 New column types: {{ schema_changes_dict['new_target_types'] }}\n          {% endset %}\n\n          {% do exceptions.raise_compiler_error(fail_msg) %}\n\n        {# -- unless we ignore, run the sync operation per the config #}\n        {% else %}\n\n          {% do sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n\n        {% endif %}\n\n      {% endif %}\n\n      {{ return(schema_changes_dict['source_columns']) }}\n\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.check_for_schema_changes", "macro.dbt.sync_column_schemas"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0544891, "supported_languages": null}, "macro.dbt.can_clone_table": {"name": "can_clone_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/can_clone_table.sql", "original_file_path": "macros/materializations/models/clone/can_clone_table.sql", "unique_id": "macro.dbt.can_clone_table", "macro_sql": "{% macro can_clone_table() %}\n    {{ return(adapter.dispatch('can_clone_table', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__can_clone_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.054753, "supported_languages": null}, "macro.dbt.default__can_clone_table": {"name": "default__can_clone_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/can_clone_table.sql", "original_file_path": "macros/materializations/models/clone/can_clone_table.sql", "unique_id": "macro.dbt.default__can_clone_table", "macro_sql": "{% macro default__can_clone_table() %}\n    {{ return(False) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0548759, "supported_languages": null}, "macro.dbt.create_or_replace_clone": {"name": "create_or_replace_clone", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/create_or_replace_clone.sql", "original_file_path": "macros/materializations/models/clone/create_or_replace_clone.sql", "unique_id": "macro.dbt.create_or_replace_clone", "macro_sql": "{% macro create_or_replace_clone(this_relation, defer_relation) %}\n    {{ return(adapter.dispatch('create_or_replace_clone', 'dbt')(this_relation, defer_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_or_replace_clone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0551732, "supported_languages": null}, "macro.dbt.default__create_or_replace_clone": {"name": "default__create_or_replace_clone", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/create_or_replace_clone.sql", "original_file_path": "macros/materializations/models/clone/create_or_replace_clone.sql", "unique_id": "macro.dbt.default__create_or_replace_clone", "macro_sql": "{% macro default__create_or_replace_clone(this_relation, defer_relation) %}\n    create or replace table {{ this_relation }} clone {{ defer_relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.055309, "supported_languages": null}, "macro.dbt.materialization_clone_default": {"name": "materialization_clone_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/clone.sql", "original_file_path": "macros/materializations/models/clone/clone.sql", "unique_id": "macro.dbt.materialization_clone_default", "macro_sql": "{%- materialization clone, default -%}\n\n  {%- set relations = {'relations': []} -%}\n\n  {%- if not defer_relation -%}\n      -- nothing to do\n      {{ log(\"No relation found in state manifest for \" ~ model.unique_id, info=True) }}\n      {{ return(relations) }}\n  {%- endif -%}\n\n  {%- set existing_relation = load_cached_relation(this) -%}\n\n  {%- if existing_relation and not flags.FULL_REFRESH -%}\n      -- noop!\n      {{ log(\"Relation \" ~ existing_relation ~ \" already exists\", info=True) }}\n      {{ return(relations) }}\n  {%- endif -%}\n\n  {%- set other_existing_relation = load_cached_relation(defer_relation) -%}\n\n  -- If this is a database that can do zero-copy cloning of tables, and the other relation is a table, then this will be a table\n  -- Otherwise, this will be a view\n\n  {% set can_clone_table = can_clone_table() %}\n\n  {%- if other_existing_relation and other_existing_relation.type == 'table' and can_clone_table -%}\n\n      {%- set target_relation = this.incorporate(type='table') -%}\n      {% if existing_relation is not none and not existing_relation.is_table %}\n        {{ log(\"Dropping relation \" ~ existing_relation ~ \" because it is of type \" ~ existing_relation.type) }}\n        {{ drop_relation_if_exists(existing_relation) }}\n      {% endif %}\n\n      -- as a general rule, data platforms that can clone tables can also do atomic 'create or replace'\n      {% call statement('main') %}\n          {% if target_relation and defer_relation and target_relation == defer_relation %}\n              {{ log(\"Target relation and defer relation are the same, skipping clone for relation: \" ~ target_relation) }}\n          {% else %}\n              {{ create_or_replace_clone(target_relation, defer_relation) }}\n          {% endif %}\n\n      {% endcall %}\n\n      {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n      {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n      {% do persist_docs(target_relation, model) %}\n\n      {{ return({'relations': [target_relation]}) }}\n\n  {%- else -%}\n\n      {%- set target_relation = this.incorporate(type='view') -%}\n\n      -- reuse the view materialization\n      -- TODO: support actual dispatch for materialization macros\n      -- Tracking ticket: https://github.com/dbt-labs/dbt-core/issues/7799\n      {% set search_name = \"materialization_view_\" ~ adapter.type() %}\n      {% if not search_name in context %}\n          {% set search_name = \"materialization_view_default\" %}\n      {% endif %}\n      {% set materialization_macro = context[search_name] %}\n      {% set relations = materialization_macro() %}\n      {{ return(relations) }}\n\n  {%- endif -%}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.can_clone_table", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_or_replace_clone", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0589912, "supported_languages": ["sql"]}, "macro.dbt.materialization_seed_default": {"name": "materialization_seed_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/seed.sql", "original_file_path": "macros/materializations/seeds/seed.sql", "unique_id": "macro.dbt.materialization_seed_default", "macro_sql": "{% materialization seed, default %}\n\n  {%- set identifier = model['alias'] -%}\n  {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n  {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n  {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n  {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n  {%- set grant_config = config.get('grants') -%}\n  {%- set agate_table = load_agate_table() -%}\n  -- grab current tables grants config for comparison later on\n\n  {%- do store_result('agate_table', response='OK', agate_table=agate_table) -%}\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  -- `BEGIN` happens here:\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  -- build model\n  {% set create_table_sql = \"\" %}\n  {% if exists_as_view %}\n    {{ exceptions.raise_compiler_error(\"Cannot seed to '{}', it is a view\".format(old_relation)) }}\n  {% elif exists_as_table %}\n    {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %}\n  {% else %}\n    {% set create_table_sql = create_csv_table(model, agate_table) %}\n  {% endif %}\n\n  {% set code = 'CREATE' if full_refresh_mode else 'INSERT' %}\n  {% set rows_affected = (agate_table.rows | length) %}\n  {% set sql = load_csv_rows(model, agate_table) %}\n\n  {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %}\n    {{ get_csv_sql(create_table_sql, sql) }};\n  {% endcall %}\n\n  {% set target_relation = this.incorporate(type='table') %}\n\n  {% set should_revoke = should_revoke(old_relation, full_refresh_mode) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {% if full_refresh_mode or not exists_as_table %}\n    {% do create_indexes(target_relation) %}\n  {% endif %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  -- `COMMIT` happens here\n  {{ adapter.commit() }}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.run_hooks", "macro.dbt.reset_csv_table", "macro.dbt.create_csv_table", "macro.dbt.load_csv_rows", "macro.dbt.noop_statement", "macro.dbt.get_csv_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.062251, "supported_languages": ["sql"]}, "macro.dbt.create_csv_table": {"name": "create_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n  {{ adapter.dispatch('create_csv_table', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.067302, "supported_languages": null}, "macro.dbt.default__create_csv_table": {"name": "default__create_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__create_csv_table", "macro_sql": "{% macro default__create_csv_table(model, agate_table) %}\n  {%- set column_override = model['config'].get('column_types', {}) -%}\n  {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n\n  {% set sql %}\n    create table {{ this.render() }} (\n        {%- for col_name in agate_table.column_names -%}\n            {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}\n            {%- set type = column_override.get(col_name, inferred_type) -%}\n            {%- set column_name = (col_name | string) -%}\n            {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%}\n        {%- endfor -%}\n    )\n  {% endset %}\n\n  {% call statement('_') -%}\n    {{ sql }}\n  {%- endcall %}\n\n  {{ return(sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.068225, "supported_languages": null}, "macro.dbt.reset_csv_table": {"name": "reset_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n  {{ adapter.dispatch('reset_csv_table', 'dbt')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__reset_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.068466, "supported_languages": null}, "macro.dbt.default__reset_csv_table": {"name": "default__reset_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__reset_csv_table", "macro_sql": "{% macro default__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n    {% set sql = \"\" %}\n    {% if full_refresh %}\n        {{ adapter.drop_relation(old_relation) }}\n        {% set sql = create_csv_table(model, agate_table) %}\n    {% else %}\n        {{ adapter.truncate_relation(old_relation) }}\n        {% set sql = \"truncate table \" ~ old_relation %}\n    {% endif %}\n\n    {{ return(sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.068955, "supported_languages": null}, "macro.dbt.get_csv_sql": {"name": "get_csv_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_csv_sql", "macro_sql": "{% macro get_csv_sql(create_or_truncate_sql, insert_sql) %}\n    {{ adapter.dispatch('get_csv_sql', 'dbt')(create_or_truncate_sql, insert_sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_csv_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.069151, "supported_languages": null}, "macro.dbt.default__get_csv_sql": {"name": "default__get_csv_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_csv_sql", "macro_sql": "{% macro default__get_csv_sql(create_or_truncate_sql, insert_sql) %}\n    {{ create_or_truncate_sql }};\n    -- dbt seed --\n    {{ insert_sql }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.069289, "supported_languages": null}, "macro.dbt.get_binding_char": {"name": "get_binding_char", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_binding_char", "macro_sql": "{% macro get_binding_char() -%}\n  {{ adapter.dispatch('get_binding_char', 'dbt')() }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.06943, "supported_languages": null}, "macro.dbt.default__get_binding_char": {"name": "default__get_binding_char", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_binding_char", "macro_sql": "{% macro default__get_binding_char() %}\n  {{ return('%s') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.06955, "supported_languages": null}, "macro.dbt.get_batch_size": {"name": "get_batch_size", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_batch_size", "macro_sql": "{% macro get_batch_size() -%}\n  {{ return(adapter.dispatch('get_batch_size', 'dbt')()) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_batch_size"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.06971, "supported_languages": null}, "macro.dbt.default__get_batch_size": {"name": "default__get_batch_size", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_batch_size", "macro_sql": "{% macro default__get_batch_size() %}\n  {{ return(10000) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.069827, "supported_languages": null}, "macro.dbt.get_seed_column_quoted_csv": {"name": "get_seed_column_quoted_csv", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_seed_column_quoted_csv", "macro_sql": "{% macro get_seed_column_quoted_csv(model, column_names) %}\n  {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n    {% set quoted = [] %}\n    {% for col in column_names -%}\n        {%- do quoted.append(adapter.quote_seed_column(col, quote_seed_column)) -%}\n    {%- endfor %}\n\n    {%- set dest_cols_csv = quoted | join(', ') -%}\n    {{ return(dest_cols_csv) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0703151, "supported_languages": null}, "macro.dbt.load_csv_rows": {"name": "load_csv_rows", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n  {{ adapter.dispatch('load_csv_rows', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0705018, "supported_languages": null}, "macro.dbt.default__load_csv_rows": {"name": "default__load_csv_rows", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__load_csv_rows", "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n\n  {% set batch_size = get_batch_size() %}\n\n  {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n  {% set bindings = [] %}\n\n  {% set statements = [] %}\n\n  {% for chunk in agate_table.rows | batch(batch_size) %}\n      {% set bindings = [] %}\n\n      {% for row in chunk %}\n          {% do bindings.extend(row) %}\n      {% endfor %}\n\n      {% set sql %}\n          insert into {{ this.render() }} ({{ cols_sql }}) values\n          {% for row in chunk -%}\n              ({%- for column in agate_table.column_names -%}\n                  {{ get_binding_char() }}\n                  {%- if not loop.last%},{%- endif %}\n              {%- endfor -%})\n              {%- if not loop.last%},{%- endif %}\n          {%- endfor %}\n      {% endset %}\n\n      {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n\n      {% if loop.index0 == 0 %}\n          {% do statements.append(sql) %}\n      {% endif %}\n  {% endfor %}\n\n  {# Return SQL so we can render it out into the compiled files #}\n  {{ return(statements[0]) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv", "macro.dbt.get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.071799, "supported_languages": null}, "macro.dbt.generate_alias_name": {"name": "generate_alias_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "unique_id": "macro.dbt.generate_alias_name", "macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n    {% do return(adapter.dispatch('generate_alias_name', 'dbt')(custom_alias_name, node)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_alias_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.072227, "supported_languages": null}, "macro.dbt.default__generate_alias_name": {"name": "default__generate_alias_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "unique_id": "macro.dbt.default__generate_alias_name", "macro_sql": "{% macro default__generate_alias_name(custom_alias_name=none, node=none) -%}\n\n    {%- if custom_alias_name -%}\n\n        {{ custom_alias_name | trim }}\n\n    {%- elif node.version -%}\n\n        {{ return(node.name ~ \"_v\" ~ (node.version | replace(\".\", \"_\"))) }}\n\n    {%- else -%}\n\n        {{ node.name }}\n\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.072612, "supported_languages": null}, "macro.dbt.generate_schema_name": {"name": "generate_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name=none, node=none) -%}\n    {{ return(adapter.dispatch('generate_schema_name', 'dbt')(custom_schema_name, node)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.073138, "supported_languages": null}, "macro.dbt.default__generate_schema_name": {"name": "default__generate_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.default__generate_schema_name", "macro_sql": "{% macro default__generate_schema_name(custom_schema_name, node) -%}\n\n    {%- set default_schema = target.schema -%}\n    {%- if custom_schema_name is none -%}\n\n        {{ default_schema }}\n\n    {%- else -%}\n\n        {{ default_schema }}_{{ custom_schema_name | trim }}\n\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.073401, "supported_languages": null}, "macro.dbt.generate_schema_name_for_env": {"name": "generate_schema_name_for_env", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.generate_schema_name_for_env", "macro_sql": "{% macro generate_schema_name_for_env(custom_schema_name, node) -%}\n\n    {%- set default_schema = target.schema -%}\n    {%- if target.name == 'prod' and custom_schema_name is not none -%}\n\n        {{ custom_schema_name | trim }}\n\n    {%- else -%}\n\n        {{ default_schema }}\n\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.073685, "supported_languages": null}, "macro.dbt.generate_database_name": {"name": "generate_database_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "unique_id": "macro.dbt.generate_database_name", "macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n    {% do return(adapter.dispatch('generate_database_name', 'dbt')(custom_database_name, node)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0740821, "supported_languages": null}, "macro.dbt.default__generate_database_name": {"name": "default__generate_database_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "unique_id": "macro.dbt.default__generate_database_name", "macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n    {%- set default_database = target.database -%}\n    {%- if custom_database_name is none -%}\n\n        {{ default_database }}\n\n    {%- else -%}\n\n        {{ custom_database_name }}\n\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.074338, "supported_languages": null}, "macro.dbt.get_drop_sql": {"name": "get_drop_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.get_drop_sql", "macro_sql": "{%- macro get_drop_sql(relation) -%}\n    {{- log('Applying DROP to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_drop_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.075052, "supported_languages": null}, "macro.dbt.default__get_drop_sql": {"name": "default__get_drop_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.default__get_drop_sql", "macro_sql": "{%- macro default__get_drop_sql(relation) -%}\n\n    {%- if relation.is_view -%}\n        {{ drop_view(relation) }}\n\n    {%- elif relation.is_table -%}\n        {{ drop_table(relation) }}\n\n    {%- elif relation.is_materialized_view -%}\n        {{ drop_materialized_view(relation) }}\n\n    {%- else -%}\n        drop {{ relation.type }} if exists {{ relation }} cascade\n\n    {%- endif -%}\n\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.drop_view", "macro.dbt.drop_table", "macro.dbt.drop_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.075427, "supported_languages": null}, "macro.dbt.drop_relation": {"name": "drop_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n    {{ return(adapter.dispatch('drop_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0756102, "supported_languages": null}, "macro.dbt.default__drop_relation": {"name": "default__drop_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.default__drop_relation", "macro_sql": "{% macro default__drop_relation(relation) -%}\n    {% call statement('drop_relation', auto_begin=False) -%}\n        {{ get_drop_sql(relation) }}\n    {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.075816, "supported_languages": null}, "macro.dbt.drop_relation_if_exists": {"name": "drop_relation_if_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.drop_relation_if_exists", "macro_sql": "{% macro drop_relation_if_exists(relation) %}\n  {% if relation is not none %}\n    {{ adapter.drop_relation(relation) }}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0760121, "supported_languages": null}, "macro.dbt.get_replace_sql": {"name": "get_replace_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/replace.sql", "original_file_path": "macros/relations/replace.sql", "unique_id": "macro.dbt.get_replace_sql", "macro_sql": "{% macro get_replace_sql(existing_relation, target_relation, sql) %}\n    {{- log('Applying REPLACE to: ' ~ existing_relation) -}}\n    {{- adapter.dispatch('get_replace_sql', 'dbt')(existing_relation, target_relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_replace_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.076802, "supported_languages": null}, "macro.dbt.default__get_replace_sql": {"name": "default__get_replace_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/replace.sql", "original_file_path": "macros/relations/replace.sql", "unique_id": "macro.dbt.default__get_replace_sql", "macro_sql": "{% macro default__get_replace_sql(existing_relation, target_relation, sql) %}\n\n    {# /* use a create or replace statement if possible */ #}\n\n    {% set is_replaceable = existing_relation.type == target_relation_type and existing_relation.can_be_replaced %}\n\n    {% if is_replaceable and existing_relation.is_view %}\n        {{ get_replace_view_sql(target_relation, sql) }}\n\n    {% elif is_replaceable and existing_relation.is_table %}\n        {{ get_replace_table_sql(target_relation, sql) }}\n\n    {% elif is_replaceable and existing_relation.is_materialized_view %}\n        {{ get_replace_materialized_view_sql(target_relation, sql) }}\n\n    {# /* a create or replace statement is not possible, so try to stage and/or backup to be safe */ #}\n\n    {# /* create target_relation as an intermediate relation, then swap it out with the existing one using a backup */ #}\n    {%- elif target_relation.can_be_renamed and existing_relation.can_be_renamed -%}\n        {{ get_create_intermediate_sql(target_relation, sql) }};\n        {{ get_create_backup_sql(existing_relation) }};\n        {{ get_rename_intermediate_sql(target_relation) }};\n        {{ get_drop_backup_sql(existing_relation) }}\n\n    {# /* create target_relation as an intermediate relation, then swap it out with the existing one without using a backup */ #}\n    {%- elif target_relation.can_be_renamed -%}\n        {{ get_create_intermediate_sql(target_relation, sql) }};\n        {{ get_drop_sql(existing_relation) }};\n        {{ get_rename_intermediate_sql(target_relation) }}\n\n    {# /* create target_relation in place by first backing up the existing relation */ #}\n    {%- elif existing_relation.can_be_renamed -%}\n        {{ get_create_backup_sql(existing_relation) }};\n        {{ get_create_sql(target_relation, sql) }};\n        {{ get_drop_backup_sql(existing_relation) }}\n\n    {# /* no renaming is allowed, so just drop and create */ #}\n    {%- else -%}\n        {{ get_drop_sql(existing_relation) }};\n        {{ get_create_sql(target_relation, sql) }}\n\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_replace_view_sql", "macro.dbt.get_replace_table_sql", "macro.dbt.get_replace_materialized_view_sql", "macro.dbt.get_create_intermediate_sql", "macro.dbt.get_create_backup_sql", "macro.dbt.get_rename_intermediate_sql", "macro.dbt.get_drop_backup_sql", "macro.dbt.get_drop_sql", "macro.dbt.get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.07811, "supported_languages": null}, "macro.dbt.get_create_intermediate_sql": {"name": "get_create_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_intermediate.sql", "original_file_path": "macros/relations/create_intermediate.sql", "unique_id": "macro.dbt.get_create_intermediate_sql", "macro_sql": "{%- macro get_create_intermediate_sql(relation, sql) -%}\n    {{- log('Applying CREATE INTERMEDIATE to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_create_intermediate_sql', 'dbt')(relation, sql) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_create_intermediate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0784981, "supported_languages": null}, "macro.dbt.default__get_create_intermediate_sql": {"name": "default__get_create_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_intermediate.sql", "original_file_path": "macros/relations/create_intermediate.sql", "unique_id": "macro.dbt.default__get_create_intermediate_sql", "macro_sql": "{%- macro default__get_create_intermediate_sql(relation, sql) -%}\n\n    -- get the standard intermediate name\n    {% set intermediate_relation = make_intermediate_relation(relation) %}\n\n    -- drop any pre-existing intermediate\n    {{ get_drop_sql(intermediate_relation) }};\n\n    {{ get_create_sql(intermediate_relation, sql) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_intermediate_relation", "macro.dbt.get_drop_sql", "macro.dbt.get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.078753, "supported_languages": null}, "macro.dbt.get_drop_backup_sql": {"name": "get_drop_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop_backup.sql", "original_file_path": "macros/relations/drop_backup.sql", "unique_id": "macro.dbt.get_drop_backup_sql", "macro_sql": "{%- macro get_drop_backup_sql(relation) -%}\n    {{- log('Applying DROP BACKUP to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_drop_backup_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_drop_backup_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0790882, "supported_languages": null}, "macro.dbt.default__get_drop_backup_sql": {"name": "default__get_drop_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop_backup.sql", "original_file_path": "macros/relations/drop_backup.sql", "unique_id": "macro.dbt.default__get_drop_backup_sql", "macro_sql": "{%- macro default__get_drop_backup_sql(relation) -%}\n\n    -- get the standard backup name\n    {% set backup_relation = make_backup_relation(relation, relation.type) %}\n\n    {{ get_drop_sql(backup_relation) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_backup_relation", "macro.dbt.get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0793002, "supported_languages": null}, "macro.dbt.get_rename_sql": {"name": "get_rename_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.get_rename_sql", "macro_sql": "{%- macro get_rename_sql(relation, new_name) -%}\n    {{- log('Applying RENAME to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_rename_sql', 'dbt')(relation, new_name) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.080062, "supported_languages": null}, "macro.dbt.default__get_rename_sql": {"name": "default__get_rename_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.default__get_rename_sql", "macro_sql": "{%- macro default__get_rename_sql(relation, new_name) -%}\n\n    {%- if relation.is_view -%}\n        {{ get_rename_view_sql(relation, new_name) }}\n\n    {%- elif relation.is_table -%}\n        {{ get_rename_table_sql(relation, new_name) }}\n\n    {%- elif relation.is_materialized_view -%}\n        {{ get_rename_materialized_view_sql(relation, new_name) }}\n\n    {%- else -%}\n        {{- exceptions.raise_compiler_error(\"`get_rename_sql` has not been implemented for: \" ~ relation.type ) -}}\n\n    {%- endif -%}\n\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.get_rename_view_sql", "macro.dbt.get_rename_table_sql", "macro.dbt.get_rename_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0805051, "supported_languages": null}, "macro.dbt.rename_relation": {"name": "rename_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n  {{ return(adapter.dispatch('rename_relation', 'dbt')(from_relation, to_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__rename_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.080719, "supported_languages": null}, "macro.dbt.default__rename_relation": {"name": "default__rename_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.default__rename_relation", "macro_sql": "{% macro default__rename_relation(from_relation, to_relation) -%}\n  {% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}\n  {% call statement('rename_relation') -%}\n    alter table {{ from_relation }} rename to {{ target_name }}\n  {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.081013, "supported_languages": null}, "macro.dbt.get_create_backup_sql": {"name": "get_create_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_backup.sql", "original_file_path": "macros/relations/create_backup.sql", "unique_id": "macro.dbt.get_create_backup_sql", "macro_sql": "{%- macro get_create_backup_sql(relation) -%}\n    {{- log('Applying CREATE BACKUP to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_create_backup_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_create_backup_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.081362, "supported_languages": null}, "macro.dbt.default__get_create_backup_sql": {"name": "default__get_create_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_backup.sql", "original_file_path": "macros/relations/create_backup.sql", "unique_id": "macro.dbt.default__get_create_backup_sql", "macro_sql": "{%- macro default__get_create_backup_sql(relation) -%}\n\n    -- get the standard backup name\n    {% set backup_relation = make_backup_relation(relation, relation.type) %}\n\n    -- drop any pre-existing backup\n    {{ get_drop_sql(backup_relation) }};\n\n    {{ get_rename_sql(relation, backup_relation.identifier) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_backup_relation", "macro.dbt.get_drop_sql", "macro.dbt.get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0816362, "supported_languages": null}, "macro.dbt.get_create_sql": {"name": "get_create_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create.sql", "original_file_path": "macros/relations/create.sql", "unique_id": "macro.dbt.get_create_sql", "macro_sql": "{%- macro get_create_sql(relation, sql) -%}\n    {{- log('Applying CREATE to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_create_sql', 'dbt')(relation, sql) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.082108, "supported_languages": null}, "macro.dbt.default__get_create_sql": {"name": "default__get_create_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create.sql", "original_file_path": "macros/relations/create.sql", "unique_id": "macro.dbt.default__get_create_sql", "macro_sql": "{%- macro default__get_create_sql(relation, sql) -%}\n\n    {%- if relation.is_view -%}\n        {{ get_create_view_as_sql(relation, sql) }}\n\n    {%- elif relation.is_table -%}\n        {{ get_create_table_as_sql(False, relation, sql) }}\n\n    {%- elif relation.is_materialized_view -%}\n        {{ get_create_materialized_view_as_sql(relation, sql) }}\n\n    {%- else -%}\n        {{- exceptions.raise_compiler_error(\"`get_create_sql` has not been implemented for: \" ~ relation.type ) -}}\n\n    {%- endif -%}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.get_create_view_as_sql", "macro.dbt.get_create_table_as_sql", "macro.dbt.get_create_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0825589, "supported_languages": null}, "macro.dbt.get_rename_intermediate_sql": {"name": "get_rename_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename_intermediate.sql", "original_file_path": "macros/relations/rename_intermediate.sql", "unique_id": "macro.dbt.get_rename_intermediate_sql", "macro_sql": "{%- macro get_rename_intermediate_sql(relation) -%}\n    {{- log('Applying RENAME INTERMEDIATE to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_rename_intermediate_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_rename_intermediate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.08289, "supported_languages": null}, "macro.dbt.default__get_rename_intermediate_sql": {"name": "default__get_rename_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename_intermediate.sql", "original_file_path": "macros/relations/rename_intermediate.sql", "unique_id": "macro.dbt.default__get_rename_intermediate_sql", "macro_sql": "{%- macro default__get_rename_intermediate_sql(relation) -%}\n\n    -- get the standard intermediate name\n    {% set intermediate_relation = make_intermediate_relation(relation) %}\n\n    {{ get_rename_sql(intermediate_relation, relation.identifier) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_intermediate_relation", "macro.dbt.get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.083102, "supported_languages": null}, "macro.dbt.drop_materialized_view": {"name": "drop_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/drop.sql", "original_file_path": "macros/relations/materialized_view/drop.sql", "unique_id": "macro.dbt.drop_materialized_view", "macro_sql": "{% macro drop_materialized_view(relation) -%}\n    {{ return(adapter.dispatch('drop_materialized_view', 'dbt')(relation)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.08337, "supported_languages": null}, "macro.dbt.default__drop_materialized_view": {"name": "default__drop_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/drop.sql", "original_file_path": "macros/relations/materialized_view/drop.sql", "unique_id": "macro.dbt.default__drop_materialized_view", "macro_sql": "{% macro default__drop_materialized_view(relation) -%}\n    drop materialized view if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.083482, "supported_languages": null}, "macro.dbt.get_replace_materialized_view_sql": {"name": "get_replace_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/replace.sql", "original_file_path": "macros/relations/materialized_view/replace.sql", "unique_id": "macro.dbt.get_replace_materialized_view_sql", "macro_sql": "{% macro get_replace_materialized_view_sql(relation, sql) %}\n    {{- adapter.dispatch('get_replace_materialized_view_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_replace_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.083756, "supported_languages": null}, "macro.dbt.default__get_replace_materialized_view_sql": {"name": "default__get_replace_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/replace.sql", "original_file_path": "macros/relations/materialized_view/replace.sql", "unique_id": "macro.dbt.default__get_replace_materialized_view_sql", "macro_sql": "{% macro default__get_replace_materialized_view_sql(relation, sql) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_replace_materialized_view_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.08391, "supported_languages": null}, "macro.dbt.refresh_materialized_view": {"name": "refresh_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/refresh.sql", "original_file_path": "macros/relations/materialized_view/refresh.sql", "unique_id": "macro.dbt.refresh_materialized_view", "macro_sql": "{% macro refresh_materialized_view(relation) %}\n    {{- log('Applying REFRESH to: ' ~ relation) -}}\n    {{- adapter.dispatch('refresh_materialized_view', 'dbt')(relation) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__refresh_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.084237, "supported_languages": null}, "macro.dbt.default__refresh_materialized_view": {"name": "default__refresh_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/refresh.sql", "original_file_path": "macros/relations/materialized_view/refresh.sql", "unique_id": "macro.dbt.default__refresh_materialized_view", "macro_sql": "{% macro default__refresh_materialized_view(relation) %}\n    {{ exceptions.raise_compiler_error(\"`refresh_materialized_view` has not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.084434, "supported_languages": null}, "macro.dbt.get_rename_materialized_view_sql": {"name": "get_rename_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/rename.sql", "original_file_path": "macros/relations/materialized_view/rename.sql", "unique_id": "macro.dbt.get_rename_materialized_view_sql", "macro_sql": "{% macro get_rename_materialized_view_sql(relation, new_name) %}\n    {{- adapter.dispatch('get_rename_materialized_view_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_rename_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0847092, "supported_languages": null}, "macro.dbt.default__get_rename_materialized_view_sql": {"name": "default__get_rename_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/rename.sql", "original_file_path": "macros/relations/materialized_view/rename.sql", "unique_id": "macro.dbt.default__get_rename_materialized_view_sql", "macro_sql": "{% macro default__get_rename_materialized_view_sql(relation, new_name) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_rename_materialized_view_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.084853, "supported_languages": null}, "macro.dbt.get_alter_materialized_view_as_sql": {"name": "get_alter_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.get_alter_materialized_view_as_sql", "macro_sql": "{% macro get_alter_materialized_view_as_sql(\n    relation,\n    configuration_changes,\n    sql,\n    existing_relation,\n    backup_relation,\n    intermediate_relation\n) %}\n    {{- log('Applying ALTER to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_alter_materialized_view_as_sql', 'dbt')(\n        relation,\n        configuration_changes,\n        sql,\n        existing_relation,\n        backup_relation,\n        intermediate_relation\n    ) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_alter_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0854678, "supported_languages": null}, "macro.dbt.default__get_alter_materialized_view_as_sql": {"name": "default__get_alter_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.default__get_alter_materialized_view_as_sql", "macro_sql": "{% macro default__get_alter_materialized_view_as_sql(\n    relation,\n    configuration_changes,\n    sql,\n    existing_relation,\n    backup_relation,\n    intermediate_relation\n) %}\n    {{ exceptions.raise_compiler_error(\"Materialized views have not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.08566, "supported_languages": null}, "macro.dbt.get_materialized_view_configuration_changes": {"name": "get_materialized_view_configuration_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.get_materialized_view_configuration_changes", "macro_sql": "{% macro get_materialized_view_configuration_changes(existing_relation, new_config) %}\n    /* {#\n    It's recommended that configuration changes be formatted as follows:\n    {\"<change_category>\": [{\"action\": \"<name>\", \"context\": ...}]}\n\n    For example:\n    {\n        \"indexes\": [\n            {\"action\": \"drop\", \"context\": \"index_abc\"},\n            {\"action\": \"create\", \"context\": {\"columns\": [\"column_1\", \"column_2\"], \"type\": \"hash\", \"unique\": True}},\n        ],\n    }\n\n    Either way, `get_materialized_view_configuration_changes` needs to align with `get_alter_materialized_view_as_sql`.\n    #} */\n    {{- log('Determining configuration changes on: ' ~ existing_relation) -}}\n    {%- do return(adapter.dispatch('get_materialized_view_configuration_changes', 'dbt')(existing_relation, new_config)) -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_materialized_view_configuration_changes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0859442, "supported_languages": null}, "macro.dbt.default__get_materialized_view_configuration_changes": {"name": "default__get_materialized_view_configuration_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.default__get_materialized_view_configuration_changes", "macro_sql": "{% macro default__get_materialized_view_configuration_changes(existing_relation, new_config) %}\n    {{ exceptions.raise_compiler_error(\"Materialized views have not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.086091, "supported_languages": null}, "macro.dbt.get_create_materialized_view_as_sql": {"name": "get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/create.sql", "original_file_path": "macros/relations/materialized_view/create.sql", "unique_id": "macro.dbt.get_create_materialized_view_as_sql", "macro_sql": "{% macro get_create_materialized_view_as_sql(relation, sql) -%}\n    {{- adapter.dispatch('get_create_materialized_view_as_sql', 'dbt')(relation, sql) -}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.086365, "supported_languages": null}, "macro.dbt.default__get_create_materialized_view_as_sql": {"name": "default__get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/create.sql", "original_file_path": "macros/relations/materialized_view/create.sql", "unique_id": "macro.dbt.default__get_create_materialized_view_as_sql", "macro_sql": "{% macro default__get_create_materialized_view_as_sql(relation, sql) -%}\n    {{ exceptions.raise_compiler_error(\n        \"`get_create_materialized_view_as_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0865111, "supported_languages": null}, "macro.dbt.get_table_columns_and_constraints": {"name": "get_table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.get_table_columns_and_constraints", "macro_sql": "{%- macro get_table_columns_and_constraints() -%}\n  {{ adapter.dispatch('get_table_columns_and_constraints', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__get_table_columns_and_constraints"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.087512, "supported_languages": null}, "macro.dbt.default__get_table_columns_and_constraints": {"name": "default__get_table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__get_table_columns_and_constraints", "macro_sql": "{% macro default__get_table_columns_and_constraints() -%}\n  {{ return(table_columns_and_constraints()) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.table_columns_and_constraints"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.087632, "supported_languages": null}, "macro.dbt.table_columns_and_constraints": {"name": "table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.table_columns_and_constraints", "macro_sql": "{% macro table_columns_and_constraints() %}\n  {# loop through user_provided_columns to create DDL with data types and constraints #}\n    {%- set raw_column_constraints = adapter.render_raw_columns_constraints(raw_columns=model['columns']) -%}\n    {%- set raw_model_constraints = adapter.render_raw_model_constraints(raw_constraints=model['constraints']) -%}\n    (\n    {% for c in raw_column_constraints -%}\n      {{ c }}{{ \",\" if not loop.last or raw_model_constraints }}\n    {% endfor %}\n    {% for c in raw_model_constraints -%}\n        {{ c }}{{ \",\" if not loop.last }}\n    {% endfor -%}\n    )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.088177, "supported_languages": null}, "macro.dbt.get_assert_columns_equivalent": {"name": "get_assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.get_assert_columns_equivalent", "macro_sql": "\n\n{%- macro get_assert_columns_equivalent(sql) -%}\n  {{ adapter.dispatch('get_assert_columns_equivalent', 'dbt')(sql) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.088348, "supported_languages": null}, "macro.dbt.default__get_assert_columns_equivalent": {"name": "default__get_assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__get_assert_columns_equivalent", "macro_sql": "{% macro default__get_assert_columns_equivalent(sql) -%}\n  {{ return(assert_columns_equivalent(sql)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.088483, "supported_languages": null}, "macro.dbt.assert_columns_equivalent": {"name": "assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.assert_columns_equivalent", "macro_sql": "{% macro assert_columns_equivalent(sql) %}\n\n  {#-- First ensure the user has defined 'columns' in yaml specification --#}\n  {%- set user_defined_columns = model['columns'] -%}\n  {%- if not user_defined_columns -%}\n      {{ exceptions.raise_contract_error([], []) }}\n  {%- endif -%}\n\n  {#-- Obtain the column schema provided by sql file. #}\n  {%- set sql_file_provided_columns = get_column_schema_from_query(sql, config.get('sql_header', none)) -%}\n  {#--Obtain the column schema provided by the schema file by generating an 'empty schema' query from the model's columns. #}\n  {%- set schema_file_provided_columns = get_column_schema_from_query(get_empty_schema_sql(user_defined_columns)) -%}\n\n  {#-- create dictionaries with name and formatted data type and strings for exception #}\n  {%- set sql_columns = format_columns(sql_file_provided_columns) -%}\n  {%- set yaml_columns = format_columns(schema_file_provided_columns)  -%}\n\n  {%- if sql_columns|length != yaml_columns|length -%}\n    {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n  {%- endif -%}\n\n  {%- for sql_col in sql_columns -%}\n    {%- set yaml_col = [] -%}\n    {%- for this_col in yaml_columns -%}\n      {%- if this_col['name'] == sql_col['name'] -%}\n        {%- do yaml_col.append(this_col) -%}\n        {%- break -%}\n      {%- endif -%}\n    {%- endfor -%}\n    {%- if not yaml_col -%}\n      {#-- Column with name not found in yaml #}\n      {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n    {%- endif -%}\n    {%- if sql_col['formatted'] != yaml_col[0]['formatted'] -%}\n      {#-- Column data types don't match #}\n      {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n    {%- endif -%}\n  {%- endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_column_schema_from_query", "macro.dbt.get_empty_schema_sql", "macro.dbt.format_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0899572, "supported_languages": null}, "macro.dbt.format_columns": {"name": "format_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.format_columns", "macro_sql": "{% macro format_columns(columns) %}\n  {% set formatted_columns = [] %}\n  {% for column in columns %}\n    {%- set formatted_column = adapter.dispatch('format_column', 'dbt')(column) -%}\n    {%- do formatted_columns.append(formatted_column) -%}\n  {% endfor %}\n  {{ return(formatted_columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__format_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0903602, "supported_languages": null}, "macro.dbt.default__format_column": {"name": "default__format_column", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__format_column", "macro_sql": "{% macro default__format_column(column) -%}\n  {% set data_type = column.dtype %}\n  {% set formatted = column.column.lower() ~ \" \" ~ data_type %}\n  {{ return({'name': column.name, 'data_type': data_type, 'formatted': formatted}) }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0907142, "supported_languages": null}, "macro.dbt.drop_table": {"name": "drop_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt.drop_table", "macro_sql": "{% macro drop_table(relation) -%}\n    {{ return(adapter.dispatch('drop_table', 'dbt')(relation)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.090987, "supported_languages": null}, "macro.dbt.default__drop_table": {"name": "default__drop_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt.default__drop_table", "macro_sql": "{% macro default__drop_table(relation) -%}\n    drop table if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.091094, "supported_languages": null}, "macro.dbt.get_replace_table_sql": {"name": "get_replace_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt.get_replace_table_sql", "macro_sql": "{% macro get_replace_table_sql(relation, sql) %}\n    {{- adapter.dispatch('get_replace_table_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_replace_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0913641, "supported_languages": null}, "macro.dbt.default__get_replace_table_sql": {"name": "default__get_replace_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt.default__get_replace_table_sql", "macro_sql": "{% macro default__get_replace_table_sql(relation, sql) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_replace_table_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0915132, "supported_languages": null}, "macro.dbt.get_rename_table_sql": {"name": "get_rename_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt.get_rename_table_sql", "macro_sql": "{% macro get_rename_table_sql(relation, new_name) %}\n    {{- adapter.dispatch('get_rename_table_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_rename_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.091784, "supported_languages": null}, "macro.dbt.default__get_rename_table_sql": {"name": "default__get_rename_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt.default__get_rename_table_sql", "macro_sql": "{% macro default__get_rename_table_sql(relation, new_name) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_rename_table_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.091933, "supported_languages": null}, "macro.dbt.get_create_table_as_sql": {"name": "get_create_table_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.get_create_table_as_sql", "macro_sql": "{% macro get_create_table_as_sql(temporary, relation, sql) -%}\n  {{ adapter.dispatch('get_create_table_as_sql', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_table_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.092787, "supported_languages": null}, "macro.dbt.default__get_create_table_as_sql": {"name": "default__get_create_table_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_create_table_as_sql", "macro_sql": "{% macro default__get_create_table_as_sql(temporary, relation, sql) -%}\n  {{ return(create_table_as(temporary, relation, sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.092972, "supported_languages": null}, "macro.dbt.create_table_as": {"name": "create_table_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, compiled_code, language='sql') -%}\n  {# backward compatibility for create_table_as that does not support language #}\n  {% if language == \"sql\" %}\n    {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, compiled_code)}}\n  {% else %}\n    {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, compiled_code, language) }}\n  {% endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.093416, "supported_languages": null}, "macro.dbt.default__create_table_as": {"name": "default__create_table_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__create_table_as", "macro_sql": "{% macro default__create_table_as(temporary, relation, sql) -%}\n  {%- set sql_header = config.get('sql_header', none) -%}\n\n  {{ sql_header if sql_header is not none }}\n\n  create {% if temporary: -%}temporary{%- endif %} table\n    {{ relation.include(database=(not temporary), schema=(not temporary)) }}\n  {% set contract_config = config.get('contract') %}\n  {% if contract_config.enforced and (not temporary) %}\n    {{ get_assert_columns_equivalent(sql) }}\n    {{ get_table_columns_and_constraints() }}\n    {%- set sql = get_select_subquery(sql) %}\n  {% endif %}\n  as (\n    {{ sql }}\n  );\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent", "macro.dbt.get_table_columns_and_constraints", "macro.dbt.get_select_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.094121, "supported_languages": null}, "macro.dbt.default__get_column_names": {"name": "default__get_column_names", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_column_names", "macro_sql": "{% macro default__get_column_names() %}\n  {#- loop through user_provided_columns to get column names -#}\n    {%- set user_provided_columns = model['columns'] -%}\n    {%- for i in user_provided_columns %}\n      {%- set col = user_provided_columns[i] -%}\n      {%- set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] -%}\n      {{ col_name }}{{ \", \" if not loop.last }}\n    {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.094591, "supported_languages": null}, "macro.dbt.get_select_subquery": {"name": "get_select_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.get_select_subquery", "macro_sql": "{% macro get_select_subquery(sql) %}\n  {{ return(adapter.dispatch('get_select_subquery', 'dbt')(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_select_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.094781, "supported_languages": null}, "macro.dbt.default__get_select_subquery": {"name": "default__get_select_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_select_subquery", "macro_sql": "{% macro default__get_select_subquery(sql) %}\n    select {{ adapter.dispatch('get_column_names', 'dbt')() }}\n    from (\n        {{ sql }}\n    ) as model_subq\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_column_names"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0949628, "supported_languages": null}, "macro.dbt.drop_view": {"name": "drop_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt.drop_view", "macro_sql": "{% macro drop_view(relation) -%}\n    {{ return(adapter.dispatch('drop_view', 'dbt')(relation)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0952299, "supported_languages": null}, "macro.dbt.default__drop_view": {"name": "default__drop_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt.default__drop_view", "macro_sql": "{% macro default__drop_view(relation) -%}\n    drop view if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.095337, "supported_languages": null}, "macro.dbt.get_replace_view_sql": {"name": "get_replace_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.get_replace_view_sql", "macro_sql": "{% macro get_replace_view_sql(relation, sql) %}\n    {{- adapter.dispatch('get_replace_view_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_replace_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0961988, "supported_languages": null}, "macro.dbt.default__get_replace_view_sql": {"name": "default__get_replace_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.default__get_replace_view_sql", "macro_sql": "{% macro default__get_replace_view_sql(relation, sql) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_replace_view_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0963461, "supported_languages": null}, "macro.dbt.create_or_replace_view": {"name": "create_or_replace_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.create_or_replace_view", "macro_sql": "{% macro create_or_replace_view() %}\n  {%- set identifier = model['alias'] -%}\n\n  {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n  {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n  {%- set target_relation = api.Relation.create(\n      identifier=identifier, schema=schema, database=database,\n      type='view') -%}\n  {% set grant_config = config.get('grants') %}\n\n  {{ run_hooks(pre_hooks) }}\n\n  -- If there's a table with the same name and we weren't told to full refresh,\n  -- that's an error. If we were told to full refresh, drop it. This behavior differs\n  -- for Snowflake and BigQuery, so multiple dispatch is used.\n  {%- if old_relation is not none and old_relation.is_table -%}\n    {{ handle_existing_table(should_full_refresh(), old_relation) }}\n  {%- endif -%}\n\n  -- build model\n  {% call statement('main') -%}\n    {{ get_create_view_as_sql(target_relation, sql) }}\n  {%- endcall %}\n\n  {% set should_revoke = should_revoke(exists_as_view, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {{ run_hooks(post_hooks) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.097559, "supported_languages": null}, "macro.dbt.handle_existing_table": {"name": "handle_existing_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n    {{ adapter.dispatch('handle_existing_table', 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__handle_existing_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.09776, "supported_languages": null}, "macro.dbt.default__handle_existing_table": {"name": "default__handle_existing_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n    {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n    {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.097989, "supported_languages": null}, "macro.dbt.get_rename_view_sql": {"name": "get_rename_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt.get_rename_view_sql", "macro_sql": "{% macro get_rename_view_sql(relation, new_name) %}\n    {{- adapter.dispatch('get_rename_view_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_rename_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.098264, "supported_languages": null}, "macro.dbt.default__get_rename_view_sql": {"name": "default__get_rename_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt.default__get_rename_view_sql", "macro_sql": "{% macro default__get_rename_view_sql(relation, new_name) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_rename_view_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.098411, "supported_languages": null}, "macro.dbt.get_create_view_as_sql": {"name": "get_create_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.get_create_view_as_sql", "macro_sql": "{% macro get_create_view_as_sql(relation, sql) -%}\n  {{ adapter.dispatch('get_create_view_as_sql', 'dbt')(relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.09883, "supported_languages": null}, "macro.dbt.default__get_create_view_as_sql": {"name": "default__get_create_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.default__get_create_view_as_sql", "macro_sql": "{% macro default__get_create_view_as_sql(relation, sql) -%}\n  {{ return(create_view_as(relation, sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0989969, "supported_languages": null}, "macro.dbt.create_view_as": {"name": "create_view_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n  {{ adapter.dispatch('create_view_as', 'dbt')(relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.099179, "supported_languages": null}, "macro.dbt.default__create_view_as": {"name": "default__create_view_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.default__create_view_as", "macro_sql": "{% macro default__create_view_as(relation, sql) -%}\n  {%- set sql_header = config.get('sql_header', none) -%}\n\n  {{ sql_header if sql_header is not none }}\n  create view {{ relation }}\n    {% set contract_config = config.get('contract') %}\n    {% if contract_config.enforced %}\n      {{ get_assert_columns_equivalent(sql) }}\n    {%- endif %}\n  as (\n    {{ sql }}\n  );\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.0996091, "supported_languages": null}, "macro.dbt.default__test_relationships": {"name": "default__test_relationships", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/relationships.sql", "original_file_path": "macros/generic_test_sql/relationships.sql", "unique_id": "macro.dbt.default__test_relationships", "macro_sql": "{% macro default__test_relationships(model, column_name, to, field) %}\n\nwith child as (\n    select {{ column_name }} as from_field\n    from {{ model }}\n    where {{ column_name }} is not null\n),\n\nparent as (\n    select {{ field }} as to_field\n    from {{ to }}\n)\n\nselect\n    from_field\n\nfrom child\nleft join parent\n    on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.099966, "supported_languages": null}, "macro.dbt.default__test_not_null": {"name": "default__test_not_null", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/not_null.sql", "original_file_path": "macros/generic_test_sql/not_null.sql", "unique_id": "macro.dbt.default__test_not_null", "macro_sql": "{% macro default__test_not_null(model, column_name) %}\n\n{% set column_list = '*' if should_store_failures() else column_name %}\n\nselect {{ column_list }}\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_store_failures"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1002638, "supported_languages": null}, "macro.dbt.default__test_unique": {"name": "default__test_unique", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/unique.sql", "original_file_path": "macros/generic_test_sql/unique.sql", "unique_id": "macro.dbt.default__test_unique", "macro_sql": "{% macro default__test_unique(model, column_name) %}\n\nselect\n    {{ column_name }} as unique_field,\n    count(*) as n_records\n\nfrom {{ model }}\nwhere {{ column_name }} is not null\ngroup by {{ column_name }}\nhaving count(*) > 1\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.100513, "supported_languages": null}, "macro.dbt.default__test_accepted_values": {"name": "default__test_accepted_values", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/accepted_values.sql", "original_file_path": "macros/generic_test_sql/accepted_values.sql", "unique_id": "macro.dbt.default__test_accepted_values", "macro_sql": "{% macro default__test_accepted_values(model, column_name, values, quote=True) %}\n\nwith all_values as (\n\n    select\n        {{ column_name }} as value_field,\n        count(*) as n_records\n\n    from {{ model }}\n    group by {{ column_name }}\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n    {% for value in values -%}\n        {% if quote -%}\n        '{{ value }}'\n        {%- else -%}\n        {{ value }}\n        {%- endif -%}\n        {%- if not loop.last -%},{%- endif %}\n    {%- endfor %}\n)\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.101089, "supported_languages": null}, "macro.dbt.statement": {"name": "statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.statement", "macro_sql": "\n{%- macro statement(name=None, fetch_result=False, auto_begin=True, language='sql') -%}\n  {%- if execute: -%}\n    {%- set compiled_code = caller() -%}\n\n    {%- if name == 'main' -%}\n      {{ log('Writing runtime {} for node \"{}\"'.format(language, model['unique_id'])) }}\n      {{ write(compiled_code) }}\n    {%- endif -%}\n    {%- if language == 'sql'-%}\n      {%- set res, table = adapter.execute(compiled_code, auto_begin=auto_begin, fetch=fetch_result) -%}\n    {%- elif language == 'python' -%}\n      {%- set res = submit_python_job(model, compiled_code) -%}\n      {#-- TODO: What should table be for python models? --#}\n      {%- set table = None -%}\n    {%- else -%}\n      {% do exceptions.raise_compiler_error(\"statement macro didn't get supported language\") %}\n    {%- endif -%}\n\n    {%- if name is not none -%}\n      {{ store_result(name, response=res, agate_table=table) }}\n    {%- endif -%}\n\n  {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.102566, "supported_languages": null}, "macro.dbt.noop_statement": {"name": "noop_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.noop_statement", "macro_sql": "{% macro noop_statement(name=None, message=None, code=None, rows_affected=None, res=None) -%}\n  {%- set sql = caller() -%}\n\n  {%- if name == 'main' -%}\n    {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n    {{ write(sql) }}\n  {%- endif -%}\n\n  {%- if name is not none -%}\n    {{ store_raw_result(name, message=message, code=code, rows_affected=rows_affected, agate_table=res) }}\n  {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.103153, "supported_languages": null}, "macro.dbt.run_query": {"name": "run_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.run_query", "macro_sql": "{% macro run_query(sql) %}\n  {% call statement(\"run_query_statement\", fetch_result=true, auto_begin=false) %}\n    {{ sql }}\n  {% endcall %}\n\n  {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.103449, "supported_languages": null}, "macro.dbt.convert_datetime": {"name": "convert_datetime", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.convert_datetime", "macro_sql": "{% macro convert_datetime(date_str, date_fmt) %}\n\n  {% set error_msg -%}\n      The provided partition date '{{ date_str }}' does not match the expected format '{{ date_fmt }}'\n  {%- endset %}\n\n  {% set res = try_or_compiler_error(error_msg, modules.datetime.datetime.strptime, date_str.strip(), date_fmt) %}\n  {{ return(res) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.105291, "supported_languages": null}, "macro.dbt.dates_in_range": {"name": "dates_in_range", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.dates_in_range", "macro_sql": "{% macro dates_in_range(start_date_str, end_date_str=none, in_fmt=\"%Y%m%d\", out_fmt=\"%Y%m%d\") %}\n    {% set end_date_str = start_date_str if end_date_str is none else end_date_str %}\n\n    {% set start_date = convert_datetime(start_date_str, in_fmt) %}\n    {% set end_date = convert_datetime(end_date_str, in_fmt) %}\n\n    {% set day_count = (end_date - start_date).days %}\n    {% if day_count < 0 %}\n        {% set msg -%}\n            Partition start date is after the end date ({{ start_date }}, {{ end_date }})\n        {%- endset %}\n\n        {{ exceptions.raise_compiler_error(msg, model) }}\n    {% endif %}\n\n    {% set date_list = [] %}\n    {% for i in range(0, day_count + 1) %}\n        {% set the_date = (modules.datetime.timedelta(days=i) + start_date) %}\n        {% if not out_fmt %}\n            {% set _ = date_list.append(the_date) %}\n        {% else %}\n            {% set _ = date_list.append(the_date.strftime(out_fmt)) %}\n        {% endif %}\n    {% endfor %}\n\n    {{ return(date_list) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.convert_datetime"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.106573, "supported_languages": null}, "macro.dbt.partition_range": {"name": "partition_range", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.partition_range", "macro_sql": "{% macro partition_range(raw_partition_date, date_fmt='%Y%m%d') %}\n    {% set partition_range = (raw_partition_date | string).split(\",\") %}\n\n    {% if (partition_range | length) == 1 %}\n      {% set start_date = partition_range[0] %}\n      {% set end_date = none %}\n    {% elif (partition_range | length) == 2 %}\n      {% set start_date = partition_range[0] %}\n      {% set end_date = partition_range[1] %}\n    {% else %}\n      {{ exceptions.raise_compiler_error(\"Invalid partition time. Expected format: {Start Date}[,{End Date}]. Got: \" ~ raw_partition_date) }}\n    {% endif %}\n\n    {{ return(dates_in_range(start_date, end_date, in_fmt=date_fmt)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dates_in_range"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.107337, "supported_languages": null}, "macro.dbt.py_current_timestring": {"name": "py_current_timestring", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.py_current_timestring", "macro_sql": "{% macro py_current_timestring() %}\n    {% set dt = modules.datetime.datetime.now() %}\n    {% do return(dt.strftime(\"%Y%m%d%H%M%S%f\")) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.107572, "supported_languages": null}, "macro.dbt.except": {"name": "except", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/except.sql", "original_file_path": "macros/utils/except.sql", "unique_id": "macro.dbt.except", "macro_sql": "{% macro except() %}\n  {{ return(adapter.dispatch('except', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1078022, "supported_languages": null}, "macro.dbt.default__except": {"name": "default__except", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/except.sql", "original_file_path": "macros/utils/except.sql", "unique_id": "macro.dbt.default__except", "macro_sql": "{% macro default__except() %}\n\n    except\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.107881, "supported_languages": null}, "macro.dbt.get_intervals_between": {"name": "get_intervals_between", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n    {{ return(adapter.dispatch('get_intervals_between', 'dbt')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.108664, "supported_languages": null}, "macro.dbt.default__get_intervals_between": {"name": "default__get_intervals_between", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n    {%- call statement('get_intervals_between', fetch_result=True) %}\n\n        select {{ dbt.datediff(start_date, end_date, datepart) }}\n\n    {%- endcall -%}\n\n    {%- set value_list = load_result('get_intervals_between') -%}\n\n    {%- if value_list and value_list['data'] -%}\n        {%- set values = value_list['data'] | map(attribute=0) | list %}\n        {{ return(values[0]) }}\n    {%- else -%}\n        {{ return(1) }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.109269, "supported_languages": null}, "macro.dbt.date_spine": {"name": "date_spine", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n    {{ return(adapter.dispatch('date_spine', 'dbt')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.109505, "supported_languages": null}, "macro.dbt.default__date_spine": {"name": "default__date_spine", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n    {# call as follows:\n\n    date_spine(\n        \"day\",\n        \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n        \"dbt.dateadd(week, 1, current_date)\"\n    ) #}\n\n\n    with rawdata as (\n\n        {{dbt.generate_series(\n            dbt.get_intervals_between(start_date, end_date, datepart)\n        )}}\n\n    ),\n\n    all_periods as (\n\n        select (\n            {{\n                dbt.dateadd(\n                    datepart,\n                    \"row_number() over (order by 1) - 1\",\n                    start_date\n                )\n            }}\n        ) as date_{{datepart}}\n        from rawdata\n\n    ),\n\n    filtered as (\n\n        select *\n        from all_periods\n        where date_{{datepart}} <= {{ end_date }}\n\n    )\n\n    select * from filtered\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.generate_series", "macro.dbt.get_intervals_between", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.109882, "supported_languages": null}, "macro.dbt.replace": {"name": "replace", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/replace.sql", "original_file_path": "macros/utils/replace.sql", "unique_id": "macro.dbt.replace", "macro_sql": "{% macro replace(field, old_chars, new_chars) -%}\n    {{ return(adapter.dispatch('replace', 'dbt') (field, old_chars, new_chars)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__replace"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.110215, "supported_languages": null}, "macro.dbt.default__replace": {"name": "default__replace", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/replace.sql", "original_file_path": "macros/utils/replace.sql", "unique_id": "macro.dbt.default__replace", "macro_sql": "{% macro default__replace(field, old_chars, new_chars) %}\n\n    replace(\n        {{ field }},\n        {{ old_chars }},\n        {{ new_chars }}\n    )\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.110383, "supported_languages": null}, "macro.dbt.concat": {"name": "concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/concat.sql", "original_file_path": "macros/utils/concat.sql", "unique_id": "macro.dbt.concat", "macro_sql": "{% macro concat(fields) -%}\n  {{ return(adapter.dispatch('concat', 'dbt')(fields)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1106281, "supported_languages": null}, "macro.dbt.default__concat": {"name": "default__concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/concat.sql", "original_file_path": "macros/utils/concat.sql", "unique_id": "macro.dbt.default__concat", "macro_sql": "{% macro default__concat(fields) -%}\n    {{ fields|join(' || ') }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.110755, "supported_languages": null}, "macro.dbt.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n    {{ return(adapter.dispatch('get_powers_of_two', 'dbt')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.111595, "supported_languages": null}, "macro.dbt.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n    {% if upper_bound <= 0 %}\n    {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n    {% endif %}\n\n    {% for _ in range(1, 100) %}\n       {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n    {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1120179, "supported_languages": null}, "macro.dbt.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n    {{ return(adapter.dispatch('generate_series', 'dbt')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.112216, "supported_languages": null}, "macro.dbt.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n    {% set n = dbt.get_powers_of_two(upper_bound) %}\n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    {% for i in range(n) %}\n    p{{i}}.generated_number * power(2, {{i}})\n    {% if not loop.last %} + {% endif %}\n    {% endfor %}\n    + 1\n    as generated_number\n\n    from\n\n    {% for i in range(n) %}\n    p as p{{i}}\n    {% if not loop.last %} cross join {% endif %}\n    {% endfor %}\n\n    )\n\n    select *\n    from unioned\n    where generated_number <= {{upper_bound}}\n    order by generated_number\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.112743, "supported_languages": null}, "macro.dbt.length": {"name": "length", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/length.sql", "original_file_path": "macros/utils/length.sql", "unique_id": "macro.dbt.length", "macro_sql": "{% macro length(expression) -%}\n    {{ return(adapter.dispatch('length', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__length"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1130009, "supported_languages": null}, "macro.dbt.default__length": {"name": "default__length", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/length.sql", "original_file_path": "macros/utils/length.sql", "unique_id": "macro.dbt.default__length", "macro_sql": "{% macro default__length(expression) %}\n\n    length(\n        {{ expression }}\n    )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1131089, "supported_languages": null}, "macro.dbt.dateadd": {"name": "dateadd", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/dateadd.sql", "original_file_path": "macros/utils/dateadd.sql", "unique_id": "macro.dbt.dateadd", "macro_sql": "{% macro dateadd(datepart, interval, from_date_or_timestamp) %}\n  {{ return(adapter.dispatch('dateadd', 'dbt')(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1134489, "supported_languages": null}, "macro.dbt.default__dateadd": {"name": "default__dateadd", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/dateadd.sql", "original_file_path": "macros/utils/dateadd.sql", "unique_id": "macro.dbt.default__dateadd", "macro_sql": "{% macro default__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n    dateadd(\n        {{ datepart }},\n        {{ interval }},\n        {{ from_date_or_timestamp }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1136231, "supported_languages": null}, "macro.dbt.intersect": {"name": "intersect", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/intersect.sql", "original_file_path": "macros/utils/intersect.sql", "unique_id": "macro.dbt.intersect", "macro_sql": "{% macro intersect() %}\n  {{ return(adapter.dispatch('intersect', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__intersect"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.113847, "supported_languages": null}, "macro.dbt.default__intersect": {"name": "default__intersect", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/intersect.sql", "original_file_path": "macros/utils/intersect.sql", "unique_id": "macro.dbt.default__intersect", "macro_sql": "{% macro default__intersect() %}\n\n    intersect\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.113993, "supported_languages": null}, "macro.dbt.escape_single_quotes": {"name": "escape_single_quotes", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt.escape_single_quotes", "macro_sql": "{% macro escape_single_quotes(expression) %}\n      {{ return(adapter.dispatch('escape_single_quotes', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__escape_single_quotes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.114259, "supported_languages": null}, "macro.dbt.default__escape_single_quotes": {"name": "default__escape_single_quotes", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt.default__escape_single_quotes", "macro_sql": "{% macro default__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\",\"''\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.114402, "supported_languages": null}, "macro.dbt.right": {"name": "right", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt.right", "macro_sql": "{% macro right(string_text, length_expression) -%}\n    {{ return(adapter.dispatch('right', 'dbt') (string_text, length_expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__right"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.114696, "supported_languages": null}, "macro.dbt.default__right": {"name": "default__right", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt.default__right", "macro_sql": "{% macro default__right(string_text, length_expression) %}\n\n    right(\n        {{ string_text }},\n        {{ length_expression }}\n    )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.114835, "supported_languages": null}, "macro.dbt.listagg": {"name": "listagg", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/listagg.sql", "original_file_path": "macros/utils/listagg.sql", "unique_id": "macro.dbt.listagg", "macro_sql": "{% macro listagg(measure, delimiter_text=\"','\", order_by_clause=none, limit_num=none) -%}\n    {{ return(adapter.dispatch('listagg', 'dbt') (measure, delimiter_text, order_by_clause, limit_num)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__listagg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.115475, "supported_languages": null}, "macro.dbt.default__listagg": {"name": "default__listagg", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/listagg.sql", "original_file_path": "macros/utils/listagg.sql", "unique_id": "macro.dbt.default__listagg", "macro_sql": "{% macro default__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n    {% if limit_num -%}\n    array_to_string(\n        array_slice(\n            array_agg(\n                {{ measure }}\n            ){% if order_by_clause -%}\n            within group ({{ order_by_clause }})\n            {%- endif %}\n            ,0\n            ,{{ limit_num }}\n        ),\n        {{ delimiter_text }}\n        )\n    {%- else %}\n    listagg(\n        {{ measure }},\n        {{ delimiter_text }}\n        )\n        {% if order_by_clause -%}\n        within group ({{ order_by_clause }})\n        {%- endif %}\n    {%- endif %}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.115926, "supported_languages": null}, "macro.dbt.datediff": {"name": "datediff", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/datediff.sql", "original_file_path": "macros/utils/datediff.sql", "unique_id": "macro.dbt.datediff", "macro_sql": "{% macro datediff(first_date, second_date, datepart) %}\n  {{ return(adapter.dispatch('datediff', 'dbt')(first_date, second_date, datepart)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.116267, "supported_languages": null}, "macro.dbt.default__datediff": {"name": "default__datediff", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/datediff.sql", "original_file_path": "macros/utils/datediff.sql", "unique_id": "macro.dbt.default__datediff", "macro_sql": "{% macro default__datediff(first_date, second_date, datepart) -%}\n\n    datediff(\n        {{ datepart }},\n        {{ first_date }},\n        {{ second_date }}\n        )\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.11644, "supported_languages": null}, "macro.dbt.safe_cast": {"name": "safe_cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt.safe_cast", "macro_sql": "{% macro safe_cast(field, type) %}\n  {{ return(adapter.dispatch('safe_cast', 'dbt') (field, type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1167302, "supported_languages": null}, "macro.dbt.default__safe_cast": {"name": "default__safe_cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt.default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n    {# most databases don't support this function yet\n    so we just need to use cast #}\n    cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1168761, "supported_languages": null}, "macro.dbt.hash": {"name": "hash", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/hash.sql", "original_file_path": "macros/utils/hash.sql", "unique_id": "macro.dbt.hash", "macro_sql": "{% macro hash(field) -%}\n  {{ return(adapter.dispatch('hash', 'dbt') (field)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.117135, "supported_languages": null}, "macro.dbt.default__hash": {"name": "default__hash", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/hash.sql", "original_file_path": "macros/utils/hash.sql", "unique_id": "macro.dbt.default__hash", "macro_sql": "{% macro default__hash(field) -%}\n    md5(cast({{ field }} as {{ api.Column.translate_type('string') }}))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1173, "supported_languages": null}, "macro.dbt.cast_bool_to_text": {"name": "cast_bool_to_text", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast_bool_to_text.sql", "original_file_path": "macros/utils/cast_bool_to_text.sql", "unique_id": "macro.dbt.cast_bool_to_text", "macro_sql": "{% macro cast_bool_to_text(field) %}\n  {{ adapter.dispatch('cast_bool_to_text', 'dbt') (field) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.117545, "supported_languages": null}, "macro.dbt.default__cast_bool_to_text": {"name": "default__cast_bool_to_text", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast_bool_to_text.sql", "original_file_path": "macros/utils/cast_bool_to_text.sql", "unique_id": "macro.dbt.default__cast_bool_to_text", "macro_sql": "{% macro default__cast_bool_to_text(field) %}\n    cast({{ field }} as {{ api.Column.translate_type('string') }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.117708, "supported_languages": null}, "macro.dbt.any_value": {"name": "any_value", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/any_value.sql", "original_file_path": "macros/utils/any_value.sql", "unique_id": "macro.dbt.any_value", "macro_sql": "{% macro any_value(expression) -%}\n    {{ return(adapter.dispatch('any_value', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__any_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.117957, "supported_languages": null}, "macro.dbt.default__any_value": {"name": "default__any_value", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/any_value.sql", "original_file_path": "macros/utils/any_value.sql", "unique_id": "macro.dbt.default__any_value", "macro_sql": "{% macro default__any_value(expression) -%}\n\n    any_value({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1180658, "supported_languages": null}, "macro.dbt.position": {"name": "position", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/position.sql", "original_file_path": "macros/utils/position.sql", "unique_id": "macro.dbt.position", "macro_sql": "{% macro position(substring_text, string_text) -%}\n    {{ return(adapter.dispatch('position', 'dbt') (substring_text, string_text)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__position"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.118357, "supported_languages": null}, "macro.dbt.default__position": {"name": "default__position", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/position.sql", "original_file_path": "macros/utils/position.sql", "unique_id": "macro.dbt.default__position", "macro_sql": "{% macro default__position(substring_text, string_text) %}\n\n    position(\n        {{ substring_text }} in {{ string_text }}\n    )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1184928, "supported_languages": null}, "macro.dbt.string_literal": {"name": "string_literal", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/literal.sql", "original_file_path": "macros/utils/literal.sql", "unique_id": "macro.dbt.string_literal", "macro_sql": "{%- macro string_literal(value) -%}\n  {{ return(adapter.dispatch('string_literal', 'dbt') (value)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__string_literal"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.118739, "supported_languages": null}, "macro.dbt.default__string_literal": {"name": "default__string_literal", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/literal.sql", "original_file_path": "macros/utils/literal.sql", "unique_id": "macro.dbt.default__string_literal", "macro_sql": "{% macro default__string_literal(value) -%}\n    '{{ value }}'\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.118901, "supported_languages": null}, "macro.dbt.type_string": {"name": "type_string", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_string", "macro_sql": "\n\n{%- macro type_string() -%}\n  {{ return(adapter.dispatch('type_string', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1198668, "supported_languages": null}, "macro.dbt.default__type_string": {"name": "default__type_string", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_string", "macro_sql": "{% macro default__type_string() %}\n    {{ return(api.Column.translate_type(\"string\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.120023, "supported_languages": null}, "macro.dbt.type_timestamp": {"name": "type_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_timestamp", "macro_sql": "\n\n{%- macro type_timestamp() -%}\n  {{ return(adapter.dispatch('type_timestamp', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.120194, "supported_languages": null}, "macro.dbt.default__type_timestamp": {"name": "default__type_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_timestamp", "macro_sql": "{% macro default__type_timestamp() %}\n    {{ return(api.Column.translate_type(\"timestamp\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.120348, "supported_languages": null}, "macro.dbt.type_float": {"name": "type_float", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_float", "macro_sql": "\n\n{%- macro type_float() -%}\n  {{ return(adapter.dispatch('type_float', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_float"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.120512, "supported_languages": null}, "macro.dbt.default__type_float": {"name": "default__type_float", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_float", "macro_sql": "{% macro default__type_float() %}\n    {{ return(api.Column.translate_type(\"float\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.120665, "supported_languages": null}, "macro.dbt.type_numeric": {"name": "type_numeric", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_numeric", "macro_sql": "\n\n{%- macro type_numeric() -%}\n  {{ return(adapter.dispatch('type_numeric', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.12083, "supported_languages": null}, "macro.dbt.default__type_numeric": {"name": "default__type_numeric", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_numeric", "macro_sql": "{% macro default__type_numeric() %}\n    {{ return(api.Column.numeric_type(\"numeric\", 28, 6)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.121016, "supported_languages": null}, "macro.dbt.type_bigint": {"name": "type_bigint", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_bigint", "macro_sql": "\n\n{%- macro type_bigint() -%}\n  {{ return(adapter.dispatch('type_bigint', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1211789, "supported_languages": null}, "macro.dbt.default__type_bigint": {"name": "default__type_bigint", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_bigint", "macro_sql": "{% macro default__type_bigint() %}\n    {{ return(api.Column.translate_type(\"bigint\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.121333, "supported_languages": null}, "macro.dbt.type_int": {"name": "type_int", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_int", "macro_sql": "\n\n{%- macro type_int() -%}\n  {{ return(adapter.dispatch('type_int', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.121505, "supported_languages": null}, "macro.dbt.default__type_int": {"name": "default__type_int", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_int", "macro_sql": "{%- macro default__type_int() -%}\n  {{ return(api.Column.translate_type(\"integer\")) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.121652, "supported_languages": null}, "macro.dbt.type_boolean": {"name": "type_boolean", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_boolean", "macro_sql": "\n\n{%- macro type_boolean() -%}\n  {{ return(adapter.dispatch('type_boolean', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_boolean"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.121811, "supported_languages": null}, "macro.dbt.default__type_boolean": {"name": "default__type_boolean", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_boolean", "macro_sql": "{%- macro default__type_boolean() -%}\n  {{ return(api.Column.translate_type(\"boolean\")) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.121959, "supported_languages": null}, "macro.dbt.array_concat": {"name": "array_concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_concat.sql", "original_file_path": "macros/utils/array_concat.sql", "unique_id": "macro.dbt.array_concat", "macro_sql": "{% macro array_concat(array_1, array_2) -%}\n  {{ return(adapter.dispatch('array_concat', 'dbt')(array_1, array_2)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__array_concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1222348, "supported_languages": null}, "macro.dbt.default__array_concat": {"name": "default__array_concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_concat.sql", "original_file_path": "macros/utils/array_concat.sql", "unique_id": "macro.dbt.default__array_concat", "macro_sql": "{% macro default__array_concat(array_1, array_2) -%}\n    array_cat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.122373, "supported_languages": null}, "macro.dbt.bool_or": {"name": "bool_or", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt.bool_or", "macro_sql": "{% macro bool_or(expression) -%}\n    {{ return(adapter.dispatch('bool_or', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__bool_or"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1226208, "supported_languages": null}, "macro.dbt.default__bool_or": {"name": "default__bool_or", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt.default__bool_or", "macro_sql": "{% macro default__bool_or(expression) -%}\n\n    bool_or({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.122726, "supported_languages": null}, "macro.dbt.last_day": {"name": "last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.last_day", "macro_sql": "{% macro last_day(date, datepart) %}\n  {{ return(adapter.dispatch('last_day', 'dbt') (date, datepart)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.123065, "supported_languages": null}, "macro.dbt.default_last_day": {"name": "default_last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.default_last_day", "macro_sql": "\n\n{%- macro default_last_day(date, datepart) -%}\n    cast(\n        {{dbt.dateadd('day', '-1',\n        dbt.dateadd(datepart, '1', dbt.date_trunc(datepart, date))\n        )}}\n        as date)\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.123405, "supported_languages": null}, "macro.dbt.default__last_day": {"name": "default__last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.default__last_day", "macro_sql": "{% macro default__last_day(date, datepart) -%}\n    {{dbt.default_last_day(date, datepart)}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.123557, "supported_languages": null}, "macro.dbt.split_part": {"name": "split_part", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt.split_part", "macro_sql": "{% macro split_part(string_text, delimiter_text, part_number) %}\n  {{ return(adapter.dispatch('split_part', 'dbt') (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__split_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.124089, "supported_languages": null}, "macro.dbt.default__split_part": {"name": "default__split_part", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt.default__split_part", "macro_sql": "{% macro default__split_part(string_text, delimiter_text, part_number) %}\n\n    split_part(\n        {{ string_text }},\n        {{ delimiter_text }},\n        {{ part_number }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.124258, "supported_languages": null}, "macro.dbt._split_part_negative": {"name": "_split_part_negative", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt._split_part_negative", "macro_sql": "{% macro _split_part_negative(string_text, delimiter_text, part_number) %}\n\n    split_part(\n        {{ string_text }},\n        {{ delimiter_text }},\n          length({{ string_text }})\n          - length(\n              replace({{ string_text }},  {{ delimiter_text }}, '')\n          ) + 2 + {{ part_number }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.124485, "supported_languages": null}, "macro.dbt.date_trunc": {"name": "date_trunc", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_trunc.sql", "original_file_path": "macros/utils/date_trunc.sql", "unique_id": "macro.dbt.date_trunc", "macro_sql": "{% macro date_trunc(datepart, date) -%}\n  {{ return(adapter.dispatch('date_trunc', 'dbt') (datepart, date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.124761, "supported_languages": null}, "macro.dbt.default__date_trunc": {"name": "default__date_trunc", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_trunc.sql", "original_file_path": "macros/utils/date_trunc.sql", "unique_id": "macro.dbt.default__date_trunc", "macro_sql": "{% macro default__date_trunc(datepart, date) -%}\n    date_trunc('{{datepart}}', {{date}})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.124894, "supported_languages": null}, "macro.dbt.array_construct": {"name": "array_construct", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt.array_construct", "macro_sql": "{% macro array_construct(inputs=[], data_type=api.Column.translate_type('integer')) -%}\n  {{ return(adapter.dispatch('array_construct', 'dbt')(inputs, data_type)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__array_construct"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.125269, "supported_languages": null}, "macro.dbt.default__array_construct": {"name": "default__array_construct", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt.default__array_construct", "macro_sql": "{% macro default__array_construct(inputs, data_type) -%}\n    {% if inputs|length > 0 %}\n    array[ {{ inputs|join(' , ') }} ]\n    {% else %}\n    array[]::{{data_type}}[]\n    {% endif %}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.125514, "supported_languages": null}, "macro.dbt.array_append": {"name": "array_append", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_append.sql", "original_file_path": "macros/utils/array_append.sql", "unique_id": "macro.dbt.array_append", "macro_sql": "{% macro array_append(array, new_element) -%}\n  {{ return(adapter.dispatch('array_append', 'dbt')(array, new_element)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__array_append"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.125797, "supported_languages": null}, "macro.dbt.default__array_append": {"name": "default__array_append", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_append.sql", "original_file_path": "macros/utils/array_append.sql", "unique_id": "macro.dbt.default__array_append", "macro_sql": "{% macro default__array_append(array, new_element) -%}\n    array_append({{ array }}, {{ new_element }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.125931, "supported_languages": null}, "macro.dbt.create_schema": {"name": "create_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n  {{ adapter.dispatch('create_schema', 'dbt')(relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.126303, "supported_languages": null}, "macro.dbt.default__create_schema": {"name": "default__create_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.default__create_schema", "macro_sql": "{% macro default__create_schema(relation) -%}\n  {%- call statement('create_schema') -%}\n    create schema if not exists {{ relation.without_identifier() }}\n  {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.12649, "supported_languages": null}, "macro.dbt.drop_schema": {"name": "drop_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n  {{ adapter.dispatch('drop_schema', 'dbt')(relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.126653, "supported_languages": null}, "macro.dbt.default__drop_schema": {"name": "default__drop_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.default__drop_schema", "macro_sql": "{% macro default__drop_schema(relation) -%}\n  {%- call statement('drop_schema') -%}\n    drop schema if exists {{ relation.without_identifier() }} cascade\n  {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.126838, "supported_languages": null}, "macro.dbt.current_timestamp": {"name": "current_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp", "macro_sql": "{%- macro current_timestamp() -%}\n    {{ adapter.dispatch('current_timestamp', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.127326, "supported_languages": null}, "macro.dbt.default__current_timestamp": {"name": "default__current_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() -%}\n  {{ exceptions.raise_not_implemented(\n    'current_timestamp macro not implemented for adapter ' + adapter.type()) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.127479, "supported_languages": null}, "macro.dbt.snapshot_get_time": {"name": "snapshot_get_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.snapshot_get_time", "macro_sql": "\n\n{%- macro snapshot_get_time() -%}\n    {{ adapter.dispatch('snapshot_get_time', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.127622, "supported_languages": null}, "macro.dbt.default__snapshot_get_time": {"name": "default__snapshot_get_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__snapshot_get_time", "macro_sql": "{% macro default__snapshot_get_time() %}\n    {{ current_timestamp() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.127727, "supported_languages": null}, "macro.dbt.current_timestamp_backcompat": {"name": "current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp_backcompat", "macro_sql": "{% macro current_timestamp_backcompat() %}\n    {{ return(adapter.dispatch('current_timestamp_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__current_timestamp_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1278908, "supported_languages": null}, "macro.dbt.default__current_timestamp_backcompat": {"name": "default__current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp_backcompat", "macro_sql": "{% macro default__current_timestamp_backcompat() %}\n    current_timestamp::timestamp\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.127968, "supported_languages": null}, "macro.dbt.current_timestamp_in_utc_backcompat": {"name": "current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp_in_utc_backcompat", "macro_sql": "{% macro current_timestamp_in_utc_backcompat() %}\n    {{ return(adapter.dispatch('current_timestamp_in_utc_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__current_timestamp_in_utc_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.128201, "supported_languages": null}, "macro.dbt.default__current_timestamp_in_utc_backcompat": {"name": "default__current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp_in_utc_backcompat", "macro_sql": "{% macro default__current_timestamp_in_utc_backcompat() %}\n    {{ return(adapter.dispatch('current_timestamp_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp_backcompat", "macro.dbt_snowflake.snowflake__current_timestamp_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.128372, "supported_languages": null}, "macro.dbt.get_create_index_sql": {"name": "get_create_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_create_index_sql", "macro_sql": "{% macro get_create_index_sql(relation, index_dict) -%}\n  {{ return(adapter.dispatch('get_create_index_sql', 'dbt')(relation, index_dict)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.129209, "supported_languages": null}, "macro.dbt.default__get_create_index_sql": {"name": "default__get_create_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_create_index_sql", "macro_sql": "{% macro default__get_create_index_sql(relation, index_dict) -%}\n  {% do return(None) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.129344, "supported_languages": null}, "macro.dbt.create_indexes": {"name": "create_indexes", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.create_indexes", "macro_sql": "{% macro create_indexes(relation) -%}\n  {{ adapter.dispatch('create_indexes', 'dbt')(relation) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1295009, "supported_languages": null}, "macro.dbt.default__create_indexes": {"name": "default__create_indexes", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__create_indexes", "macro_sql": "{% macro default__create_indexes(relation) -%}\n  {%- set _indexes = config.get('indexes', default=[]) -%}\n\n  {% for _index_dict in _indexes %}\n    {% set create_index_sql = get_create_index_sql(relation, _index_dict) %}\n    {% if create_index_sql %}\n      {% do run_query(create_index_sql) %}\n    {% endif %}\n  {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_create_index_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.129916, "supported_languages": null}, "macro.dbt.get_drop_index_sql": {"name": "get_drop_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_drop_index_sql", "macro_sql": "{% macro get_drop_index_sql(relation, index_name) -%}\n    {{ adapter.dispatch('get_drop_index_sql', 'dbt')(relation, index_name) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_drop_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.130107, "supported_languages": null}, "macro.dbt.default__get_drop_index_sql": {"name": "default__get_drop_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_drop_index_sql", "macro_sql": "{% macro default__get_drop_index_sql(relation, index_name) -%}\n    {{ exceptions.raise_compiler_error(\"`get_drop_index_sql has not been implemented for this adapter.\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1302452, "supported_languages": null}, "macro.dbt.get_show_indexes_sql": {"name": "get_show_indexes_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_show_indexes_sql", "macro_sql": "{% macro get_show_indexes_sql(relation) -%}\n    {{ adapter.dispatch('get_show_indexes_sql', 'dbt')(relation) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_show_indexes_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1304152, "supported_languages": null}, "macro.dbt.default__get_show_indexes_sql": {"name": "default__get_show_indexes_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_show_indexes_sql", "macro_sql": "{% macro default__get_show_indexes_sql(relation) -%}\n    {{ exceptions.raise_compiler_error(\"`get_show_indexes_sql has not been implemented for this adapter.\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.130542, "supported_languages": null}, "macro.dbt.make_intermediate_relation": {"name": "make_intermediate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_intermediate_relation", "macro_sql": "{% macro make_intermediate_relation(base_relation, suffix='__dbt_tmp') %}\n  {{ return(adapter.dispatch('make_intermediate_relation', 'dbt')(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_intermediate_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1325362, "supported_languages": null}, "macro.dbt.default__make_intermediate_relation": {"name": "default__make_intermediate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_intermediate_relation", "macro_sql": "{% macro default__make_intermediate_relation(base_relation, suffix) %}\n    {{ return(default__make_temp_relation(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1327202, "supported_languages": null}, "macro.dbt.make_temp_relation": {"name": "make_temp_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n  {{ return(adapter.dispatch('make_temp_relation', 'dbt')(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1329432, "supported_languages": null}, "macro.dbt.default__make_temp_relation": {"name": "default__make_temp_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_temp_relation", "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n    {%- set temp_identifier = base_relation.identifier ~ suffix -%}\n    {%- set temp_relation = base_relation.incorporate(\n                                path={\"identifier\": temp_identifier}) -%}\n\n    {{ return(temp_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.133248, "supported_languages": null}, "macro.dbt.make_backup_relation": {"name": "make_backup_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_backup_relation", "macro_sql": "{% macro make_backup_relation(base_relation, backup_relation_type, suffix='__dbt_backup') %}\n    {{ return(adapter.dispatch('make_backup_relation', 'dbt')(base_relation, backup_relation_type, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_backup_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.133493, "supported_languages": null}, "macro.dbt.default__make_backup_relation": {"name": "default__make_backup_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_backup_relation", "macro_sql": "{% macro default__make_backup_relation(base_relation, backup_relation_type, suffix) %}\n    {%- set backup_identifier = base_relation.identifier ~ suffix -%}\n    {%- set backup_relation = base_relation.incorporate(\n                                  path={\"identifier\": backup_identifier},\n                                  type=backup_relation_type\n    ) -%}\n    {{ return(backup_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.133815, "supported_languages": null}, "macro.dbt.truncate_relation": {"name": "truncate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.truncate_relation", "macro_sql": "{% macro truncate_relation(relation) -%}\n  {{ return(adapter.dispatch('truncate_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__truncate_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.134, "supported_languages": null}, "macro.dbt.default__truncate_relation": {"name": "default__truncate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__truncate_relation", "macro_sql": "{% macro default__truncate_relation(relation) -%}\n  {% call statement('truncate_relation') -%}\n    truncate table {{ relation }}\n  {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1341639, "supported_languages": null}, "macro.dbt.get_or_create_relation": {"name": "get_or_create_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.get_or_create_relation", "macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) -%}\n  {{ return(adapter.dispatch('get_or_create_relation', 'dbt')(database, schema, identifier, type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_or_create_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1344168, "supported_languages": null}, "macro.dbt.default__get_or_create_relation": {"name": "default__get_or_create_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__get_or_create_relation", "macro_sql": "{% macro default__get_or_create_relation(database, schema, identifier, type) %}\n  {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n  {% if target_relation %}\n    {% do return([true, target_relation]) %}\n  {% endif %}\n\n  {%- set new_relation = api.Relation.create(\n      database=database,\n      schema=schema,\n      identifier=identifier,\n      type=type\n  ) -%}\n  {% do return([false, new_relation]) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.135039, "supported_languages": null}, "macro.dbt.load_cached_relation": {"name": "load_cached_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.load_cached_relation", "macro_sql": "{% macro load_cached_relation(relation) %}\n  {% do return(adapter.get_relation(\n    database=relation.database,\n    schema=relation.schema,\n    identifier=relation.identifier\n  )) -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.135272, "supported_languages": null}, "macro.dbt.load_relation": {"name": "load_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.load_relation", "macro_sql": "{% macro load_relation(relation) %}\n    {{ return(load_cached_relation(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.135416, "supported_languages": null}, "macro.dbt.collect_freshness": {"name": "collect_freshness", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "unique_id": "macro.dbt.collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n  {{ return(adapter.dispatch('collect_freshness', 'dbt')(source, loaded_at_field, filter))}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1358342, "supported_languages": null}, "macro.dbt.default__collect_freshness": {"name": "default__collect_freshness", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "unique_id": "macro.dbt.default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n  {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n    select\n      max({{ loaded_at_field }}) as max_loaded_at,\n      {{ current_timestamp() }} as snapshotted_at\n    from {{ source }}\n    {% if filter %}\n    where {{ filter }}\n    {% endif %}\n  {% endcall %}\n  {{ return(load_result('collect_freshness')) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.136252, "supported_languages": null}, "macro.dbt.validate_sql": {"name": "validate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/validate_sql.sql", "original_file_path": "macros/adapters/validate_sql.sql", "unique_id": "macro.dbt.validate_sql", "macro_sql": "{% macro validate_sql(sql) -%}\n  {{ return(adapter.dispatch('validate_sql', 'dbt')(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__validate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.136535, "supported_languages": null}, "macro.dbt.default__validate_sql": {"name": "default__validate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/validate_sql.sql", "original_file_path": "macros/adapters/validate_sql.sql", "unique_id": "macro.dbt.default__validate_sql", "macro_sql": "{% macro default__validate_sql(sql) -%}\n  {% call statement('validate_sql') -%}\n    explain {{ sql }}\n  {% endcall %}\n  {{ return(load_result('validate_sql')) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1367629, "supported_languages": null}, "macro.dbt.copy_grants": {"name": "copy_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.copy_grants", "macro_sql": "{% macro copy_grants() %}\n    {{ return(adapter.dispatch('copy_grants', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__copy_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1384692, "supported_languages": null}, "macro.dbt.default__copy_grants": {"name": "default__copy_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__copy_grants", "macro_sql": "{% macro default__copy_grants() %}\n    {{ return(True) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1385899, "supported_languages": null}, "macro.dbt.support_multiple_grantees_per_dcl_statement": {"name": "support_multiple_grantees_per_dcl_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.support_multiple_grantees_per_dcl_statement", "macro_sql": "{% macro support_multiple_grantees_per_dcl_statement() %}\n    {{ return(adapter.dispatch('support_multiple_grantees_per_dcl_statement', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__support_multiple_grantees_per_dcl_statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1387599, "supported_languages": null}, "macro.dbt.default__support_multiple_grantees_per_dcl_statement": {"name": "default__support_multiple_grantees_per_dcl_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__support_multiple_grantees_per_dcl_statement", "macro_sql": "\n\n{%- macro default__support_multiple_grantees_per_dcl_statement() -%}\n    {{ return(True) }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.138874, "supported_languages": null}, "macro.dbt.should_revoke": {"name": "should_revoke", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.should_revoke", "macro_sql": "{% macro should_revoke(existing_relation, full_refresh_mode=True) %}\n\n    {% if not existing_relation %}\n        {#-- The table doesn't already exist, so no grants to copy over --#}\n        {{ return(False) }}\n    {% elif full_refresh_mode %}\n        {#-- The object is being REPLACED -- whether grants are copied over depends on the value of user config --#}\n        {{ return(copy_grants()) }}\n    {% else %}\n        {#-- The table is being merged/upserted/inserted -- grants will be carried over --#}\n        {{ return(True) }}\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.copy_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.139222, "supported_languages": null}, "macro.dbt.get_show_grant_sql": {"name": "get_show_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_show_grant_sql", "macro_sql": "{% macro get_show_grant_sql(relation) %}\n    {{ return(adapter.dispatch(\"get_show_grant_sql\", \"dbt\")(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_show_grant_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.139414, "supported_languages": null}, "macro.dbt.default__get_show_grant_sql": {"name": "default__get_show_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_show_grant_sql", "macro_sql": "{% macro default__get_show_grant_sql(relation) %}\n    show grants on {{ relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.139519, "supported_languages": null}, "macro.dbt.get_grant_sql": {"name": "get_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_grant_sql", "macro_sql": "{% macro get_grant_sql(relation, privilege, grantees) %}\n    {{ return(adapter.dispatch('get_grant_sql', 'dbt')(relation, privilege, grantees)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_grant_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.139748, "supported_languages": null}, "macro.dbt.default__get_grant_sql": {"name": "default__get_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_grant_sql", "macro_sql": "\n\n{%- macro default__get_grant_sql(relation, privilege, grantees) -%}\n    grant {{ privilege }} on {{ relation }} to {{ grantees | join(', ') }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.139947, "supported_languages": null}, "macro.dbt.get_revoke_sql": {"name": "get_revoke_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_revoke_sql", "macro_sql": "{% macro get_revoke_sql(relation, privilege, grantees) %}\n    {{ return(adapter.dispatch('get_revoke_sql', 'dbt')(relation, privilege, grantees)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_revoke_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.140179, "supported_languages": null}, "macro.dbt.default__get_revoke_sql": {"name": "default__get_revoke_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_revoke_sql", "macro_sql": "\n\n{%- macro default__get_revoke_sql(relation, privilege, grantees) -%}\n    revoke {{ privilege }} on {{ relation }} from {{ grantees | join(', ') }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.14037, "supported_languages": null}, "macro.dbt.get_dcl_statement_list": {"name": "get_dcl_statement_list", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_dcl_statement_list", "macro_sql": "{% macro get_dcl_statement_list(relation, grant_config, get_dcl_macro) %}\n    {{ return(adapter.dispatch('get_dcl_statement_list', 'dbt')(relation, grant_config, get_dcl_macro)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_dcl_statement_list"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.140598, "supported_languages": null}, "macro.dbt.default__get_dcl_statement_list": {"name": "default__get_dcl_statement_list", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_dcl_statement_list", "macro_sql": "\n\n{%- macro default__get_dcl_statement_list(relation, grant_config, get_dcl_macro) -%}\n    {#\n      -- Unpack grant_config into specific privileges and the set of users who need them granted/revoked.\n      -- Depending on whether this database supports multiple grantees per statement, pass in the list of\n      -- all grantees per privilege, or (if not) template one statement per privilege-grantee pair.\n      -- `get_dcl_macro` will be either `get_grant_sql` or `get_revoke_sql`\n    #}\n    {%- set dcl_statements = [] -%}\n    {%- for privilege, grantees in grant_config.items() %}\n        {%- if support_multiple_grantees_per_dcl_statement() and grantees -%}\n          {%- set dcl = get_dcl_macro(relation, privilege, grantees) -%}\n          {%- do dcl_statements.append(dcl) -%}\n        {%- else -%}\n          {%- for grantee in grantees -%}\n              {% set dcl = get_dcl_macro(relation, privilege, [grantee]) %}\n              {%- do dcl_statements.append(dcl) -%}\n          {% endfor -%}\n        {%- endif -%}\n    {%- endfor -%}\n    {{ return(dcl_statements) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.support_multiple_grantees_per_dcl_statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1413481, "supported_languages": null}, "macro.dbt.call_dcl_statements": {"name": "call_dcl_statements", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.call_dcl_statements", "macro_sql": "{% macro call_dcl_statements(dcl_statement_list) %}\n    {{ return(adapter.dispatch(\"call_dcl_statements\", \"dbt\")(dcl_statement_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__call_dcl_statements"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.141541, "supported_languages": null}, "macro.dbt.default__call_dcl_statements": {"name": "default__call_dcl_statements", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__call_dcl_statements", "macro_sql": "{% macro default__call_dcl_statements(dcl_statement_list) %}\n    {#\n      -- By default, supply all grant + revoke statements in a single semicolon-separated block,\n      -- so that they're all processed together.\n\n      -- Some databases do not support this. Those adapters will need to override this macro\n      -- to run each statement individually.\n    #}\n    {% call statement('grants') %}\n        {% for dcl_statement in dcl_statement_list %}\n            {{ dcl_statement }};\n        {% endfor %}\n    {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1417868, "supported_languages": null}, "macro.dbt.apply_grants": {"name": "apply_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.apply_grants", "macro_sql": "{% macro apply_grants(relation, grant_config, should_revoke) %}\n    {{ return(adapter.dispatch(\"apply_grants\", \"dbt\")(relation, grant_config, should_revoke)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.142028, "supported_languages": null}, "macro.dbt.default__apply_grants": {"name": "default__apply_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__apply_grants", "macro_sql": "{% macro default__apply_grants(relation, grant_config, should_revoke=True) %}\n    {#-- If grant_config is {} or None, this is a no-op --#}\n    {% if grant_config %}\n        {% if should_revoke %}\n            {#-- We think previous grants may have carried over --#}\n            {#-- Show current grants and calculate diffs --#}\n            {% set current_grants_table = run_query(get_show_grant_sql(relation)) %}\n            {% set current_grants_dict = adapter.standardize_grants_dict(current_grants_table) %}\n            {% set needs_granting = diff_of_two_dicts(grant_config, current_grants_dict) %}\n            {% set needs_revoking = diff_of_two_dicts(current_grants_dict, grant_config) %}\n            {% if not (needs_granting or needs_revoking) %}\n                {{ log('On ' ~ relation ~': All grants are in place, no revocation or granting needed.')}}\n            {% endif %}\n        {% else %}\n            {#-- We don't think there's any chance of previous grants having carried over. --#}\n            {#-- Jump straight to granting what the user has configured. --#}\n            {% set needs_revoking = {} %}\n            {% set needs_granting = grant_config %}\n        {% endif %}\n        {% if needs_granting or needs_revoking %}\n            {% set revoke_statement_list = get_dcl_statement_list(relation, needs_revoking, get_revoke_sql) %}\n            {% set grant_statement_list = get_dcl_statement_list(relation, needs_granting, get_grant_sql) %}\n            {% set dcl_statement_list = revoke_statement_list + grant_statement_list %}\n            {% if dcl_statement_list %}\n                {{ call_dcl_statements(dcl_statement_list) }}\n            {% endif %}\n        {% endif %}\n    {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.get_show_grant_sql", "macro.dbt.get_dcl_statement_list", "macro.dbt.call_dcl_statements"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.143178, "supported_languages": null}, "macro.dbt.get_show_sql": {"name": "get_show_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.get_show_sql", "macro_sql": "{% macro get_show_sql(compiled_code, sql_header, limit) -%}\n  {%- if sql_header -%}\n  {{ sql_header }}\n  {%- endif -%}\n  {%- if limit is not none -%}\n  {{ get_limit_subquery_sql(compiled_code, limit) }}\n  {%- else -%}\n  {{ compiled_code }}\n  {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_limit_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.143709, "supported_languages": null}, "macro.dbt.get_limit_subquery_sql": {"name": "get_limit_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.get_limit_subquery_sql", "macro_sql": "{% macro get_limit_subquery_sql(sql, limit) %}\n  {{ adapter.dispatch('get_limit_subquery_sql', 'dbt')(sql, limit) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_limit_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.143904, "supported_languages": null}, "macro.dbt.default__get_limit_subquery_sql": {"name": "default__get_limit_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.default__get_limit_subquery_sql", "macro_sql": "{% macro default__get_limit_subquery_sql(sql, limit) %}\n    select *\n    from (\n        {{ sql }}\n    ) as model_limit_subq\n    limit {{ limit }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1440399, "supported_languages": null}, "macro.dbt.alter_column_comment": {"name": "alter_column_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n  {{ return(adapter.dispatch('alter_column_comment', 'dbt')(relation, column_dict)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.144713, "supported_languages": null}, "macro.dbt.default__alter_column_comment": {"name": "default__alter_column_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.default__alter_column_comment", "macro_sql": "{% macro default__alter_column_comment(relation, column_dict) -%}\n  {{ exceptions.raise_not_implemented(\n    'alter_column_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.144883, "supported_languages": null}, "macro.dbt.alter_relation_comment": {"name": "alter_relation_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n  {{ return(adapter.dispatch('alter_relation_comment', 'dbt')(relation, relation_comment)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_relation_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.14509, "supported_languages": null}, "macro.dbt.default__alter_relation_comment": {"name": "default__alter_relation_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.default__alter_relation_comment", "macro_sql": "{% macro default__alter_relation_comment(relation, relation_comment) -%}\n  {{ exceptions.raise_not_implemented(\n    'alter_relation_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.14527, "supported_languages": null}, "macro.dbt.persist_docs": {"name": "persist_docs", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n  {{ return(adapter.dispatch('persist_docs', 'dbt')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.145558, "supported_languages": null}, "macro.dbt.default__persist_docs": {"name": "default__persist_docs", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.default__persist_docs", "macro_sql": "{% macro default__persist_docs(relation, model, for_relation, for_columns) -%}\n  {% if for_relation and config.persist_relation_docs() and model.description %}\n    {% do run_query(alter_relation_comment(relation, model.description)) %}\n  {% endif %}\n\n  {% if for_columns and config.persist_column_docs() and model.columns %}\n    {% do run_query(alter_column_comment(relation, model.columns)) %}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.alter_relation_comment", "macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.146058, "supported_languages": null}, "macro.dbt.get_catalog_relations": {"name": "get_catalog_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_catalog_relations", "macro_sql": "{% macro get_catalog_relations(information_schema, relations) -%}\n  {{ return(adapter.dispatch('get_catalog_relations', 'dbt')(information_schema, relations)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.148909, "supported_languages": null}, "macro.dbt.default__get_catalog_relations": {"name": "default__get_catalog_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_catalog_relations", "macro_sql": "{% macro default__get_catalog_relations(information_schema, relations) -%}\n  {% set typename = adapter.type() %}\n  {% set msg -%}\n    get_catalog_relations not implemented for {{ typename }}\n  {%- endset %}\n\n  {{ exceptions.raise_compiler_error(msg) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.149168, "supported_languages": null}, "macro.dbt.get_catalog": {"name": "get_catalog", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n  {{ return(adapter.dispatch('get_catalog', 'dbt')(information_schema, schemas)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1493728, "supported_languages": null}, "macro.dbt.default__get_catalog": {"name": "default__get_catalog", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_catalog", "macro_sql": "{% macro default__get_catalog(information_schema, schemas) -%}\n\n  {% set typename = adapter.type() %}\n  {% set msg -%}\n    get_catalog not implemented for {{ typename }}\n  {%- endset %}\n\n  {{ exceptions.raise_compiler_error(msg) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1496372, "supported_languages": null}, "macro.dbt.information_schema_name": {"name": "information_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n  {{ return(adapter.dispatch('information_schema_name', 'dbt')(database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__information_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.149825, "supported_languages": null}, "macro.dbt.default__information_schema_name": {"name": "default__information_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__information_schema_name", "macro_sql": "{% macro default__information_schema_name(database) -%}\n  {%- if database -%}\n    {{ database }}.INFORMATION_SCHEMA\n  {%- else -%}\n    INFORMATION_SCHEMA\n  {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1499908, "supported_languages": null}, "macro.dbt.list_schemas": {"name": "list_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n  {{ return(adapter.dispatch('list_schemas', 'dbt')(database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__list_schemas"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1501708, "supported_languages": null}, "macro.dbt.default__list_schemas": {"name": "default__list_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__list_schemas", "macro_sql": "{% macro default__list_schemas(database) -%}\n  {% set sql %}\n    select distinct schema_name\n    from {{ information_schema_name(database) }}.SCHEMATA\n    where catalog_name ilike '{{ database }}'\n  {% endset %}\n  {{ return(run_query(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.information_schema_name", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1504881, "supported_languages": null}, "macro.dbt.check_schema_exists": {"name": "check_schema_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n  {{ return(adapter.dispatch('check_schema_exists', 'dbt')(information_schema, schema)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__check_schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1506948, "supported_languages": null}, "macro.dbt.default__check_schema_exists": {"name": "default__check_schema_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__check_schema_exists", "macro_sql": "{% macro default__check_schema_exists(information_schema, schema) -%}\n  {% set sql -%}\n        select count(*)\n        from {{ information_schema.replace(information_schema_view='SCHEMATA') }}\n        where catalog_name='{{ information_schema.database }}'\n          and schema_name='{{ schema }}'\n  {%- endset %}\n  {{ return(run_query(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.151006, "supported_languages": null}, "macro.dbt.list_relations_without_caching": {"name": "list_relations_without_caching", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n  {{ return(adapter.dispatch('list_relations_without_caching', 'dbt')(schema_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.151196, "supported_languages": null}, "macro.dbt.default__list_relations_without_caching": {"name": "default__list_relations_without_caching", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__list_relations_without_caching", "macro_sql": "{% macro default__list_relations_without_caching(schema_relation) %}\n  {{ exceptions.raise_not_implemented(\n    'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1513548, "supported_languages": null}, "macro.dbt.get_relations": {"name": "get_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_relations", "macro_sql": "{% macro get_relations() %}\n  {{ return(adapter.dispatch('get_relations', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.151526, "supported_languages": null}, "macro.dbt.default__get_relations": {"name": "default__get_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_relations", "macro_sql": "{% macro default__get_relations() %}\n  {{ exceptions.raise_not_implemented(\n    'get_relations macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.151681, "supported_languages": null}, "macro.dbt.get_relation_last_modified": {"name": "get_relation_last_modified", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_relation_last_modified", "macro_sql": "{% macro get_relation_last_modified(information_schema, relations) %}\n  {{ return(adapter.dispatch('get_relation_last_modified', 'dbt')(information_schema, relations)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_relation_last_modified"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1518898, "supported_languages": null}, "macro.dbt.default__get_relation_last_modified": {"name": "default__get_relation_last_modified", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_relation_last_modified", "macro_sql": "{% macro default__get_relation_last_modified(information_schema, relations) %}\n  {{ exceptions.raise_not_implemented(\n    'get_relation_last_modified macro not implemented for adapter ' + adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.152066, "supported_languages": null}, "macro.dbt.get_columns_in_relation": {"name": "get_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n  {{ return(adapter.dispatch('get_columns_in_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1543128, "supported_languages": null}, "macro.dbt.default__get_columns_in_relation": {"name": "default__get_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_columns_in_relation", "macro_sql": "{% macro default__get_columns_in_relation(relation) -%}\n  {{ exceptions.raise_not_implemented(\n    'get_columns_in_relation macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1544771, "supported_languages": null}, "macro.dbt.sql_convert_columns_in_relation": {"name": "sql_convert_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.sql_convert_columns_in_relation", "macro_sql": "{% macro sql_convert_columns_in_relation(table) -%}\n  {% set columns = [] %}\n  {% for row in table %}\n    {% do columns.append(api.Column(*row)) %}\n  {% endfor %}\n  {{ return(columns) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.154788, "supported_languages": null}, "macro.dbt.get_empty_subquery_sql": {"name": "get_empty_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_empty_subquery_sql", "macro_sql": "{% macro get_empty_subquery_sql(select_sql, select_sql_header=none) -%}\n  {{ return(adapter.dispatch('get_empty_subquery_sql', 'dbt')(select_sql, select_sql_header)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.155016, "supported_languages": null}, "macro.dbt.default__get_empty_subquery_sql": {"name": "default__get_empty_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_empty_subquery_sql", "macro_sql": "{% macro default__get_empty_subquery_sql(select_sql, select_sql_header=none) %}\n    {%- if select_sql_header is not none -%}\n    {{ select_sql_header }}\n    {%- endif -%}\n    select * from (\n        {{ select_sql }}\n    ) as __dbt_sbq\n    where false\n    limit 0\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.155224, "supported_languages": null}, "macro.dbt.get_empty_schema_sql": {"name": "get_empty_schema_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_empty_schema_sql", "macro_sql": "{% macro get_empty_schema_sql(columns) -%}\n  {{ return(adapter.dispatch('get_empty_schema_sql', 'dbt')(columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_empty_schema_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.155408, "supported_languages": null}, "macro.dbt.default__get_empty_schema_sql": {"name": "default__get_empty_schema_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_empty_schema_sql", "macro_sql": "{% macro default__get_empty_schema_sql(columns) %}\n    {%- set col_err = [] -%}\n    {%- set col_naked_numeric = [] -%}\n    select\n    {% for i in columns %}\n      {%- set col = columns[i] -%}\n      {%- if col['data_type'] is not defined -%}\n        {%- do col_err.append(col['name']) -%}\n      {#-- If this column's type is just 'numeric' then it is missing precision/scale, raise a warning --#}\n      {%- elif col['data_type'].strip().lower() in ('numeric', 'decimal', 'number') -%}\n        {%- do col_naked_numeric.append(col['name']) -%}\n      {%- endif -%}\n      {% set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] %}\n      cast(null as {{ col['data_type'] }}) as {{ col_name }}{{ \", \" if not loop.last }}\n    {%- endfor -%}\n    {%- if (col_err | length) > 0 -%}\n      {{ exceptions.column_type_missing(column_names=col_err) }}\n    {%- elif (col_naked_numeric | length) > 0 -%}\n      {{ exceptions.warn(\"Detected columns with numeric type and unspecified precision/scale, this can lead to unintended rounding: \" ~ col_naked_numeric ~ \"`\") }}\n    {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.156626, "supported_languages": null}, "macro.dbt.get_column_schema_from_query": {"name": "get_column_schema_from_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_column_schema_from_query", "macro_sql": "{% macro get_column_schema_from_query(select_sql, select_sql_header=none) -%}\n    {% set columns = [] %}\n    {# -- Using an 'empty subquery' here to get the same schema as the given select_sql statement, without necessitating a data scan.#}\n    {% set sql = get_empty_subquery_sql(select_sql, select_sql_header) %}\n    {% set column_schema = adapter.get_column_schema_from_query(sql) %}\n    {{ return(column_schema) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.15698, "supported_languages": null}, "macro.dbt.get_columns_in_query": {"name": "get_columns_in_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_columns_in_query", "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n  {{ return(adapter.dispatch('get_columns_in_query', 'dbt')(select_sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.157166, "supported_languages": null}, "macro.dbt.default__get_columns_in_query": {"name": "default__get_columns_in_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_columns_in_query", "macro_sql": "{% macro default__get_columns_in_query(select_sql) %}\n    {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n        {{ get_empty_subquery_sql(select_sql) }}\n    {% endcall %}\n    {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.157521, "supported_languages": null}, "macro.dbt.alter_column_type": {"name": "alter_column_type", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n  {{ return(adapter.dispatch('alter_column_type', 'dbt')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.157755, "supported_languages": null}, "macro.dbt.default__alter_column_type": {"name": "default__alter_column_type", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__alter_column_type", "macro_sql": "{% macro default__alter_column_type(relation, column_name, new_column_type) -%}\n  {#\n    1. Create a new column (w/ temp name and correct type)\n    2. Copy data over to it\n    3. Drop the existing column (cascade!)\n    4. Rename the new column to existing column\n  #}\n  {%- set tmp_column = column_name + \"__dbt_alter\" -%}\n\n  {% call statement('alter_column_type') %}\n    alter table {{ relation }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n    update {{ relation }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n    alter table {{ relation }} drop column {{ adapter.quote(column_name) }} cascade;\n    alter table {{ relation }} rename column {{ adapter.quote(tmp_column) }} to {{ adapter.quote(column_name) }}\n  {% endcall %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.15836, "supported_languages": null}, "macro.dbt.alter_relation_add_remove_columns": {"name": "alter_relation_add_remove_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.alter_relation_add_remove_columns", "macro_sql": "{% macro alter_relation_add_remove_columns(relation, add_columns = none, remove_columns = none) -%}\n  {{ return(adapter.dispatch('alter_relation_add_remove_columns', 'dbt')(relation, add_columns, remove_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_relation_add_remove_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.158619, "supported_languages": null}, "macro.dbt.default__alter_relation_add_remove_columns": {"name": "default__alter_relation_add_remove_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__alter_relation_add_remove_columns", "macro_sql": "{% macro default__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n\n  {% if add_columns is none %}\n    {% set add_columns = [] %}\n  {% endif %}\n  {% if remove_columns is none %}\n    {% set remove_columns = [] %}\n  {% endif %}\n\n  {% set sql -%}\n\n     alter {{ relation.type }} {{ relation }}\n\n            {% for column in add_columns %}\n               add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n            {% endfor %}{{ ',' if add_columns and remove_columns }}\n\n            {% for column in remove_columns %}\n                drop column {{ column.name }}{{ ',' if not loop.last }}\n            {% endfor %}\n\n  {%- endset -%}\n\n  {% do run_query(sql) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1594071, "supported_languages": null}, "macro.dbt.resolve_model_name": {"name": "resolve_model_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.resolve_model_name", "macro_sql": "{% macro resolve_model_name(input_model_name) %}\n    {{ return(adapter.dispatch('resolve_model_name', 'dbt')(input_model_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1610692, "supported_languages": null}, "macro.dbt.default__resolve_model_name": {"name": "default__resolve_model_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.default__resolve_model_name", "macro_sql": "\n\n{%- macro default__resolve_model_name(input_model_name) -%}\n    {{  input_model_name | string | replace('\"', '\\\"') }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.161226, "supported_languages": null}, "macro.dbt.build_ref_function": {"name": "build_ref_function", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_ref_function", "macro_sql": "{% macro build_ref_function(model) %}\n\n    {%- set ref_dict = {} -%}\n    {%- for _ref in model.refs -%}\n        {% set _ref_args = [_ref.get('package'), _ref['name']] if _ref.get('package') else [_ref['name'],] %}\n        {%- set resolved = ref(*_ref_args, v=_ref.get('version')) -%}\n        {%- if _ref.get('version') -%}\n            {% do _ref_args.extend([\"v\" ~ _ref['version']]) %}\n        {%- endif -%}\n       {%- do ref_dict.update({_ref_args | join('.'): resolve_model_name(resolved)}) -%}\n    {%- endfor -%}\n\ndef ref(*args, **kwargs):\n    refs = {{ ref_dict | tojson }}\n    key = '.'.join(args)\n    version = kwargs.get(\"v\") or kwargs.get(\"version\")\n    if version:\n        key += f\".v{version}\"\n    dbt_load_df_function = kwargs.get(\"dbt_load_df_function\")\n    return dbt_load_df_function(refs[key])\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1620538, "supported_languages": null}, "macro.dbt.build_source_function": {"name": "build_source_function", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_source_function", "macro_sql": "{% macro build_source_function(model) %}\n\n    {%- set source_dict = {} -%}\n    {%- for _source in model.sources -%}\n        {%- set resolved = source(*_source) -%}\n        {%- do source_dict.update({_source | join('.'): resolve_model_name(resolved)}) -%}\n    {%- endfor -%}\n\ndef source(*args, dbt_load_df_function):\n    sources = {{ source_dict | tojson }}\n    key = '.'.join(args)\n    return dbt_load_df_function(sources[key])\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.162467, "supported_languages": null}, "macro.dbt.build_config_dict": {"name": "build_config_dict", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_config_dict", "macro_sql": "{% macro build_config_dict(model) %}\n    {%- set config_dict = {} -%}\n    {% set config_dbt_used = zip(model.config.config_keys_used, model.config.config_keys_defaults) | list %}\n    {%- for key, default in config_dbt_used -%}\n        {# weird type testing with enum, would be much easier to write this logic in Python! #}\n        {%- if key == \"language\" -%}\n          {%- set value = \"python\" -%}\n        {%- endif -%}\n        {%- set value = model.config.get(key, default) -%}\n        {%- do config_dict.update({key: value}) -%}\n    {%- endfor -%}\nconfig_dict = {{ config_dict }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1630561, "supported_languages": null}, "macro.dbt.py_script_postfix": {"name": "py_script_postfix", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.py_script_postfix", "macro_sql": "{% macro py_script_postfix(model) %}\n# This part is user provided model code\n# you will need to copy the next section to run the code\n# COMMAND ----------\n# this part is dbt logic for get ref work, do not modify\n\n{{ build_ref_function(model ) }}\n{{ build_source_function(model ) }}\n{{ build_config_dict(model) }}\n\nclass config:\n    def __init__(self, *args, **kwargs):\n        pass\n\n    @staticmethod\n    def get(key, default=None):\n        return config_dict.get(key, default)\n\nclass this:\n    \"\"\"dbt.this() or dbt.this.identifier\"\"\"\n    database = \"{{ this.database }}\"\n    schema = \"{{ this.schema }}\"\n    identifier = \"{{ this.identifier }}\"\n    {% set this_relation_name = resolve_model_name(this) %}\n    def __repr__(self):\n        return '{{ this_relation_name  }}'\n\n\nclass dbtObj:\n    def __init__(self, load_df_function) -> None:\n        self.source = lambda *args: source(*args, dbt_load_df_function=load_df_function)\n        self.ref = lambda *args, **kwargs: ref(*args, **kwargs, dbt_load_df_function=load_df_function)\n        self.config = config\n        self.this = this()\n        self.is_incremental = {{ is_incremental() }}\n\n# COMMAND ----------\n{{py_script_comment()}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.build_ref_function", "macro.dbt.build_source_function", "macro.dbt.build_config_dict", "macro.dbt.resolve_model_name", "macro.dbt.is_incremental", "macro.dbt.py_script_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1636548, "supported_languages": null}, "macro.dbt.py_script_comment": {"name": "py_script_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.py_script_comment", "macro_sql": "{%macro py_script_comment()%}\n{%endmacro%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.163755, "supported_languages": null}, "macro.dbt.test_unique": {"name": "test_unique", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_unique", "macro_sql": "{% test unique(model, column_name) %}\n    {% set macro = adapter.dispatch('test_unique', 'dbt') %}\n    {{ macro(model, column_name) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_unique"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1642828, "supported_languages": null}, "macro.dbt.test_not_null": {"name": "test_not_null", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_not_null", "macro_sql": "{% test not_null(model, column_name) %}\n    {% set macro = adapter.dispatch('test_not_null', 'dbt') %}\n    {{ macro(model, column_name) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1645288, "supported_languages": null}, "macro.dbt.test_accepted_values": {"name": "test_accepted_values", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_accepted_values", "macro_sql": "{% test accepted_values(model, column_name, values, quote=True) %}\n    {% set macro = adapter.dispatch('test_accepted_values', 'dbt') %}\n    {{ macro(model, column_name, values, quote) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1648252, "supported_languages": null}, "macro.dbt.test_relationships": {"name": "test_relationships", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_relationships", "macro_sql": "{% test relationships(model, column_name, to, field) %}\n    {% set macro = adapter.dispatch('test_relationships', 'dbt') %}\n    {{ macro(model, column_name, to, field) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_relationships"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1651032, "supported_languages": null}, "macro.dbt_utils.get_url_host": {"name": "get_url_host", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "unique_id": "macro.dbt_utils.get_url_host", "macro_sql": "{% macro get_url_host(field) -%}\n    {{ return(adapter.dispatch('get_url_host', 'dbt_utils')(field)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_host"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.165463, "supported_languages": null}, "macro.dbt_utils.default__get_url_host": {"name": "default__get_url_host", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "unique_id": "macro.dbt_utils.default__get_url_host", "macro_sql": "{% macro default__get_url_host(field) -%}\n\n{%- set parsed =\n    dbt.split_part(\n        dbt.split_part(\n            dbt.replace(\n                dbt.replace(\n                    dbt.replace(field, \"'android-app://'\", \"''\"\n                    ), \"'http://'\", \"''\"\n                ), \"'https://'\", \"''\"\n            ), \"'/'\", 1\n        ), \"'?'\", 1\n    )\n\n-%}\n\n\n    {{ dbt.safe_cast(\n        parsed,\n        dbt.type_string()\n        )}}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.split_part", "macro.dbt.replace", "macro.dbt.safe_cast", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.166037, "supported_languages": null}, "macro.dbt_utils.get_url_path": {"name": "get_url_path", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "unique_id": "macro.dbt_utils.get_url_path", "macro_sql": "{% macro get_url_path(field) -%}\n    {{ return(adapter.dispatch('get_url_path', 'dbt_utils')(field)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_path"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.166525, "supported_languages": null}, "macro.dbt_utils.default__get_url_path": {"name": "default__get_url_path", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "unique_id": "macro.dbt_utils.default__get_url_path", "macro_sql": "{% macro default__get_url_path(field) -%}\n\n    {%- set stripped_url =\n        dbt.replace(\n            dbt.replace(field, \"'http://'\", \"''\"), \"'https://'\", \"''\")\n    -%}\n\n    {%- set first_slash_pos -%}\n        coalesce(\n            nullif({{ dbt.position(\"'/'\", stripped_url) }}, 0),\n            {{ dbt.position(\"'?'\", stripped_url) }} - 1\n            )\n    {%- endset -%}\n\n    {%- set parsed_path =\n        dbt.split_part(\n            dbt.right(\n                stripped_url,\n                dbt.length(stripped_url) ~ \"-\" ~ first_slash_pos\n                ),\n            \"'?'\", 1\n            )\n    -%}\n\n    {{ dbt.safe_cast(\n        parsed_path,\n        dbt.type_string()\n    )}}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.replace", "macro.dbt.position", "macro.dbt.split_part", "macro.dbt.right", "macro.dbt.length", "macro.dbt.safe_cast", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.167212, "supported_languages": null}, "macro.dbt_utils.get_url_parameter": {"name": "get_url_parameter", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "unique_id": "macro.dbt_utils.get_url_parameter", "macro_sql": "{% macro get_url_parameter(field, url_parameter) -%}\n    {{ return(adapter.dispatch('get_url_parameter', 'dbt_utils')(field, url_parameter)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.167532, "supported_languages": null}, "macro.dbt_utils.default__get_url_parameter": {"name": "default__get_url_parameter", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "unique_id": "macro.dbt_utils.default__get_url_parameter", "macro_sql": "{% macro default__get_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"='\" -%}\n\n{%- set split = dbt.split_part(dbt.split_part(field, formatted_url_parameter, 2), \"'&'\", 1) -%}\n\nnullif({{ split }},'')\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.split_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.167861, "supported_languages": null}, "macro.dbt_utils.test_fewer_rows_than": {"name": "test_fewer_rows_than", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "unique_id": "macro.dbt_utils.test_fewer_rows_than", "macro_sql": "{% test fewer_rows_than(model, compare_model, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_fewer_rows_than', 'dbt_utils')(model, compare_model, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_fewer_rows_than"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1689558, "supported_languages": null}, "macro.dbt_utils.default__test_fewer_rows_than": {"name": "default__test_fewer_rows_than", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "unique_id": "macro.dbt_utils.default__test_fewer_rows_than", "macro_sql": "{% macro default__test_fewer_rows_than(model, compare_model, group_by_columns) %}\n\n{{ config(fail_calc = 'sum(coalesce(row_count_delta, 0))') }}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set join_gb_cols %}\n    {% for c in group_by_columns %}\n      and a.{{c}} = b.{{c}}\n    {% endfor %}\n  {% endset %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n{#-- We must add a fake join key in case additional grouping variables are not provided --#}\n{#-- Redshift does not allow for dynamically created join conditions (e.g. full join on 1 = 1 --#}\n{#-- The same logic is used in equal_rowcount. In case of changes, maintain consistent logic --#}\n{% set group_by_columns = ['id_dbtutils_test_fewer_rows_than'] + group_by_columns %}\n{% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n\n\nwith a as (\n\n    select \n      {{select_gb_cols}}\n      1 as id_dbtutils_test_fewer_rows_than,\n      count(*) as count_our_model \n    from {{ model }}\n    {{ groupby_gb_cols }}\n\n),\nb as (\n\n    select \n      {{select_gb_cols}}\n      1 as id_dbtutils_test_fewer_rows_than,\n      count(*) as count_comparison_model \n    from {{ compare_model }}\n    {{ groupby_gb_cols }}\n\n),\ncounts as (\n\n    select\n\n        {% for c in group_by_columns -%}\n          a.{{c}} as {{c}}_a,\n          b.{{c}} as {{c}}_b,\n        {% endfor %}\n\n        count_our_model,\n        count_comparison_model\n    from a\n    full join b on \n    a.id_dbtutils_test_fewer_rows_than = b.id_dbtutils_test_fewer_rows_than\n    {{ join_gb_cols }}\n\n),\nfinal as (\n\n    select *,\n        case\n            -- fail the test if we have more rows than the reference model and return the row count delta\n            when count_our_model > count_comparison_model then (count_our_model - count_comparison_model)\n            -- fail the test if they are the same number\n            when count_our_model = count_comparison_model then 1\n            -- pass the test if the delta is positive (i.e. return the number 0)\n            else 0\n    end as row_count_delta\n    from counts\n\n)\n\nselect * from final\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.170006, "supported_languages": null}, "macro.dbt_utils.test_equal_rowcount": {"name": "test_equal_rowcount", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "unique_id": "macro.dbt_utils.test_equal_rowcount", "macro_sql": "{% test equal_rowcount(model, compare_model, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_equal_rowcount', 'dbt_utils')(model, compare_model, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_equal_rowcount"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.170881, "supported_languages": null}, "macro.dbt_utils.default__test_equal_rowcount": {"name": "default__test_equal_rowcount", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "unique_id": "macro.dbt_utils.default__test_equal_rowcount", "macro_sql": "{% macro default__test_equal_rowcount(model, compare_model, group_by_columns) %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = 'sum(coalesce(diff_count, 0))') }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n    {{ return('') }}\n{% endif %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(', ') + ', ' %}\n  {% set join_gb_cols %}\n    {% for c in group_by_columns %}\n      and a.{{c}} = b.{{c}}\n    {% endfor %}\n  {% endset %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n{#-- We must add a fake join key in case additional grouping variables are not provided --#}\n{#-- Redshift does not allow for dynamically created join conditions (e.g. full join on 1 = 1 --#}\n{#-- The same logic is used in fewer_rows_than. In case of changes, maintain consistent logic --#}\n{% set group_by_columns = ['id_dbtutils_test_equal_rowcount'] + group_by_columns %}\n{% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n\nwith a as (\n\n    select \n      {{select_gb_cols}}\n      1 as id_dbtutils_test_equal_rowcount,\n      count(*) as count_a \n    from {{ model }}\n    {{groupby_gb_cols}}\n\n\n),\nb as (\n\n    select \n      {{select_gb_cols}}\n      1 as id_dbtutils_test_equal_rowcount,\n      count(*) as count_b \n    from {{ compare_model }}\n    {{groupby_gb_cols}}\n\n),\nfinal as (\n\n    select\n    \n        {% for c in group_by_columns -%}\n          a.{{c}} as {{c}}_a,\n          b.{{c}} as {{c}}_b,\n        {% endfor %}\n\n        count_a,\n        count_b,\n        abs(count_a - count_b) as diff_count\n\n    from a\n    full join b\n    on\n    a.id_dbtutils_test_equal_rowcount = b.id_dbtutils_test_equal_rowcount\n    {{join_gb_cols}}\n\n\n)\n\nselect * from final\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.171984, "supported_languages": null}, "macro.dbt_utils.test_relationships_where": {"name": "test_relationships_where", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "unique_id": "macro.dbt_utils.test_relationships_where", "macro_sql": "{% test relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n  {{ return(adapter.dispatch('test_relationships_where', 'dbt_utils')(model, column_name, to, field, from_condition, to_condition)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_relationships_where"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.172666, "supported_languages": null}, "macro.dbt_utils.default__test_relationships_where": {"name": "default__test_relationships_where", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "unique_id": "macro.dbt_utils.default__test_relationships_where", "macro_sql": "{% macro default__test_relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n\nwith left_table as (\n\n  select\n    {{column_name}} as id\n\n  from {{model}}\n\n  where {{column_name}} is not null\n    and {{from_condition}}\n\n),\n\nright_table as (\n\n  select\n    {{field}} as id\n\n  from {{to}}\n\n  where {{field}} is not null\n    and {{to_condition}}\n\n),\n\nexceptions as (\n\n  select\n    left_table.id,\n    right_table.id as right_id\n\n  from left_table\n\n  left join right_table\n         on left_table.id = right_table.id\n\n  where right_table.id is null\n\n)\n\nselect * from exceptions\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.173013, "supported_languages": null}, "macro.dbt_utils.test_recency": {"name": "test_recency", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "unique_id": "macro.dbt_utils.test_recency", "macro_sql": "{% test recency(model, field, datepart, interval, ignore_time_component=False, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_recency', 'dbt_utils')(model, field, datepart, interval, ignore_time_component, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_recency"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.173756, "supported_languages": null}, "macro.dbt_utils.default__test_recency": {"name": "default__test_recency", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "unique_id": "macro.dbt_utils.default__test_recency", "macro_sql": "{% macro default__test_recency(model, field, datepart, interval, ignore_time_component, group_by_columns) %}\n\n{% set threshold = 'cast(' ~ dbt.dateadd(datepart, interval * -1, dbt.current_timestamp()) ~ ' as ' ~ ('date' if ignore_time_component else dbt.type_timestamp()) ~ ')'  %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n\nwith recency as (\n\n    select \n\n      {{ select_gb_cols }}\n      {% if ignore_time_component %}\n        cast(max({{ field }}) as date) as most_recent\n      {%- else %}\n        max({{ field }}) as most_recent\n      {%- endif %}\n\n    from {{ model }}\n\n    {{ groupby_gb_cols }}\n\n)\n\nselect\n\n    {{ select_gb_cols }}\n    most_recent,\n    {{ threshold }} as threshold\n\nfrom recency\nwhere most_recent < {{ threshold }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.current_timestamp", "macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.174609, "supported_languages": null}, "macro.dbt_utils.test_not_constant": {"name": "test_not_constant", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "unique_id": "macro.dbt_utils.test_not_constant", "macro_sql": "{% test not_constant(model, column_name, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_not_constant', 'dbt_utils')(model, column_name, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_constant"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.175064, "supported_languages": null}, "macro.dbt_utils.default__test_not_constant": {"name": "default__test_not_constant", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "unique_id": "macro.dbt_utils.default__test_not_constant", "macro_sql": "{% macro default__test_not_constant(model, column_name, group_by_columns) %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n\nselect\n    {# In TSQL, subquery aggregate columns need aliases #}\n    {# thus: a filler col name, 'filler_column' #}\n    {{select_gb_cols}}\n    count(distinct {{ column_name }}) as filler_column\n\nfrom {{ model }}\n\n  {{groupby_gb_cols}}\n\nhaving count(distinct {{ column_name }}) = 1\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.175533, "supported_languages": null}, "macro.dbt_utils.test_accepted_range": {"name": "test_accepted_range", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "unique_id": "macro.dbt_utils.test_accepted_range", "macro_sql": "{% test accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n  {{ return(adapter.dispatch('test_accepted_range', 'dbt_utils')(model, column_name, min_value, max_value, inclusive)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_accepted_range"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.17615, "supported_languages": null}, "macro.dbt_utils.default__test_accepted_range": {"name": "default__test_accepted_range", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "unique_id": "macro.dbt_utils.default__test_accepted_range", "macro_sql": "{% macro default__test_accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n\nwith meet_condition as(\n  select *\n  from {{ model }}\n),\n\nvalidation_errors as (\n  select *\n  from meet_condition\n  where\n    -- never true, defaults to an empty result set. Exists to ensure any combo of the `or` clauses below succeeds\n    1 = 2\n\n  {%- if min_value is not none %}\n    -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.\n    or not {{ column_name }} > {{- \"=\" if inclusive }} {{ min_value }}\n  {%- endif %}\n\n  {%- if max_value is not none %}\n    -- records with a value <= max_value are permitted. The `not` flips this to find records that don't meet the rule.\n    or not {{ column_name }} < {{- \"=\" if inclusive }} {{ max_value }}\n  {%- endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1766322, "supported_languages": null}, "macro.dbt_utils.test_not_accepted_values": {"name": "test_not_accepted_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "unique_id": "macro.dbt_utils.test_not_accepted_values", "macro_sql": "{% test not_accepted_values(model, column_name, values, quote=True) %}\n  {{ return(adapter.dispatch('test_not_accepted_values', 'dbt_utils')(model, column_name, values, quote)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1771898, "supported_languages": null}, "macro.dbt_utils.default__test_not_accepted_values": {"name": "default__test_not_accepted_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "unique_id": "macro.dbt_utils.default__test_not_accepted_values", "macro_sql": "{% macro default__test_not_accepted_values(model, column_name, values, quote=True) %}\nwith all_values as (\n\n    select distinct\n        {{ column_name }} as value_field\n\n    from {{ model }}\n\n),\n\nvalidation_errors as (\n\n    select\n        value_field\n\n    from all_values\n    where value_field in (\n        {% for value in values -%}\n            {% if quote -%}\n            '{{ value }}'\n            {%- else -%}\n            {{ value }}\n            {%- endif -%}\n            {%- if not loop.last -%},{%- endif %}\n        {%- endfor %}\n        )\n\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1777751, "supported_languages": null}, "macro.dbt_utils.test_at_least_one": {"name": "test_at_least_one", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "unique_id": "macro.dbt_utils.test_at_least_one", "macro_sql": "{% test at_least_one(model, column_name, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_at_least_one', 'dbt_utils')(model, column_name, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_at_least_one"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.178442, "supported_languages": null}, "macro.dbt_utils.default__test_at_least_one": {"name": "default__test_at_least_one", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "unique_id": "macro.dbt_utils.default__test_at_least_one", "macro_sql": "{% macro default__test_at_least_one(model, column_name, group_by_columns) %}\n\n{% set pruned_cols = [column_name] %}\n\n{% if group_by_columns|length() > 0 %}\n\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n  {% set pruned_cols = group_by_columns %}\n\n  {% if column_name not in pruned_cols %}\n    {% do pruned_cols.append(column_name) %}\n  {% endif %}\n\n{% endif %}\n\n{% set select_pruned_cols = pruned_cols|join(' ,') %}\n\nselect *\nfrom (\n    with pruned_rows as (\n      select\n        {{ select_pruned_cols }}\n      from {{ model }}\n      where {{ column_name }} is not null\n      limit 1\n    )\n    select\n        {# In TSQL, subquery aggregate columns need aliases #}\n        {# thus: a filler col name, 'filler_column' #}\n      {{select_gb_cols}}\n      count({{ column_name }}) as filler_column\n\n    from pruned_rows\n\n    {{groupby_gb_cols}}\n\n    having count({{ column_name }}) = 0\n\n) validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.179262, "supported_languages": null}, "macro.dbt_utils.test_unique_combination_of_columns": {"name": "test_unique_combination_of_columns", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "unique_id": "macro.dbt_utils.test_unique_combination_of_columns", "macro_sql": "{% test unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n  {{ return(adapter.dispatch('test_unique_combination_of_columns', 'dbt_utils')(model, combination_of_columns, quote_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_combination_of_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.179903, "supported_languages": null}, "macro.dbt_utils.default__test_unique_combination_of_columns": {"name": "default__test_unique_combination_of_columns", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "unique_id": "macro.dbt_utils.default__test_unique_combination_of_columns", "macro_sql": "{% macro default__test_unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n\n{% if not quote_columns %}\n    {%- set column_list=combination_of_columns %}\n{% elif quote_columns %}\n    {%- set column_list=[] %}\n        {% for column in combination_of_columns -%}\n            {% set column_list = column_list.append( adapter.quote(column) ) %}\n        {%- endfor %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\n        \"`quote_columns` argument for unique_combination_of_columns test must be one of [True, False] Got: '\" ~ quote ~\"'.'\"\n    ) }}\n{% endif %}\n\n{%- set columns_csv=column_list | join(', ') %}\n\n\nwith validation_errors as (\n\n    select\n        {{ columns_csv }}\n    from {{ model }}\n    group by {{ columns_csv }}\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1805482, "supported_languages": null}, "macro.dbt_utils.test_cardinality_equality": {"name": "test_cardinality_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "unique_id": "macro.dbt_utils.test_cardinality_equality", "macro_sql": "{% test cardinality_equality(model, column_name, to, field) %}\n    {{ return(adapter.dispatch('test_cardinality_equality', 'dbt_utils')(model, column_name, to, field)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_cardinality_equality"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.181112, "supported_languages": null}, "macro.dbt_utils.default__test_cardinality_equality": {"name": "default__test_cardinality_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "unique_id": "macro.dbt_utils.default__test_cardinality_equality", "macro_sql": "{% macro default__test_cardinality_equality(model, column_name, to, field) %}\n\n{# T-SQL does not let you use numbers as aliases for columns #}\n{# Thus, no \"GROUP BY 1\" #}\n\nwith table_a as (\nselect\n  {{ column_name }},\n  count(*) as num_rows\nfrom {{ model }}\ngroup by {{ column_name }}\n),\n\ntable_b as (\nselect\n  {{ field }},\n  count(*) as num_rows\nfrom {{ to }}\ngroup by {{ field }}\n),\n\nexcept_a as (\n  select *\n  from table_a\n  {{ dbt.except() }}\n  select *\n  from table_b\n),\n\nexcept_b as (\n  select *\n  from table_b\n  {{ dbt.except() }}\n  select *\n  from table_a\n),\n\nunioned as (\n  select *\n  from except_a\n  union all\n  select *\n  from except_b\n)\n\nselect *\nfrom unioned\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.181461, "supported_languages": null}, "macro.dbt_utils.test_expression_is_true": {"name": "test_expression_is_true", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "unique_id": "macro.dbt_utils.test_expression_is_true", "macro_sql": "{% test expression_is_true(model, expression, column_name=None) %}\n  {{ return(adapter.dispatch('test_expression_is_true', 'dbt_utils')(model, expression, column_name)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1818628, "supported_languages": null}, "macro.dbt_utils.default__test_expression_is_true": {"name": "default__test_expression_is_true", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "unique_id": "macro.dbt_utils.default__test_expression_is_true", "macro_sql": "{% macro default__test_expression_is_true(model, expression, column_name) %}\n\n{% set column_list = '*' if should_store_failures() else \"1\" %}\n\nselect\n    {{ column_list }}\nfrom {{ model }}\n{% if column_name is none %}\nwhere not({{ expression }})\n{%- else %}\nwhere not({{ column_name }} {{ expression }})\n{%- endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_store_failures"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.182223, "supported_languages": null}, "macro.dbt_utils.test_not_null_proportion": {"name": "test_not_null_proportion", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "unique_id": "macro.dbt_utils.test_not_null_proportion", "macro_sql": "{% macro test_not_null_proportion(model, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_not_null_proportion', 'dbt_utils')(model, group_by_columns, **kwargs)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_proportion"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.182872, "supported_languages": null}, "macro.dbt_utils.default__test_not_null_proportion": {"name": "default__test_not_null_proportion", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "unique_id": "macro.dbt_utils.default__test_not_null_proportion", "macro_sql": "{% macro default__test_not_null_proportion(model, group_by_columns) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n{% set at_least = kwargs.get('at_least', kwargs.get('arg')) %}\n{% set at_most = kwargs.get('at_most', kwargs.get('arg', 1)) %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\nwith validation as (\n  select\n    {{select_gb_cols}}\n    sum(case when {{ column_name }} is null then 0 else 1 end) / cast(count(*) as numeric) as not_null_proportion\n  from {{ model }}\n  {{groupby_gb_cols}}\n),\nvalidation_errors as (\n  select\n    {{select_gb_cols}}\n    not_null_proportion\n  from validation\n  where not_null_proportion < {{ at_least }} or not_null_proportion > {{ at_most }}\n)\nselect\n  *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.183713, "supported_languages": null}, "macro.dbt_utils.test_sequential_values": {"name": "test_sequential_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "unique_id": "macro.dbt_utils.test_sequential_values", "macro_sql": "{% test sequential_values(model, column_name, interval=1, datepart=None, group_by_columns = []) %}\n\n  {{ return(adapter.dispatch('test_sequential_values', 'dbt_utils')(model, column_name, interval, datepart, group_by_columns)) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_sequential_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1846201, "supported_languages": null}, "macro.dbt_utils.default__test_sequential_values": {"name": "default__test_sequential_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "unique_id": "macro.dbt_utils.default__test_sequential_values", "macro_sql": "{% macro default__test_sequential_values(model, column_name, interval=1, datepart=None, group_by_columns = []) %}\n\n{% set previous_column_name = \"previous_\" ~ dbt_utils.slugify(column_name) %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(',') + ', ' %}\n  {% set partition_gb_cols = 'partition by ' + group_by_columns|join(',') %}\n{% endif %}\n\nwith windowed as (\n\n    select\n        {{ select_gb_cols }}\n        {{ column_name }},\n        lag({{ column_name }}) over (\n            {{partition_gb_cols}}\n            order by {{ column_name }}\n        ) as {{ previous_column_name }}\n    from {{ model }}\n),\n\nvalidation_errors as (\n    select\n        *\n    from windowed\n    {% if datepart %}\n    where not(cast({{ column_name }} as {{ dbt.type_timestamp() }})= cast({{ dbt.dateadd(datepart, interval, previous_column_name) }} as {{ dbt.type_timestamp() }}))\n    {% else %}\n    where not({{ column_name }} = {{ previous_column_name }} + {{ interval }})\n    {% endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.slugify", "macro.dbt.type_timestamp", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1855638, "supported_languages": null}, "macro.dbt_utils.test_equality": {"name": "test_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "unique_id": "macro.dbt_utils.test_equality", "macro_sql": "{% test equality(model, compare_model, compare_columns=None) %}\n  {{ return(adapter.dispatch('test_equality', 'dbt_utils')(model, compare_model, compare_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_equality"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1863098, "supported_languages": null}, "macro.dbt_utils.default__test_equality": {"name": "default__test_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "unique_id": "macro.dbt_utils.default__test_equality", "macro_sql": "{% macro default__test_equality(model, compare_model, compare_columns=None) %}\n\n{% set set_diff %}\n    count(*) + coalesce(abs(\n        sum(case when which_diff = 'a_minus_b' then 1 else 0 end) -\n        sum(case when which_diff = 'b_minus_a' then 1 else 0 end)\n    ), 0)\n{% endset %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = set_diff) }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n    {{ return('') }}\n{% endif %}\n\n-- setup\n{%- do dbt_utils._is_relation(model, 'test_equality') -%}\n\n{#-\nIf the compare_cols arg is provided, we can run this test without querying the\ninformation schema\u00a0\u2014 this allows the model to be an ephemeral model\n-#}\n\n{%- if not compare_columns -%}\n    {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n    {%- set compare_columns = adapter.get_columns_in_relation(model) | map(attribute='quoted') -%}\n{%- endif -%}\n\n{% set compare_cols_csv = compare_columns | join(', ') %}\n\nwith a as (\n\n    select * from {{ model }}\n\n),\n\nb as (\n\n    select * from {{ compare_model }}\n\n),\n\na_minus_b as (\n\n    select {{compare_cols_csv}} from a\n    {{ dbt.except() }}\n    select {{compare_cols_csv}} from b\n\n),\n\nb_minus_a as (\n\n    select {{compare_cols_csv}} from b\n    {{ dbt.except() }}\n    select {{compare_cols_csv}} from a\n\n),\n\nunioned as (\n\n    select 'a_minus_b' as which_diff, a_minus_b.* from a_minus_b\n    union all\n    select 'b_minus_a' as which_diff, b_minus_a.* from b_minus_a\n\n)\n\nselect * from unioned\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.187215, "supported_languages": null}, "macro.dbt_utils.test_not_empty_string": {"name": "test_not_empty_string", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_empty_string.sql", "original_file_path": "macros/generic_tests/not_empty_string.sql", "unique_id": "macro.dbt_utils.test_not_empty_string", "macro_sql": "{% test not_empty_string(model, column_name, trim_whitespace=true) %}\n\n  {{ return(adapter.dispatch('test_not_empty_string', 'dbt_utils')(model, column_name, trim_whitespace)) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_empty_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.187731, "supported_languages": null}, "macro.dbt_utils.default__test_not_empty_string": {"name": "default__test_not_empty_string", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_empty_string.sql", "original_file_path": "macros/generic_tests/not_empty_string.sql", "unique_id": "macro.dbt_utils.default__test_not_empty_string", "macro_sql": "{% macro default__test_not_empty_string(model, column_name, trim_whitespace=true) %}\n\n    with\n    \n    all_values as (\n\n        select \n\n\n            {% if trim_whitespace == true -%}\n\n                trim({{ column_name }}) as {{ column_name }}\n\n            {%- else -%}\n\n                {{ column_name }}\n\n            {%- endif %}\n            \n        from {{ model }}\n\n    ),\n\n    errors as (\n\n        select * from all_values\n        where {{ column_name }} = ''\n\n    )\n\n    select * from errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1880372, "supported_languages": null}, "macro.dbt_utils.test_mutually_exclusive_ranges": {"name": "test_mutually_exclusive_ranges", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "unique_id": "macro.dbt_utils.test_mutually_exclusive_ranges", "macro_sql": "{% test mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n  {{ return(adapter.dispatch('test_mutually_exclusive_ranges', 'dbt_utils')(model, lower_bound_column, upper_bound_column, partition_by, gaps, zero_length_range_allowed)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_mutually_exclusive_ranges"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1916502, "supported_languages": null}, "macro.dbt_utils.default__test_mutually_exclusive_ranges": {"name": "default__test_mutually_exclusive_ranges", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "unique_id": "macro.dbt_utils.default__test_mutually_exclusive_ranges", "macro_sql": "{% macro default__test_mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n{% if gaps == 'not_allowed' %}\n    {% set allow_gaps_operator='=' %}\n    {% set allow_gaps_operator_in_words='equal_to' %}\n{% elif gaps == 'allowed' %}\n    {% set allow_gaps_operator='<=' %}\n    {% set allow_gaps_operator_in_words='less_than_or_equal_to' %}\n{% elif gaps == 'required' %}\n    {% set allow_gaps_operator='<' %}\n    {% set allow_gaps_operator_in_words='less_than' %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\n        \"`gaps` argument for mutually_exclusive_ranges test must be one of ['not_allowed', 'allowed', 'required'] Got: '\" ~ gaps ~\"'.'\"\n    ) }}\n{% endif %}\n{% if not zero_length_range_allowed %}\n    {% set allow_zero_length_operator='<' %}\n    {% set allow_zero_length_operator_in_words='less_than' %}\n{% elif zero_length_range_allowed %}\n    {% set allow_zero_length_operator='<=' %}\n    {% set allow_zero_length_operator_in_words='less_than_or_equal_to' %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\n        \"`zero_length_range_allowed` argument for mutually_exclusive_ranges test must be one of [true, false] Got: '\" ~ zero_length_range_allowed ~\"'.'\"\n    ) }}\n{% endif %}\n\n{% set partition_clause=\"partition by \" ~ partition_by if partition_by else '' %}\n\nwith window_functions as (\n\n    select\n        {% if partition_by %}\n        {{ partition_by }} as partition_by_col,\n        {% endif %}\n        {{ lower_bound_column }} as lower_bound,\n        {{ upper_bound_column }} as upper_bound,\n\n        lead({{ lower_bound_column }}) over (\n            {{ partition_clause }}\n            order by {{ lower_bound_column }}, {{ upper_bound_column }}\n        ) as next_lower_bound,\n\n        row_number() over (\n            {{ partition_clause }}\n            order by {{ lower_bound_column }} desc, {{ upper_bound_column }} desc\n        ) = 1 as is_last_record\n\n    from {{ model }}\n\n),\n\ncalc as (\n    -- We want to return records where one of our assumptions fails, so we'll use\n    -- the `not` function with `and` statements so we can write our assumptions more cleanly\n    select\n        *,\n\n        -- For each record: lower_bound should be < upper_bound.\n        -- Coalesce it to return an error on the null case (implicit assumption\n        -- these columns are not_null)\n        coalesce(\n            lower_bound {{ allow_zero_length_operator }} upper_bound,\n            false\n        ) as lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound,\n\n        -- For each record: upper_bound {{ allow_gaps_operator }} the next lower_bound.\n        -- Coalesce it to handle null cases for the last record.\n        coalesce(\n            upper_bound {{ allow_gaps_operator }} next_lower_bound,\n            is_last_record,\n            false\n        ) as upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n\n    from window_functions\n\n),\n\nvalidation_errors as (\n\n    select\n        *\n    from calc\n\n    where not(\n        -- THE FOLLOWING SHOULD BE TRUE --\n        lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound\n        and upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n    )\n)\n\nselect * from validation_errors\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.193277, "supported_languages": null}, "macro.dbt_utils.pretty_log_format": {"name": "pretty_log_format", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "unique_id": "macro.dbt_utils.pretty_log_format", "macro_sql": "{% macro pretty_log_format(message) %}\n    {{ return(adapter.dispatch('pretty_log_format', 'dbt_utils')(message)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.193553, "supported_languages": null}, "macro.dbt_utils.default__pretty_log_format": {"name": "default__pretty_log_format", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "unique_id": "macro.dbt_utils.default__pretty_log_format", "macro_sql": "{% macro default__pretty_log_format(message) %}\n    {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1937249, "supported_languages": null}, "macro.dbt_utils._is_relation": {"name": "_is_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/_is_relation.sql", "original_file_path": "macros/jinja_helpers/_is_relation.sql", "unique_id": "macro.dbt_utils._is_relation", "macro_sql": "{% macro _is_relation(obj, macro) %}\n    {%- if not (obj is mapping and obj.get('metadata', {}).get('type', '').endswith('Relation')) -%}\n        {%- do exceptions.raise_compiler_error(\"Macro \" ~ macro ~ \" expected a Relation but received the value: \" ~ obj) -%}\n    {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.194168, "supported_languages": null}, "macro.dbt_utils.pretty_time": {"name": "pretty_time", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "unique_id": "macro.dbt_utils.pretty_time", "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n    {{ return(adapter.dispatch('pretty_time', 'dbt_utils')(format)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1944451, "supported_languages": null}, "macro.dbt_utils.default__pretty_time": {"name": "default__pretty_time", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "unique_id": "macro.dbt_utils.default__pretty_time", "macro_sql": "{% macro default__pretty_time(format='%H:%M:%S') %}\n    {{ return(modules.datetime.datetime.now().strftime(format)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1946418, "supported_languages": null}, "macro.dbt_utils.log_info": {"name": "log_info", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "unique_id": "macro.dbt_utils.log_info", "macro_sql": "{% macro log_info(message) %}\n    {{ return(adapter.dispatch('log_info', 'dbt_utils')(message)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__log_info"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.194898, "supported_languages": null}, "macro.dbt_utils.default__log_info": {"name": "default__log_info", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "unique_id": "macro.dbt_utils.default__log_info", "macro_sql": "{% macro default__log_info(message) %}\n    {{ log(dbt_utils.pretty_log_format(message), info=True) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.195074, "supported_languages": null}, "macro.dbt_utils.slugify": {"name": "slugify", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/slugify.sql", "original_file_path": "macros/jinja_helpers/slugify.sql", "unique_id": "macro.dbt_utils.slugify", "macro_sql": "{% macro slugify(string) %}\n\n{#- Lower case the string -#}\n{% set string = string | lower %}\n{#- Replace spaces and dashes with underscores -#}\n{% set string = modules.re.sub('[ -]+', '_', string) %}\n{#- Only take letters, numbers, and underscores -#}\n{% set string = modules.re.sub('[^a-z0-9_]+', '', string) %}\n{#- Prepends \"_\" if string begins with a number -#}\n{% set string = modules.re.sub('^[0-9]', '_' + string[0], string) %}\n\n{{ return(string) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.195699, "supported_languages": null}, "macro.dbt_utils._is_ephemeral": {"name": "_is_ephemeral", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/_is_ephemeral.sql", "original_file_path": "macros/jinja_helpers/_is_ephemeral.sql", "unique_id": "macro.dbt_utils._is_ephemeral", "macro_sql": "{% macro _is_ephemeral(obj, macro) %}\n    {%- if obj.is_cte -%}\n        {% set ephemeral_prefix = api.Relation.add_ephemeral_prefix('') %}\n        {% if obj.name.startswith(ephemeral_prefix) %}\n            {% set model_name = obj.name[(ephemeral_prefix|length):] %}\n        {% else %}\n            {% set model_name = obj.name %}\n        {%- endif -%}\n        {% set error_message %}\nThe `{{ macro }}` macro cannot be used with ephemeral models, as it relies on the information schema.\n\n`{{ model_name }}` is an ephemeral model. Consider making it a view or table instead.\n        {% endset %}\n        {%- do exceptions.raise_compiler_error(error_message) -%}\n    {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1965399, "supported_languages": null}, "macro.dbt_utils.get_intervals_between": {"name": "get_intervals_between", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n    {{ return(adapter.dispatch('get_intervals_between', 'dbt_utils')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.197255, "supported_languages": null}, "macro.dbt_utils.default__get_intervals_between": {"name": "default__get_intervals_between", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n    {%- call statement('get_intervals_between', fetch_result=True) %}\n\n        select {{ dbt.datediff(start_date, end_date, datepart) }}\n\n    {%- endcall -%}\n\n    {%- set value_list = load_result('get_intervals_between') -%}\n\n    {%- if value_list and value_list['data'] -%}\n        {%- set values = value_list['data'] | map(attribute=0) | list %}\n        {{ return(values[0]) }}\n    {%- else -%}\n        {{ return(1) }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.197858, "supported_languages": null}, "macro.dbt_utils.date_spine": {"name": "date_spine", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n    {{ return(adapter.dispatch('date_spine', 'dbt_utils')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.198091, "supported_languages": null}, "macro.dbt_utils.default__date_spine": {"name": "default__date_spine", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n{# call as follows:\n\ndate_spine(\n    \"day\",\n    \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n    \"dbt.dateadd(week, 1, current_date)\"\n) #}\n\n\nwith rawdata as (\n\n    {{dbt_utils.generate_series(\n        dbt_utils.get_intervals_between(start_date, end_date, datepart)\n    )}}\n\n),\n\nall_periods as (\n\n    select (\n        {{\n            dbt.dateadd(\n                datepart,\n                \"row_number() over (order by 1) - 1\",\n                start_date\n            )\n        }}\n    ) as date_{{datepart}}\n    from rawdata\n\n),\n\nfiltered as (\n\n    select *\n    from all_periods\n    where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.generate_series", "macro.dbt_utils.get_intervals_between", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.1984582, "supported_languages": null}, "macro.dbt_utils.safe_subtract": {"name": "safe_subtract", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_subtract.sql", "original_file_path": "macros/sql/safe_subtract.sql", "unique_id": "macro.dbt_utils.safe_subtract", "macro_sql": "{%- macro safe_subtract(field_list) -%}\n    {{ return(adapter.dispatch('safe_subtract', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_subtract"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.198842, "supported_languages": null}, "macro.dbt_utils.default__safe_subtract": {"name": "default__safe_subtract", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_subtract.sql", "original_file_path": "macros/sql/safe_subtract.sql", "unique_id": "macro.dbt_utils.default__safe_subtract", "macro_sql": "\n\n{%- macro default__safe_subtract(field_list) -%}\n\n{%- if field_list is not iterable or field_list is string or field_list is mapping -%}\n\n{%- set error_message = '\nWarning: the `safe_subtract` macro takes a single list argument instead of \\\nstring arguments. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.raise_compiler_error(error_message) -%}\n\n{%- endif -%}\n\n{% set fields = [] %}\n\n{%- for field in field_list -%}\n\n    {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' -\\n  ') }}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.199394, "supported_languages": null}, "macro.dbt_utils.nullcheck_table": {"name": "nullcheck_table", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "unique_id": "macro.dbt_utils.nullcheck_table", "macro_sql": "{% macro nullcheck_table(relation) %}\n    {{ return(adapter.dispatch('nullcheck_table', 'dbt_utils')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.199708, "supported_languages": null}, "macro.dbt_utils.default__nullcheck_table": {"name": "default__nullcheck_table", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "unique_id": "macro.dbt_utils.default__nullcheck_table", "macro_sql": "{% macro default__nullcheck_table(relation) %}\n\n  {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%}\n  {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%}\n  {% set cols = adapter.get_columns_in_relation(relation) %}\n\n  select {{ dbt_utils.nullcheck(cols) }}\n  from {{relation}}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2000608, "supported_languages": null}, "macro.dbt_utils.get_relations_by_pattern": {"name": "get_relations_by_pattern", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "unique_id": "macro.dbt_utils.get_relations_by_pattern", "macro_sql": "{% macro get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {{ return(adapter.dispatch('get_relations_by_pattern', 'dbt_utils')(schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.200758, "supported_languages": null}, "macro.dbt_utils.default__get_relations_by_pattern": {"name": "default__get_relations_by_pattern", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "unique_id": "macro.dbt_utils.default__get_relations_by_pattern", "macro_sql": "{% macro default__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n    {%- call statement('get_tables', fetch_result=True) %}\n\n      {{ dbt_utils.get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude, database) }}\n\n    {%- endcall -%}\n\n    {%- set table_list = load_result('get_tables') -%}\n\n    {%- if table_list and table_list['table'] -%}\n        {%- set tbl_relations = [] -%}\n        {%- for row in table_list['table'] -%}\n            {%- set tbl_relation = api.Relation.create(\n                database=database,\n                schema=row.table_schema,\n                identifier=row.table_name,\n                type=row.table_type\n            ) -%}\n            {%- do tbl_relations.append(tbl_relation) -%}\n        {%- endfor -%}\n\n        {{ return(tbl_relations) }}\n    {%- else -%}\n        {{ return([]) }}\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.201691, "supported_languages": null}, "macro.dbt_utils.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n    {{ return(adapter.dispatch('get_powers_of_two', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.202538, "supported_languages": null}, "macro.dbt_utils.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n    {% if upper_bound <= 0 %}\n    {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n    {% endif %}\n\n    {% for _ in range(1, 100) %}\n       {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n    {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2029629, "supported_languages": null}, "macro.dbt_utils.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n    {{ return(adapter.dispatch('generate_series', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.203159, "supported_languages": null}, "macro.dbt_utils.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n    {% set n = dbt_utils.get_powers_of_two(upper_bound) %}\n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    {% for i in range(n) %}\n    p{{i}}.generated_number * power(2, {{i}})\n    {% if not loop.last %} + {% endif %}\n    {% endfor %}\n    + 1\n    as generated_number\n\n    from\n\n    {% for i in range(n) %}\n    p as p{{i}}\n    {% if not loop.last %} cross join {% endif %}\n    {% endfor %}\n\n    )\n\n    select *\n    from unioned\n    where generated_number <= {{upper_bound}}\n    order by generated_number\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.203687, "supported_languages": null}, "macro.dbt_utils.get_relations_by_prefix": {"name": "get_relations_by_prefix", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "unique_id": "macro.dbt_utils.get_relations_by_prefix", "macro_sql": "{% macro get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n    {{ return(adapter.dispatch('get_relations_by_prefix', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.204375, "supported_languages": null}, "macro.dbt_utils.default__get_relations_by_prefix": {"name": "default__get_relations_by_prefix", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "unique_id": "macro.dbt_utils.default__get_relations_by_prefix", "macro_sql": "{% macro default__get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n\n    {%- call statement('get_tables', fetch_result=True) %}\n\n      {{ dbt_utils.get_tables_by_prefix_sql(schema, prefix, exclude, database) }}\n\n    {%- endcall -%}\n\n    {%- set table_list = load_result('get_tables') -%}\n\n    {%- if table_list and table_list['table'] -%}\n        {%- set tbl_relations = [] -%}\n        {%- for row in table_list['table'] -%}\n            {%- set tbl_relation = api.Relation.create(\n                database=database,\n                schema=row.table_schema,\n                identifier=row.table_name,\n                type=row.table_type\n            ) -%}\n            {%- do tbl_relations.append(tbl_relation) -%}\n        {%- endfor -%}\n\n        {{ return(tbl_relations) }}\n    {%- else -%}\n        {{ return([]) }}\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.205238, "supported_languages": null}, "macro.dbt_utils.get_tables_by_prefix_sql": {"name": "get_tables_by_prefix_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "unique_id": "macro.dbt_utils.get_tables_by_prefix_sql", "macro_sql": "{% macro get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n    {{ return(adapter.dispatch('get_tables_by_prefix_sql', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.205657, "supported_languages": null}, "macro.dbt_utils.default__get_tables_by_prefix_sql": {"name": "default__get_tables_by_prefix_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "unique_id": "macro.dbt_utils.default__get_tables_by_prefix_sql", "macro_sql": "{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n\n    {{ dbt_utils.get_tables_by_pattern_sql(\n        schema_pattern = schema,\n        table_pattern = prefix ~ '%',\n        exclude = exclude,\n        database = database\n    ) }}\n    \n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.205947, "supported_languages": null}, "macro.dbt_utils.star": {"name": "star", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "unique_id": "macro.dbt_utils.star", "macro_sql": "{% macro star(from, relation_alias=False, except=[], prefix='', suffix='', quote_identifiers=True) -%}\r\n    {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix, quote_identifiers)) }}\r\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__star"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.207226, "supported_languages": null}, "macro.dbt_utils.default__star": {"name": "default__star", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "unique_id": "macro.dbt_utils.default__star", "macro_sql": "{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='', quote_identifiers=True) -%}\r\n    {%- do dbt_utils._is_relation(from, 'star') -%}\r\n    {%- do dbt_utils._is_ephemeral(from, 'star') -%}\r\n\r\n    {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\r\n    {%- if not execute -%}\r\n        {% do return('*') %}\r\n    {%- endif -%}\r\n\r\n    {% set cols = dbt_utils.get_filtered_columns_in_relation(from, except) %}\r\n\r\n    {%- if cols|length <= 0 -%}\r\n        {% if flags.WHICH == 'compile' %}\r\n            {% set response %}\r\n*\r\n/* No columns were returned. Maybe the relation doesn't exist yet \r\nor all columns were excluded. This star is only output during  \r\ndbt compile, and exists to keep SQLFluff happy. */\r\n            {% endset %}\r\n            {% do return(response) %}\r\n        {% else %}\r\n            {% do return(\"/* no columns returned from star() macro */\") %}\r\n        {% endif %}\r\n    {%- else -%}\r\n        {%- for col in cols %}\r\n            {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%}\r\n                {%- if quote_identifiers -%}\r\n                    {{ adapter.quote(col)|trim }} {%- if prefix!='' or suffix!='' %} as {{ adapter.quote(prefix ~ col ~ suffix)|trim }} {%- endif -%}\r\n                {%- else -%}\r\n                    {{ col|trim }} {%- if prefix!='' or suffix!='' %} as {{ (prefix ~ col ~ suffix)|trim }} {%- endif -%}\r\n                {% endif %}\r\n            {%- if not loop.last %},{{ '\\n  ' }}{%- endif -%}\r\n        {%- endfor -%}\r\n    {% endif %}\r\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.208668, "supported_languages": null}, "macro.dbt_utils.unpivot": {"name": "unpivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "unique_id": "macro.dbt_utils.unpivot", "macro_sql": "{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value') -%}\n    {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__unpivot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.21002, "supported_languages": null}, "macro.dbt_utils.default__unpivot": {"name": "default__unpivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "unique_id": "macro.dbt_utils.default__unpivot", "macro_sql": "{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value') -%}\n\n    {% if not relation %}\n        {{ exceptions.raise_compiler_error(\"Error: argument `relation` is required for `unpivot` macro.\") }}\n    {% endif %}\n\n  {%- set exclude = exclude if exclude is not none else [] %}\n  {%- set remove = remove if remove is not none else [] %}\n\n  {%- set include_cols = [] %}\n\n  {%- set table_columns = {} %}\n\n  {%- do table_columns.update({relation: []}) %}\n\n  {%- do dbt_utils._is_relation(relation, 'unpivot') -%}\n  {%- do dbt_utils._is_ephemeral(relation, 'unpivot') -%}\n  {%- set cols = adapter.get_columns_in_relation(relation) %}\n\n  {%- for col in cols -%}\n    {%- if col.column.lower() not in remove|map('lower') and col.column.lower() not in exclude|map('lower') -%}\n      {% do include_cols.append(col) %}\n    {%- endif %}\n  {%- endfor %}\n\n\n  {%- for col in include_cols -%}\n    select\n      {%- for exclude_col in exclude %}\n        {{ exclude_col }},\n      {%- endfor %}\n\n      cast('{{ col.column }}' as {{ dbt.type_string() }}) as {{ field_name }},\n      cast(  {% if col.data_type == 'boolean' %}\n           {{ dbt.cast_bool_to_text(col.column) }}\n             {% else %}\n           {{ col.column }}\n             {% endif %}\n           as {{ cast_to }}) as {{ value_name }}\n\n    from {{ relation }}\n\n    {% if not loop.last -%}\n      union all\n    {% endif -%}\n  {%- endfor -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.type_string", "macro.dbt.cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.211705, "supported_languages": null}, "macro.dbt_utils.safe_divide": {"name": "safe_divide", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_divide.sql", "original_file_path": "macros/sql/safe_divide.sql", "unique_id": "macro.dbt_utils.safe_divide", "macro_sql": "{% macro safe_divide(numerator, denominator) -%}\n  {{ return(adapter.dispatch('safe_divide', 'dbt_utils')(numerator, denominator)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_divide"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2120051, "supported_languages": null}, "macro.dbt_utils.default__safe_divide": {"name": "default__safe_divide", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_divide.sql", "original_file_path": "macros/sql/safe_divide.sql", "unique_id": "macro.dbt_utils.default__safe_divide", "macro_sql": "{% macro default__safe_divide(numerator, denominator) %}\n    ( {{ numerator }} ) / nullif( ( {{ denominator }} ), 0)\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.212142, "supported_languages": null}, "macro.dbt_utils.union_relations": {"name": "union_relations", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "unique_id": "macro.dbt_utils.union_relations", "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n    {{ return(adapter.dispatch('union_relations', 'dbt_utils')(relations, column_override, include, exclude, source_column_name, where)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__union_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.21537, "supported_languages": null}, "macro.dbt_utils.default__union_relations": {"name": "default__union_relations", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "unique_id": "macro.dbt_utils.default__union_relations", "macro_sql": "\n\n{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n\n    {%- if exclude and include -%}\n        {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n    {%- endif -%}\n\n    {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n    {%- if not execute %}\n        {{ return('') }}\n    {% endif -%}\n\n    {%- set column_override = column_override if column_override is not none else {} -%}\n\n    {%- set relation_columns = {} -%}\n    {%- set column_superset = {} -%}\n    {%- set all_excludes = [] -%}\n    {%- set all_includes = [] -%}\n\n    {%- if exclude -%}\n        {%- for exc in exclude -%}\n            {%- do all_excludes.append(exc | lower) -%}\n        {%- endfor -%}\n    {%- endif -%}\n\n    {%- if include -%}\n        {%- for inc in include -%}\n            {%- do all_includes.append(inc | lower) -%}\n        {%- endfor -%}\n    {%- endif -%}\n\n    {%- for relation in relations -%}\n\n        {%- do relation_columns.update({relation: []}) -%}\n\n        {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n        {%- do dbt_utils._is_ephemeral(relation, 'union_relations') -%}\n        {%- set cols = adapter.get_columns_in_relation(relation) -%}\n        {%- for col in cols -%}\n\n        {#- If an exclude list was provided and the column is in the list, do nothing -#}\n        {%- if exclude and col.column | lower in all_excludes -%}\n\n        {#- If an include list was provided and the column is not in the list, do nothing -#}\n        {%- elif include and col.column | lower not in all_includes -%}\n\n        {#- Otherwise add the column to the column superset -#}\n        {%- else -%}\n\n            {#- update the list of columns in this relation -#}\n            {%- do relation_columns[relation].append(col.column) -%}\n\n            {%- if col.column in column_superset -%}\n\n                {%- set stored = column_superset[col.column] -%}\n                {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n                    {%- do column_superset.update({col.column: col}) -%}\n\n                {%- endif %}\n\n            {%- else -%}\n\n                {%- do column_superset.update({col.column: col}) -%}\n\n            {%- endif -%}\n\n        {%- endif -%}\n\n        {%- endfor -%}\n    {%- endfor -%}\n\n    {%- set ordered_column_names = column_superset.keys() -%}\n    {%- set dbt_command = flags.WHICH -%}\n\n\n    {% if dbt_command in ['run', 'build'] %}\n    {% if (include | length > 0 or exclude | length > 0) and not column_superset.keys() %}\n        {%- set relations_string -%}\n            {%- for relation in relations -%}\n                {{ relation.name }}\n            {%- if not loop.last %}, {% endif -%}\n            {%- endfor -%}\n        {%- endset -%}\n\n        {%- set error_message -%}\n            There were no columns found to union for relations {{ relations_string }}\n        {%- endset -%}\n\n        {{ exceptions.raise_compiler_error(error_message) }}\n    {%- endif -%}\n    {%- endif -%}\n\n    {%- for relation in relations %}\n\n        (\n            select\n\n                {%- if source_column_name is not none %}\n                cast({{ dbt.string_literal(relation) }} as {{ dbt.type_string() }}) as {{ source_column_name }},\n                {%- endif %}\n\n                {% for col_name in ordered_column_names -%}\n\n                    {%- set col = column_superset[col_name] %}\n                    {%- set col_type = column_override.get(col.column, col.data_type) %}\n                    {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n                    cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n                {%- endfor %}\n\n            from {{ relation }}\n\n            {% if where -%}\n            where {{ where }}\n            {%- endif %}\n        )\n\n        {% if not loop.last -%}\n            union all\n        {% endif -%}\n\n    {%- endfor -%}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.string_literal", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.21891, "supported_languages": null}, "macro.dbt_utils.group_by": {"name": "group_by", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "unique_id": "macro.dbt_utils.group_by", "macro_sql": "{%- macro group_by(n) -%}\n    {{ return(adapter.dispatch('group_by', 'dbt_utils')(n)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__group_by"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.219218, "supported_languages": null}, "macro.dbt_utils.default__group_by": {"name": "default__group_by", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "unique_id": "macro.dbt_utils.default__group_by", "macro_sql": "\n\n{%- macro default__group_by(n) -%}\n\n  group by {% for i in range(1, n + 1) -%}\n      {{ i }}{{ ',' if not loop.last }}   \n   {%- endfor -%}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.219476, "supported_languages": null}, "macro.dbt_utils.deduplicate": {"name": "deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.deduplicate", "macro_sql": "{%- macro deduplicate(relation, partition_by, order_by) -%}\n    {{ return(adapter.dispatch('deduplicate', 'dbt_utils')(relation, partition_by, order_by)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.snowflake__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.220244, "supported_languages": null}, "macro.dbt_utils.default__deduplicate": {"name": "default__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.default__deduplicate", "macro_sql": "\n\n{%- macro default__deduplicate(relation, partition_by, order_by) -%}\n\n    with row_numbered as (\n        select\n            _inner.*,\n            row_number() over (\n                partition by {{ partition_by }}\n                order by {{ order_by }}\n            ) as rn\n        from {{ relation }} as _inner\n    )\n\n    select\n        distinct data.*\n    from {{ relation }} as data\n    {#\n    -- Not all DBs will support natural joins but the ones that do include:\n    -- Oracle, MySQL, SQLite, Redshift, Teradata, Materialize, Databricks\n    -- Apache Spark, SingleStore, Vertica\n    -- Those that do not appear to support natural joins include:\n    -- SQLServer, Trino, Presto, Rockset, Athena\n    #}\n    natural join row_numbered\n    where row_numbered.rn = 1\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.220463, "supported_languages": null}, "macro.dbt_utils.redshift__deduplicate": {"name": "redshift__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.redshift__deduplicate", "macro_sql": "{% macro redshift__deduplicate(relation, partition_by, order_by) -%}\n\n    {{ return(dbt_utils.default__deduplicate(relation, partition_by, order_by=order_by)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.220672, "supported_languages": null}, "macro.dbt_utils.postgres__deduplicate": {"name": "postgres__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.postgres__deduplicate", "macro_sql": "\n{%- macro postgres__deduplicate(relation, partition_by, order_by) -%}\n\n    select\n        distinct on ({{ partition_by }}) *\n    from {{ relation }}\n    order by {{ partition_by }}{{ ',' ~ order_by }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.220872, "supported_languages": null}, "macro.dbt_utils.snowflake__deduplicate": {"name": "snowflake__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.snowflake__deduplicate", "macro_sql": "\n{%- macro snowflake__deduplicate(relation, partition_by, order_by) -%}\n\n    select *\n    from {{ relation }}\n    qualify\n        row_number() over (\n            partition by {{ partition_by }}\n            order by {{ order_by }}\n        ) = 1\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.221045, "supported_languages": null}, "macro.dbt_utils.bigquery__deduplicate": {"name": "bigquery__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.bigquery__deduplicate", "macro_sql": "\n{%- macro bigquery__deduplicate(relation, partition_by, order_by) -%}\n\n    select unique.*\n    from (\n        select\n            array_agg (\n                original\n                order by {{ order_by }}\n                limit 1\n            )[offset(0)] unique\n        from {{ relation }} original\n        group by {{ partition_by }}\n    )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2212212, "supported_languages": null}, "macro.dbt_utils.surrogate_key": {"name": "surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "unique_id": "macro.dbt_utils.surrogate_key", "macro_sql": "{%- macro surrogate_key(field_list) -%}\n    {% set frustrating_jinja_feature = varargs %}\n    {{ return(adapter.dispatch('surrogate_key', 'dbt_utils')(field_list, *varargs)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.22161, "supported_languages": null}, "macro.dbt_utils.default__surrogate_key": {"name": "default__surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "unique_id": "macro.dbt_utils.default__surrogate_key", "macro_sql": "\n\n{%- macro default__surrogate_key(field_list) -%}\n\n{%- set error_message = '\nWarning: `dbt_utils.surrogate_key` has been replaced by \\\n`dbt_utils.generate_surrogate_key`. The new macro treats null values \\\ndifferently to empty strings. To restore the behaviour of the original \\\nmacro, add a global variable in dbt_project.yml called \\\n`surrogate_key_treat_nulls_as_empty_strings` to your \\\ndbt_project.yml file with a value of True. \\\nThe {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.raise_compiler_error(error_message) -%}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.221848, "supported_languages": null}, "macro.dbt_utils.safe_add": {"name": "safe_add", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "unique_id": "macro.dbt_utils.safe_add", "macro_sql": "{%- macro safe_add(field_list) -%}\n    {{ return(adapter.dispatch('safe_add', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_add"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2222269, "supported_languages": null}, "macro.dbt_utils.default__safe_add": {"name": "default__safe_add", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "unique_id": "macro.dbt_utils.default__safe_add", "macro_sql": "\n\n{%- macro default__safe_add(field_list) -%}\n\n{%- if field_list is not iterable or field_list is string or field_list is mapping -%}\n\n{%- set error_message = '\nWarning: the `safe_add` macro now takes a single list argument instead of \\\nstring arguments. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.warn(error_message) -%}\n\n{%- endif -%}\n\n{% set fields = [] %}\n\n{%- for field in field_list -%}\n\n    {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' +\\n  ') }}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.222775, "supported_languages": null}, "macro.dbt_utils.nullcheck": {"name": "nullcheck", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "unique_id": "macro.dbt_utils.nullcheck", "macro_sql": "{% macro nullcheck(cols) %}\n    {{ return(adapter.dispatch('nullcheck', 'dbt_utils')(cols)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.223116, "supported_languages": null}, "macro.dbt_utils.default__nullcheck": {"name": "default__nullcheck", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "unique_id": "macro.dbt_utils.default__nullcheck", "macro_sql": "{% macro default__nullcheck(cols) %}\n{%- for col in cols %}\n\n    {% if col.is_string() -%}\n\n    nullif({{col.name}},'') as {{col.name}}\n\n    {%- else -%}\n\n    {{col.name}}\n\n    {%- endif -%}\n\n{%- if not loop.last -%} , {%- endif -%}\n\n{%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.223455, "supported_languages": null}, "macro.dbt_utils.get_tables_by_pattern_sql": {"name": "get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.get_tables_by_pattern_sql", "macro_sql": "{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {{ return(adapter.dispatch('get_tables_by_pattern_sql', 'dbt_utils')\n        (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.225209, "supported_languages": null}, "macro.dbt_utils.default__get_tables_by_pattern_sql": {"name": "default__get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.default__get_tables_by_pattern_sql", "macro_sql": "{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n        select distinct\n            table_schema as {{ adapter.quote('table_schema') }},\n            table_name as {{ adapter.quote('table_name') }},\n            {{ dbt_utils.get_table_types_sql() }}\n        from {{ database }}.information_schema.tables\n        where table_schema ilike '{{ schema_pattern }}'\n        and table_name ilike '{{ table_pattern }}'\n        and table_name not ilike '{{ exclude }}'\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.225583, "supported_languages": null}, "macro.dbt_utils.bigquery__get_tables_by_pattern_sql": {"name": "bigquery__get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.bigquery__get_tables_by_pattern_sql", "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n    {% if '%' in schema_pattern %}\n        {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n    {% else %}\n        {% set schemata=[schema_pattern] %}\n    {% endif %}\n\n    {% set sql %}\n        {% for schema in schemata %}\n            select distinct\n                table_schema,\n                table_name,\n                {{ dbt_utils.get_table_types_sql() }}\n\n            from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES\n            where lower(table_name) like lower ('{{ table_pattern }}')\n                and lower(table_name) not like lower ('{{ exclude }}')\n\n            {% if not loop.last %} union all {% endif %}\n\n        {% endfor %}\n    {% endset %}\n\n    {{ return(sql) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._bigquery__get_matching_schemata", "macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.226378, "supported_languages": null}, "macro.dbt_utils._bigquery__get_matching_schemata": {"name": "_bigquery__get_matching_schemata", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils._bigquery__get_matching_schemata", "macro_sql": "{% macro _bigquery__get_matching_schemata(schema_pattern, database) %}\n    {% if execute %}\n\n        {% set sql %}\n        select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA\n        where lower(schema_name) like lower('{{ schema_pattern }}')\n        {% endset %}\n\n        {% set results=run_query(sql) %}\n\n        {% set schemata=results.columns['schema_name'].values() %}\n\n        {{ return(schemata) }}\n\n    {% else %}\n\n        {{ return([]) }}\n\n    {% endif %}\n\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.226895, "supported_languages": null}, "macro.dbt_utils.get_column_values": {"name": "get_column_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "unique_id": "macro.dbt_utils.get_column_values", "macro_sql": "{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n    {{ return(adapter.dispatch('get_column_values', 'dbt_utils')(table, column, order_by, max_records, default, where)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_column_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.228037, "supported_languages": null}, "macro.dbt_utils.default__get_column_values": {"name": "default__get_column_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "unique_id": "macro.dbt_utils.default__get_column_values", "macro_sql": "{% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n    {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n    {%- if not execute -%}\n        {% set default = [] if not default %}\n        {{ return(default) }}\n    {% endif %}\n\n    {%- do dbt_utils._is_ephemeral(table, 'get_column_values') -%}\n\n    {# Not all relations are tables. Renaming for internal clarity without breaking functionality for anyone using named arguments #}\n    {# TODO: Change the method signature in a future 0.x.0 release #}\n    {%- set target_relation = table -%}\n\n    {# adapter.load_relation is a convenience wrapper to avoid building a Relation when we already have one #}\n    {% set relation_exists = (load_relation(target_relation)) is not none %}\n\n    {%- call statement('get_column_values', fetch_result=true) %}\n\n        {%- if not relation_exists and default is none -%}\n\n          {{ exceptions.raise_compiler_error(\"In get_column_values(): relation \" ~ target_relation ~ \" does not exist and no default value was provided.\") }}\n\n        {%- elif not relation_exists and default is not none -%}\n\n          {{ log(\"Relation \" ~ target_relation ~ \" does not exist. Returning the default value: \" ~ default) }}\n\n          {{ return(default) }}\n\n        {%- else -%}\n\n\n            select\n                {{ column }} as value\n\n            from {{ target_relation }}\n\n            {% if where is not none %}\n            where {{ where }}\n            {% endif %}\n\n            group by {{ column }}\n            order by {{ order_by }}\n\n            {% if max_records is not none %}\n            limit {{ max_records }}\n            {% endif %}\n\n        {% endif %}\n\n    {%- endcall -%}\n\n    {%- set value_list = load_result('get_column_values') -%}\n\n    {%- if value_list and value_list['data'] -%}\n        {%- set values = value_list['data'] | map(attribute=0) | list %}\n        {{ return(values) }}\n    {%- else -%}\n        {{ return(default) }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_ephemeral", "macro.dbt.load_relation", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.229571, "supported_languages": null}, "macro.dbt_utils.pivot": {"name": "pivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "unique_id": "macro.dbt_utils.pivot", "macro_sql": "{% macro pivot(column,\n               values,\n               alias=True,\n               agg='sum',\n               cmp='=',\n               prefix='',\n               suffix='',\n               then_value=1,\n               else_value=0,\n               quote_identifiers=True,\n               distinct=False) %}\n    {{ return(adapter.dispatch('pivot', 'dbt_utils')(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pivot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.230655, "supported_languages": null}, "macro.dbt_utils.default__pivot": {"name": "default__pivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "unique_id": "macro.dbt_utils.default__pivot", "macro_sql": "{% macro default__pivot(column,\n               values,\n               alias=True,\n               agg='sum',\n               cmp='=',\n               prefix='',\n               suffix='',\n               then_value=1,\n               else_value=0,\n               quote_identifiers=True,\n               distinct=False) %}\n  {% for value in values %}\n    {{ agg }}(\n      {% if distinct %} distinct {% endif %}\n      case\n      when {{ column }} {{ cmp }} '{{ dbt.escape_single_quotes(value) }}'\n        then {{ then_value }}\n      else {{ else_value }}\n      end\n    )\n    {% if alias %}\n      {% if quote_identifiers %}\n            as {{ adapter.quote(prefix ~ value ~ suffix) }}\n      {% else %}\n        as {{ dbt_utils.slugify(prefix ~ value ~ suffix) }}\n      {% endif %}\n    {% endif %}\n    {% if not loop.last %},{% endif %}\n  {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.escape_single_quotes", "macro.dbt_utils.slugify"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.23152, "supported_languages": null}, "macro.dbt_utils.get_filtered_columns_in_relation": {"name": "get_filtered_columns_in_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "unique_id": "macro.dbt_utils.get_filtered_columns_in_relation", "macro_sql": "{% macro get_filtered_columns_in_relation(from, except=[]) -%}\n    {{ return(adapter.dispatch('get_filtered_columns_in_relation', 'dbt_utils')(from, except)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.23199, "supported_languages": null}, "macro.dbt_utils.default__get_filtered_columns_in_relation": {"name": "default__get_filtered_columns_in_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "unique_id": "macro.dbt_utils.default__get_filtered_columns_in_relation", "macro_sql": "{% macro default__get_filtered_columns_in_relation(from, except=[]) -%}\n    {%- do dbt_utils._is_relation(from, 'get_filtered_columns_in_relation') -%}\n    {%- do dbt_utils._is_ephemeral(from, 'get_filtered_columns_in_relation') -%}\n\n    {# -- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n    {%- if not execute -%}\n        {{ return('') }}\n    {% endif %}\n\n    {%- set include_cols = [] %}\n    {%- set cols = adapter.get_columns_in_relation(from) -%}\n    {%- set except = except | map(\"lower\") | list %}\n    {%- for col in cols -%}\n        {%- if col.column|lower not in except -%}\n            {% do include_cols.append(col.column) %}\n        {%- endif %}\n    {%- endfor %}\n\n    {{ return(include_cols) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2327302, "supported_languages": null}, "macro.dbt_utils.width_bucket": {"name": "width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.width_bucket", "macro_sql": "{% macro width_bucket(expr, min_value, max_value, num_buckets) %}\n  {{ return(adapter.dispatch('width_bucket', 'dbt_utils') (expr, min_value, max_value, num_buckets)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.snowflake__width_bucket"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.233523, "supported_languages": null}, "macro.dbt_utils.default__width_bucket": {"name": "default__width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.default__width_bucket", "macro_sql": "{% macro default__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n    {% set bin_size -%}\n    (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n    {%- endset %}\n    (\n        -- to break ties when the amount is eaxtly at the bucket egde\n        case\n            when\n                mod(\n                    {{ dbt.safe_cast(expr, dbt.type_numeric() ) }},\n                    {{ dbt.safe_cast(bin_size, dbt.type_numeric() ) }}\n                ) = 0\n            then 1\n            else 0\n        end\n    ) +\n      -- Anything over max_value goes the N+1 bucket\n    least(\n        ceil(\n            ({{ expr }} - {{ min_value }})/{{ bin_size }}\n        ),\n        {{ num_buckets }} + 1\n    )\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.safe_cast", "macro.dbt.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.233996, "supported_languages": null}, "macro.dbt_utils.snowflake__width_bucket": {"name": "snowflake__width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.snowflake__width_bucket", "macro_sql": "{% macro snowflake__width_bucket(expr, min_value, max_value, num_buckets) %}\n    width_bucket({{ expr }}, {{ min_value }}, {{ max_value }}, {{ num_buckets }} )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2341928, "supported_languages": null}, "macro.dbt_utils.get_query_results_as_dict": {"name": "get_query_results_as_dict", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "unique_id": "macro.dbt_utils.get_query_results_as_dict", "macro_sql": "{% macro get_query_results_as_dict(query) %}\n    {{ return(adapter.dispatch('get_query_results_as_dict', 'dbt_utils')(query)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_query_results_as_dict"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.234584, "supported_languages": null}, "macro.dbt_utils.default__get_query_results_as_dict": {"name": "default__get_query_results_as_dict", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "unique_id": "macro.dbt_utils.default__get_query_results_as_dict", "macro_sql": "{% macro default__get_query_results_as_dict(query) %}\n\n{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #}\n\n    {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%}\n\n        {{ query }}\n\n    {%- endcall -%}\n\n    {% set sql_results={} %}\n\n    {%- if execute -%}\n        {% set sql_results_table = load_result('get_query_results').table.columns %}\n        {% for column_name, column in sql_results_table.items() %}\n            {% do sql_results.update({column_name: column.values()}) %}\n        {% endfor %}\n    {%- endif -%}\n\n    {{ return(sql_results) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.235189, "supported_languages": null}, "macro.dbt_utils.generate_surrogate_key": {"name": "generate_surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_surrogate_key.sql", "original_file_path": "macros/sql/generate_surrogate_key.sql", "unique_id": "macro.dbt_utils.generate_surrogate_key", "macro_sql": "{%- macro generate_surrogate_key(field_list) -%}\n    {{ return(adapter.dispatch('generate_surrogate_key', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__generate_surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2356539, "supported_languages": null}, "macro.dbt_utils.default__generate_surrogate_key": {"name": "default__generate_surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_surrogate_key.sql", "original_file_path": "macros/sql/generate_surrogate_key.sql", "unique_id": "macro.dbt_utils.default__generate_surrogate_key", "macro_sql": "\n\n{%- macro default__generate_surrogate_key(field_list) -%}\n\n{%- if var('surrogate_key_treat_nulls_as_empty_strings', False) -%}\n    {%- set default_null_value = \"\" -%}\n{%- else -%}\n    {%- set default_null_value = '_dbt_utils_surrogate_key_null_' -%}\n{%- endif -%}\n\n{%- set fields = [] -%}\n\n{%- for field in field_list -%}\n\n    {%- do fields.append(\n        \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt.type_string() ~ \"), '\" ~ default_null_value  ~\"')\"\n    ) -%}\n\n    {%- if not loop.last %}\n        {%- do fields.append(\"'-'\") -%}\n    {%- endif -%}\n\n{%- endfor -%}\n\n{{ dbt.hash(dbt.concat(fields)) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.hash", "macro.dbt.concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.236297, "supported_languages": null}, "macro.dbt_utils.get_table_types_sql": {"name": "get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.get_table_types_sql", "macro_sql": "{%- macro get_table_types_sql() -%}\n  {{ return(adapter.dispatch('get_table_types_sql', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_utils.default__get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.236842, "supported_languages": null}, "macro.dbt_utils.default__get_table_types_sql": {"name": "default__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.default__get_table_types_sql", "macro_sql": "{% macro default__get_table_types_sql() %}\n            case table_type\n                when 'BASE TABLE' then 'table'\n                when 'EXTERNAL TABLE' then 'external'\n                when 'MATERIALIZED VIEW' then 'materializedview'\n                else lower(table_type)\n            end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2369869, "supported_languages": null}, "macro.dbt_utils.postgres__get_table_types_sql": {"name": "postgres__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.postgres__get_table_types_sql", "macro_sql": "{% macro postgres__get_table_types_sql() %}\n            case table_type\n                when 'BASE TABLE' then 'table'\n                when 'FOREIGN' then 'external'\n                when 'MATERIALIZED VIEW' then 'materializedview'\n                else lower(table_type)\n            end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2371268, "supported_languages": null}, "macro.dbt_utils.databricks__get_table_types_sql": {"name": "databricks__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.databricks__get_table_types_sql", "macro_sql": "{% macro databricks__get_table_types_sql() %}\n            case table_type\n                when 'MANAGED' then 'table'\n                when 'BASE TABLE' then 'table'\n                when 'MATERIALIZED VIEW' then 'materializedview'\n                else lower(table_type)\n            end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2372658, "supported_languages": null}, "macro.dbt_utils.get_single_value": {"name": "get_single_value", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_single_value.sql", "original_file_path": "macros/sql/get_single_value.sql", "unique_id": "macro.dbt_utils.get_single_value", "macro_sql": "{% macro get_single_value(query, default=none) %}\n    {{ return(adapter.dispatch('get_single_value', 'dbt_utils')(query, default)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_single_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2377841, "supported_languages": null}, "macro.dbt_utils.default__get_single_value": {"name": "default__get_single_value", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_single_value.sql", "original_file_path": "macros/sql/get_single_value.sql", "unique_id": "macro.dbt_utils.default__get_single_value", "macro_sql": "{% macro default__get_single_value(query, default) %}\n\n{# This macro returns the (0, 0) record in a query, i.e. the first row of the first column #}\n\n    {%- call statement('get_query_result', fetch_result=True, auto_begin=false) -%}\n\n        {{ query }}\n\n    {%- endcall -%}\n\n    {%- if execute -%}\n\n        {% set r = load_result('get_query_result').table.columns[0].values() %}\n        {% if r | length == 0 %}\n            {% do print('Query `' ~ query ~ '` returned no rows. Using the default value: ' ~ default) %}\n            {% set sql_result = default %}\n        {% else %}\n            {% set sql_result = r[0] %}\n        {% endif %}\n        \n    {%- else -%}\n    \n        {% set sql_result = default %}\n    \n    {%- endif -%}\n\n    {% do return(sql_result) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.238595, "supported_languages": null}, "macro.dbt_utils.degrees_to_radians": {"name": "degrees_to_radians", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.degrees_to_radians", "macro_sql": "{% macro degrees_to_radians(degrees) -%}\n    acos(-1) * {{degrees}} / 180\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.239687, "supported_languages": null}, "macro.dbt_utils.haversine_distance": {"name": "haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.haversine_distance", "macro_sql": "{% macro haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n    {{ return(adapter.dispatch('haversine_distance', 'dbt_utils')(lat1,lon1,lat2,lon2,unit)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__haversine_distance"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.239976, "supported_languages": null}, "macro.dbt_utils.default__haversine_distance": {"name": "default__haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{%- if unit == 'mi' %}\n    {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n    {% set conversion_rate = 1.60934 %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n\n    2 * 3961 * asin(sqrt(power((sin(radians(({{ lat2 }} - {{ lat1 }}) / 2))), 2) +\n    cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n    power((sin(radians(({{ lon2 }} - {{ lon1 }}) / 2))), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.240546, "supported_languages": null}, "macro.dbt_utils.bigquery__haversine_distance": {"name": "bigquery__haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.bigquery__haversine_distance", "macro_sql": "{% macro bigquery__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{% set radians_lat1 = dbt_utils.degrees_to_radians(lat1) %}\n{% set radians_lat2 = dbt_utils.degrees_to_radians(lat2) %}\n{% set radians_lon1 = dbt_utils.degrees_to_radians(lon1) %}\n{% set radians_lon2 = dbt_utils.degrees_to_radians(lon2) %}\n{%- if unit == 'mi' %}\n    {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n    {% set conversion_rate = 1.60934 %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n    2 * 3961 * asin(sqrt(power(sin(({{ radians_lat2 }} - {{ radians_lat1 }}) / 2), 2) +\n    cos({{ radians_lat1 }}) * cos({{ radians_lat2 }}) *\n    power(sin(({{ radians_lon2 }} - {{ radians_lon1 }}) / 2), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.degrees_to_radians"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2413702, "supported_languages": null}, "macro.spark_utils.get_tables": {"name": "get_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.get_tables", "macro_sql": "{% macro get_tables(table_regex_pattern='.*') %}\n\n  {% set tables = [] %}\n  {% for database in spark__list_schemas('not_used') %}\n    {% for table in spark__list_relations_without_caching(database[0]) %}\n      {% set db_tablename = database[0] ~ \".\" ~ table[1] %}\n      {% set is_match = modules.re.match(table_regex_pattern, db_tablename) %}\n      {% if is_match %}\n        {% call statement('table_detail', fetch_result=True) -%}\n          describe extended {{ db_tablename }}\n        {% endcall %}\n\n        {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('type', 'TYPE', 'Type'))|first %}\n        {% if table_type[1]|lower != 'view' %}\n          {{ tables.append(db_tablename) }}\n        {% endif %}\n      {% endif %}\n    {% endfor %}\n  {% endfor %}\n  {{ return(tables) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2467022, "supported_languages": null}, "macro.spark_utils.get_delta_tables": {"name": "get_delta_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.get_delta_tables", "macro_sql": "{% macro get_delta_tables(table_regex_pattern='.*') %}\n\n  {% set delta_tables = [] %}\n  {% for db_tablename in get_tables(table_regex_pattern) %}\n    {% call statement('table_detail', fetch_result=True) -%}\n      describe extended {{ db_tablename }}\n    {% endcall %}\n\n    {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('provider', 'PROVIDER', 'Provider'))|first %}\n    {% if table_type[1]|lower == 'delta' %}\n      {{ delta_tables.append(db_tablename) }}\n    {% endif %}\n  {% endfor %}\n  {{ return(delta_tables) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.247423, "supported_languages": null}, "macro.spark_utils.get_statistic_columns": {"name": "get_statistic_columns", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.get_statistic_columns", "macro_sql": "{% macro get_statistic_columns(table) %}\n\n  {% call statement('input_columns', fetch_result=True) %}\n    SHOW COLUMNS IN {{ table }}\n  {% endcall %}\n  {% set input_columns = load_result('input_columns').table %}\n\n  {% set output_columns = [] %}\n  {% for column in input_columns %}\n    {% call statement('column_information', fetch_result=True) %}\n      DESCRIBE TABLE {{ table }} `{{ column[0] }}`\n    {% endcall %}\n    {% if not load_result('column_information').table[1][1].startswith('struct') and not load_result('column_information').table[1][1].startswith('array')  %}\n      {{ output_columns.append('`' ~ column[0] ~ '`') }}\n    {% endif %}\n  {% endfor %}\n  {{ return(output_columns) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.248327, "supported_languages": null}, "macro.spark_utils.spark_optimize_delta_tables": {"name": "spark_optimize_delta_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.spark_optimize_delta_tables", "macro_sql": "{% macro spark_optimize_delta_tables(table_regex_pattern='.*') %}\n\n  {% for table in get_delta_tables(table_regex_pattern) %}\n    {% set start=modules.datetime.datetime.now() %}\n    {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Optimizing \" ~ table) }}\n    {% do run_query(\"optimize \" ~ table) %}\n    {% set end=modules.datetime.datetime.now() %}\n    {% set total_seconds = (end - start).total_seconds() | round(2)  %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n  {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.249076, "supported_languages": null}, "macro.spark_utils.spark_vacuum_delta_tables": {"name": "spark_vacuum_delta_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.spark_vacuum_delta_tables", "macro_sql": "{% macro spark_vacuum_delta_tables(table_regex_pattern='.*') %}\n\n  {% for table in get_delta_tables(table_regex_pattern) %}\n    {% set start=modules.datetime.datetime.now() %}\n    {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Vacuuming \" ~ table) }}\n    {% do run_query(\"vacuum \" ~ table) %}\n    {% set end=modules.datetime.datetime.now() %}\n    {% set total_seconds = (end - start).total_seconds() | round(2)  %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n  {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.249822, "supported_languages": null}, "macro.spark_utils.spark_analyze_tables": {"name": "spark_analyze_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.spark_analyze_tables", "macro_sql": "{% macro spark_analyze_tables(table_regex_pattern='.*') %}\n\n  {% for table in get_tables(table_regex_pattern) %}\n    {% set start=modules.datetime.datetime.now() %}\n    {% set columns = get_statistic_columns(table) | join(',') %}\n    {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Analyzing \" ~ table) }}\n    {% if columns != '' %}\n      {% do run_query(\"analyze table \" ~ table ~ \" compute statistics for columns \" ~ columns) %}\n    {% endif %}\n    {% set end=modules.datetime.datetime.now() %}\n    {% set total_seconds = (end - start).total_seconds() | round(2)  %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n  {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.spark_utils.get_statistic_columns", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.250798, "supported_languages": null}, "macro.spark_utils.spark__concat": {"name": "spark__concat", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/concat.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/concat.sql", "unique_id": "macro.spark_utils.spark__concat", "macro_sql": "{% macro spark__concat(fields) -%}\n    concat({{ fields|join(', ') }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.250978, "supported_languages": null}, "macro.spark_utils.spark__type_numeric": {"name": "spark__type_numeric", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "unique_id": "macro.spark_utils.spark__type_numeric", "macro_sql": "{% macro spark__type_numeric() %}\n    decimal(28, 6)\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2510898, "supported_languages": null}, "macro.spark_utils.spark__dateadd": {"name": "spark__dateadd", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "unique_id": "macro.spark_utils.spark__dateadd", "macro_sql": "{% macro spark__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n    {%- set clock_component -%}\n        {# make sure the dates + timestamps are real, otherwise raise an error asap #}\n        to_unix_timestamp({{ spark_utils.assert_not_null('to_timestamp', from_date_or_timestamp) }})\n        - to_unix_timestamp({{ spark_utils.assert_not_null('date', from_date_or_timestamp) }})\n    {%- endset -%}\n\n    {%- if datepart in ['day', 'week'] -%}\n        \n        {%- set multiplier = 7 if datepart == 'week' else 1 -%}\n\n        to_timestamp(\n            to_unix_timestamp(\n                date_add(\n                    {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n                    cast({{interval}} * {{multiplier}} as int)\n                )\n            ) + {{clock_component}}\n        )\n\n    {%- elif datepart in ['month', 'quarter', 'year'] -%}\n    \n        {%- set multiplier -%} \n            {%- if datepart == 'month' -%} 1\n            {%- elif datepart == 'quarter' -%} 3\n            {%- elif datepart == 'year' -%} 12\n            {%- endif -%}\n        {%- endset -%}\n\n        to_timestamp(\n            to_unix_timestamp(\n                add_months(\n                    {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n                    cast({{interval}} * {{multiplier}} as int)\n                )\n            ) + {{clock_component}}\n        )\n\n    {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n    \n        {%- set multiplier -%} \n            {%- if datepart == 'hour' -%} 3600\n            {%- elif datepart == 'minute' -%} 60\n            {%- elif datepart == 'second' -%} 1\n            {%- elif datepart == 'millisecond' -%} (1/1000000)\n            {%- elif datepart == 'microsecond' -%} (1/1000000)\n            {%- endif -%}\n        {%- endset -%}\n\n        to_timestamp(\n            {{ spark_utils.assert_not_null('to_unix_timestamp', from_date_or_timestamp) }}\n            + cast({{interval}} * {{multiplier}} as int)\n        )\n\n    {%- else -%}\n\n        {{ exceptions.raise_compiler_error(\"macro dateadd not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.254011, "supported_languages": null}, "macro.spark_utils.spark__datediff": {"name": "spark__datediff", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/datediff.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datediff.sql", "unique_id": "macro.spark_utils.spark__datediff", "macro_sql": "{% macro spark__datediff(first_date, second_date, datepart) %}\n\n    {%- if datepart in ['day', 'week', 'month', 'quarter', 'year'] -%}\n    \n        {# make sure the dates are real, otherwise raise an error asap #}\n        {% set first_date = spark_utils.assert_not_null('date', first_date) %}\n        {% set second_date = spark_utils.assert_not_null('date', second_date) %}\n    \n    {%- endif -%}\n    \n    {%- if datepart == 'day' -%}\n    \n        datediff({{second_date}}, {{first_date}})\n    \n    {%- elif datepart == 'week' -%}\n    \n        case when {{first_date}} < {{second_date}}\n            then floor(datediff({{second_date}}, {{first_date}})/7)\n            else ceil(datediff({{second_date}}, {{first_date}})/7)\n            end\n        \n        -- did we cross a week boundary (Sunday)?\n        + case\n            when {{first_date}} < {{second_date}} and dayofweek({{second_date}}) < dayofweek({{first_date}}) then 1\n            when {{first_date}} > {{second_date}} and dayofweek({{second_date}}) > dayofweek({{first_date}}) then -1\n            else 0 end\n\n    {%- elif datepart == 'month' -%}\n\n        case when {{first_date}} < {{second_date}}\n            then floor(months_between(date({{second_date}}), date({{first_date}})))\n            else ceil(months_between(date({{second_date}}), date({{first_date}})))\n            end\n        \n        -- did we cross a month boundary?\n        + case\n            when {{first_date}} < {{second_date}} and dayofmonth({{second_date}}) < dayofmonth({{first_date}}) then 1\n            when {{first_date}} > {{second_date}} and dayofmonth({{second_date}}) > dayofmonth({{first_date}}) then -1\n            else 0 end\n        \n    {%- elif datepart == 'quarter' -%}\n    \n        case when {{first_date}} < {{second_date}}\n            then floor(months_between(date({{second_date}}), date({{first_date}}))/3)\n            else ceil(months_between(date({{second_date}}), date({{first_date}}))/3)\n            end\n        \n        -- did we cross a quarter boundary?\n        + case\n            when {{first_date}} < {{second_date}} and (\n                (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n                < (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n            ) then 1\n            when {{first_date}} > {{second_date}} and (\n                (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n                > (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n            ) then -1\n            else 0 end\n\n    {%- elif datepart == 'year' -%}\n    \n        year({{second_date}}) - year({{first_date}})\n\n    {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n    \n        {%- set divisor -%} \n            {%- if datepart == 'hour' -%} 3600\n            {%- elif datepart == 'minute' -%} 60\n            {%- elif datepart == 'second' -%} 1\n            {%- elif datepart == 'millisecond' -%} (1/1000)\n            {%- elif datepart == 'microsecond' -%} (1/1000000)\n            {%- endif -%}\n        {%- endset -%}\n\n        case when {{first_date}} < {{second_date}}\n            then ceil((\n                {# make sure the timestamps are real, otherwise raise an error asap #}\n                {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n                - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n            ) / {{divisor}})\n            else floor((\n                {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n                - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n            ) / {{divisor}})\n            end\n            \n            {% if datepart == 'millisecond' %}\n                + cast(date_format({{second_date}}, 'SSS') as int)\n                - cast(date_format({{first_date}}, 'SSS') as int)\n            {% endif %}\n            \n            {% if datepart == 'microsecond' %}    \n                {% set capture_str = '[0-9]{4}-[0-9]{2}-[0-9]{2}.[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]{6})' %}\n                -- Spark doesn't really support microseconds, so this is a massive hack!\n                -- It will only work if the timestamp-string is of the format\n                -- 'yyyy-MM-dd-HH mm.ss.SSSSSS'\n                + cast(regexp_extract({{second_date}}, '{{capture_str}}', 1) as int)\n                - cast(regexp_extract({{first_date}}, '{{capture_str}}', 1) as int)    \n            {% endif %}\n\n    {%- else -%}\n\n        {{ exceptions.raise_compiler_error(\"macro datediff not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.261755, "supported_languages": null}, "macro.spark_utils.spark__current_timestamp": {"name": "spark__current_timestamp", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "unique_id": "macro.spark_utils.spark__current_timestamp", "macro_sql": "{% macro spark__current_timestamp() %}\n    current_timestamp()\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.261896, "supported_languages": null}, "macro.spark_utils.spark__current_timestamp_in_utc": {"name": "spark__current_timestamp_in_utc", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "unique_id": "macro.spark_utils.spark__current_timestamp_in_utc", "macro_sql": "{% macro spark__current_timestamp_in_utc() %}\n    unix_timestamp()\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.261973, "supported_languages": null}, "macro.spark_utils.spark__split_part": {"name": "spark__split_part", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/split_part.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/split_part.sql", "unique_id": "macro.spark_utils.spark__split_part", "macro_sql": "{% macro spark__split_part(string_text, delimiter_text, part_number) %}\n\n    {% set delimiter_expr %}\n    \n        -- escape if starts with a special character\n        case when regexp_extract({{ delimiter_text }}, '([^A-Za-z0-9])(.*)', 1) != '_'\n            then concat('\\\\', {{ delimiter_text }})\n            else {{ delimiter_text }} end\n    \n    {% endset %}\n\n    {% set split_part_expr %}\n    \n    split(\n        {{ string_text }},\n        {{ delimiter_expr }}\n        )[({{ part_number - 1 }})]\n    \n    {% endset %}\n    \n    {{ return(split_part_expr) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.262557, "supported_languages": null}, "macro.spark_utils.spark__get_relations_by_pattern": {"name": "spark__get_relations_by_pattern", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "unique_id": "macro.spark_utils.spark__get_relations_by_pattern", "macro_sql": "{% macro spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n    {%- call statement('get_tables', fetch_result=True) %}\n\n        show table extended in {{ schema_pattern }} like '{{ table_pattern }}'\n\n    {%- endcall -%}\n\n    {%- set table_list = load_result('get_tables') -%}\n\n    {%- if table_list and table_list['table'] -%}\n    {%- set tbl_relations = [] -%}\n    {%- for row in table_list['table'] -%}\n        {%- set tbl_relation = api.Relation.create(\n            database=None,\n            schema=row[0],\n            identifier=row[1],\n            type=('view' if 'Type: VIEW' in row[3] else 'table')\n        ) -%}\n        {%- do tbl_relations.append(tbl_relation) -%}\n    {%- endfor -%}\n\n    {{ return(tbl_relations) }}\n    {%- else -%}\n    {{ return([]) }}\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.264178, "supported_languages": null}, "macro.spark_utils.spark__get_relations_by_prefix": {"name": "spark__get_relations_by_prefix", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "unique_id": "macro.spark_utils.spark__get_relations_by_prefix", "macro_sql": "{% macro spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {% set table_pattern = table_pattern ~ '*' %}\n    {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.26453, "supported_languages": null}, "macro.spark_utils.spark__get_tables_by_pattern": {"name": "spark__get_tables_by_pattern", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "unique_id": "macro.spark_utils.spark__get_tables_by_pattern", "macro_sql": "{% macro spark__get_tables_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.26481, "supported_languages": null}, "macro.spark_utils.spark__get_tables_by_prefix": {"name": "spark__get_tables_by_prefix", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "unique_id": "macro.spark_utils.spark__get_tables_by_prefix", "macro_sql": "{% macro spark__get_tables_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {{ return(spark_utils.spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.265089, "supported_languages": null}, "macro.spark_utils.assert_not_null": {"name": "assert_not_null", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "unique_id": "macro.spark_utils.assert_not_null", "macro_sql": "{% macro assert_not_null(function, arg) -%}\n  {{ return(adapter.dispatch('assert_not_null', 'spark_utils')(function, arg)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.spark_utils.default__assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.265416, "supported_languages": null}, "macro.spark_utils.default__assert_not_null": {"name": "default__assert_not_null", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "unique_id": "macro.spark_utils.default__assert_not_null", "macro_sql": "{% macro default__assert_not_null(function, arg) %}\n\n    coalesce({{function}}({{arg}}), nvl2({{function}}({{arg}}), assert_true({{function}}({{arg}}) is not null), null))\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.265624, "supported_languages": null}, "macro.spark_utils.spark__convert_timezone": {"name": "spark__convert_timezone", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/snowplow/convert_timezone.sql", "original_file_path": "macros/snowplow/convert_timezone.sql", "unique_id": "macro.spark_utils.spark__convert_timezone", "macro_sql": "{% macro spark__convert_timezone(in_tz, out_tz, in_timestamp) %}\n    from_utc_timestamp(to_utc_timestamp({{in_timestamp}}, {{in_tz}}), {{out_tz}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2658281, "supported_languages": null}, "macro.dbt_date.get_date_dimension": {"name": "get_date_dimension", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_date_dimension.sql", "original_file_path": "macros/get_date_dimension.sql", "unique_id": "macro.dbt_date.get_date_dimension", "macro_sql": "{% macro get_date_dimension(start_date, end_date) %}\n    {{ adapter.dispatch('get_date_dimension', 'dbt_date') (start_date, end_date) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__get_date_dimension"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2749681, "supported_languages": null}, "macro.dbt_date.default__get_date_dimension": {"name": "default__get_date_dimension", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_date_dimension.sql", "original_file_path": "macros/get_date_dimension.sql", "unique_id": "macro.dbt_date.default__get_date_dimension", "macro_sql": "{% macro default__get_date_dimension(start_date, end_date) %}\nwith base_dates as (\n    {{ dbt_date.get_base_dates(start_date, end_date) }}\n),\ndates_with_prior_year_dates as (\n\n    select\n        cast(d.date_day as date) as date_day,\n        cast({{ dbt.dateadd('year', -1 , 'd.date_day') }} as date) as prior_year_date_day,\n        cast({{ dbt.dateadd('day', -364 , 'd.date_day') }} as date) as prior_year_over_year_date_day\n    from\n    \tbase_dates d\n\n)\nselect\n    d.date_day,\n    {{ dbt_date.yesterday('d.date_day') }} as prior_date_day,\n    {{ dbt_date.tomorrow('d.date_day') }} as next_date_day,\n    d.prior_year_date_day as prior_year_date_day,\n    d.prior_year_over_year_date_day,\n    {{ dbt_date.day_of_week('d.date_day', isoweek=false) }} as day_of_week,\n    {{ dbt_date.day_of_week('d.date_day', isoweek=true) }} as day_of_week_iso,\n    {{ dbt_date.day_name('d.date_day', short=false) }} as day_of_week_name,\n    {{ dbt_date.day_name('d.date_day', short=true) }} as day_of_week_name_short,\n    {{ dbt_date.day_of_month('d.date_day') }} as day_of_month,\n    {{ dbt_date.day_of_year('d.date_day') }} as day_of_year,\n\n    {{ dbt_date.week_start('d.date_day') }} as week_start_date,\n    {{ dbt_date.week_end('d.date_day') }} as week_end_date,\n    {{ dbt_date.week_start('d.prior_year_over_year_date_day') }} as prior_year_week_start_date,\n    {{ dbt_date.week_end('d.prior_year_over_year_date_day') }} as prior_year_week_end_date,\n    {{ dbt_date.week_of_year('d.date_day') }} as week_of_year,\n\n    {{ dbt_date.iso_week_start('d.date_day') }} as iso_week_start_date,\n    {{ dbt_date.iso_week_end('d.date_day') }} as iso_week_end_date,\n    {{ dbt_date.iso_week_start('d.prior_year_over_year_date_day') }} as prior_year_iso_week_start_date,\n    {{ dbt_date.iso_week_end('d.prior_year_over_year_date_day') }} as prior_year_iso_week_end_date,\n    {{ dbt_date.iso_week_of_year('d.date_day') }} as iso_week_of_year,\n\n    {{ dbt_date.week_of_year('d.prior_year_over_year_date_day') }} as prior_year_week_of_year,\n    {{ dbt_date.iso_week_of_year('d.prior_year_over_year_date_day') }} as prior_year_iso_week_of_year,\n\n    cast({{ dbt_date.date_part('month', 'd.date_day') }} as {{ dbt.type_int() }}) as month_of_year,\n    {{ dbt_date.month_name('d.date_day', short=false) }}  as month_name,\n    {{ dbt_date.month_name('d.date_day', short=true) }}  as month_name_short,\n\n    cast({{ dbt.date_trunc('month', 'd.date_day') }} as date) as month_start_date,\n    cast({{ last_day('d.date_day', 'month') }} as date) as month_end_date,\n\n    cast({{ dbt.date_trunc('month', 'd.prior_year_date_day') }} as date) as prior_year_month_start_date,\n    cast({{ last_day('d.prior_year_date_day', 'month') }} as date) as prior_year_month_end_date,\n\n    cast({{ dbt_date.date_part('quarter', 'd.date_day') }} as {{ dbt.type_int() }}) as quarter_of_year,\n    cast({{ dbt.date_trunc('quarter', 'd.date_day') }} as date) as quarter_start_date,\n    cast({{ last_day('d.date_day', 'quarter') }} as date) as quarter_end_date,\n\n    cast({{ dbt_date.date_part('year', 'd.date_day') }} as {{ dbt.type_int() }}) as year_number,\n    cast({{ dbt.date_trunc('year', 'd.date_day') }} as date) as year_start_date,\n    cast({{ last_day('d.date_day', 'year') }} as date) as year_end_date\nfrom\n    dates_with_prior_year_dates d\norder by 1\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.get_base_dates", "macro.dbt.dateadd", "macro.dbt_date.yesterday", "macro.dbt_date.tomorrow", "macro.dbt_date.day_of_week", "macro.dbt_date.day_name", "macro.dbt_date.day_of_month", "macro.dbt_date.day_of_year", "macro.dbt_date.week_start", "macro.dbt_date.week_end", "macro.dbt_date.week_of_year", "macro.dbt_date.iso_week_start", "macro.dbt_date.iso_week_end", "macro.dbt_date.iso_week_of_year", "macro.dbt_date.date_part", "macro.dbt.type_int", "macro.dbt_date.month_name", "macro.dbt.date_trunc", "macro.dbt.last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.277302, "supported_languages": null}, "macro.dbt_date.postgres__get_date_dimension": {"name": "postgres__get_date_dimension", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_date_dimension.sql", "original_file_path": "macros/get_date_dimension.sql", "unique_id": "macro.dbt_date.postgres__get_date_dimension", "macro_sql": "{% macro postgres__get_date_dimension(start_date, end_date) %}\nwith base_dates as (\n    {{ dbt_date.get_base_dates(start_date, end_date) }}\n),\ndates_with_prior_year_dates as (\n\n    select\n        cast(d.date_day as date) as date_day,\n        cast({{ dbt.dateadd('year', -1 , 'd.date_day') }} as date) as prior_year_date_day,\n        cast({{ dbt.dateadd('day', -364 , 'd.date_day') }} as date) as prior_year_over_year_date_day\n    from\n    \tbase_dates d\n\n)\nselect\n    d.date_day,\n    {{ dbt_date.yesterday('d.date_day') }} as prior_date_day,\n    {{ dbt_date.tomorrow('d.date_day') }} as next_date_day,\n    d.prior_year_date_day as prior_year_date_day,\n    d.prior_year_over_year_date_day,\n    {{ dbt_date.day_of_week('d.date_day', isoweek=true) }} as day_of_week,\n\n    {{ dbt_date.day_name('d.date_day', short=false) }} as day_of_week_name,\n    {{ dbt_date.day_name('d.date_day', short=true) }} as day_of_week_name_short,\n    {{ dbt_date.day_of_month('d.date_day') }} as day_of_month,\n    {{ dbt_date.day_of_year('d.date_day') }} as day_of_year,\n\n    {{ dbt_date.week_start('d.date_day') }} as week_start_date,\n    {{ dbt_date.week_end('d.date_day') }} as week_end_date,\n    {{ dbt_date.week_start('d.prior_year_over_year_date_day') }} as prior_year_week_start_date,\n    {{ dbt_date.week_end('d.prior_year_over_year_date_day') }} as prior_year_week_end_date,\n    {{ dbt_date.week_of_year('d.date_day') }} as week_of_year,\n\n    {{ dbt_date.iso_week_start('d.date_day') }} as iso_week_start_date,\n    {{ dbt_date.iso_week_end('d.date_day') }} as iso_week_end_date,\n    {{ dbt_date.iso_week_start('d.prior_year_over_year_date_day') }} as prior_year_iso_week_start_date,\n    {{ dbt_date.iso_week_end('d.prior_year_over_year_date_day') }} as prior_year_iso_week_end_date,\n    {{ dbt_date.iso_week_of_year('d.date_day') }} as iso_week_of_year,\n\n    {{ dbt_date.week_of_year('d.prior_year_over_year_date_day') }} as prior_year_week_of_year,\n    {{ dbt_date.iso_week_of_year('d.prior_year_over_year_date_day') }} as prior_year_iso_week_of_year,\n\n    cast({{ dbt_date.date_part('month', 'd.date_day') }} as {{ dbt.type_int() }}) as month_of_year,\n    {{ dbt_date.month_name('d.date_day', short=false) }}  as month_name,\n    {{ dbt_date.month_name('d.date_day', short=true) }}  as month_name_short,\n\n    cast({{ dbt.date_trunc('month', 'd.date_day') }} as date) as month_start_date,\n    cast({{ last_day('d.date_day', 'month') }} as date) as month_end_date,\n\n    cast({{ dbt.date_trunc('month', 'd.prior_year_date_day') }} as date) as prior_year_month_start_date,\n    cast({{ last_day('d.prior_year_date_day', 'month') }} as date) as prior_year_month_end_date,\n\n    cast({{ dbt_date.date_part('quarter', 'd.date_day') }} as {{ dbt.type_int() }}) as quarter_of_year,\n    cast({{ dbt.date_trunc('quarter', 'd.date_day') }} as date) as quarter_start_date,\n    {# last_day does not support quarter because postgresql does not support quarter interval. #}\n    cast({{dbt.dateadd('day', '-1', dbt.dateadd('month', '3', dbt.date_trunc('quarter', 'd.date_day')))}} as date) as quarter_end_date,\n\n    cast({{ dbt_date.date_part('year', 'd.date_day') }} as {{ dbt.type_int() }}) as year_number,\n    cast({{ dbt.date_trunc('year', 'd.date_day') }} as date) as year_start_date,\n    cast({{ last_day('d.date_day', 'year') }} as date) as year_end_date\nfrom\n    dates_with_prior_year_dates d\norder by 1\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.get_base_dates", "macro.dbt.dateadd", "macro.dbt_date.yesterday", "macro.dbt_date.tomorrow", "macro.dbt_date.day_of_week", "macro.dbt_date.day_name", "macro.dbt_date.day_of_month", "macro.dbt_date.day_of_year", "macro.dbt_date.week_start", "macro.dbt_date.week_end", "macro.dbt_date.week_of_year", "macro.dbt_date.iso_week_start", "macro.dbt_date.iso_week_end", "macro.dbt_date.iso_week_of_year", "macro.dbt_date.date_part", "macro.dbt.type_int", "macro.dbt_date.month_name", "macro.dbt.date_trunc", "macro.dbt.last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.279658, "supported_languages": null}, "macro.dbt_date.get_base_dates": {"name": "get_base_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "unique_id": "macro.dbt_date.get_base_dates", "macro_sql": "{% macro get_base_dates(start_date=None, end_date=None, n_dateparts=None, datepart=\"day\") %}\n    {{ adapter.dispatch('get_base_dates', 'dbt_date') (start_date, end_date, n_dateparts, datepart) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__get_base_dates"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2813141, "supported_languages": null}, "macro.dbt_date.default__get_base_dates": {"name": "default__get_base_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "unique_id": "macro.dbt_date.default__get_base_dates", "macro_sql": "{% macro default__get_base_dates(start_date, end_date, n_dateparts, datepart) %}\n\n{%- if start_date and end_date -%}\n{%- set start_date=\"cast('\" ~ start_date ~ \"' as \" ~ dbt.type_timestamp() ~ \")\" -%}\n{%- set end_date=\"cast('\" ~ end_date ~ \"' as \" ~ dbt.type_timestamp() ~ \")\"  -%}\n\n{%- elif n_dateparts and datepart -%}\n\n{%- set start_date = dbt.dateadd(datepart, -1 * n_dateparts, dbt_date.today()) -%}\n{%- set end_date = dbt_date.tomorrow() -%}\n{%- endif -%}\n\nwith date_spine as\n(\n\n    {{ dbt_date.date_spine(\n        datepart=datepart,\n        start_date=start_date,\n        end_date=end_date,\n       )\n    }}\n\n)\nselect\n    cast(d.date_{{ datepart }} as {{ dbt.type_timestamp() }}) as date_{{ datepart }}\nfrom\n    date_spine d\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp", "macro.dbt.dateadd", "macro.dbt_date.today", "macro.dbt_date.tomorrow", "macro.dbt_date.date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.282076, "supported_languages": null}, "macro.dbt_date.bigquery__get_base_dates": {"name": "bigquery__get_base_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "unique_id": "macro.dbt_date.bigquery__get_base_dates", "macro_sql": "{% macro bigquery__get_base_dates(start_date, end_date, n_dateparts, datepart) %}\n\n{%- if start_date and end_date -%}\n{%- set start_date=\"cast('\" ~ start_date ~ \"' as datetime )\" -%}\n{%- set end_date=\"cast('\" ~ end_date ~ \"' as datetime )\" -%}\n\n{%- elif n_dateparts and datepart -%}\n\n{%- set start_date = dbt.dateadd(datepart, -1 * n_dateparts, dbt_date.today()) -%}\n{%- set end_date = dbt_date.tomorrow() -%}\n{%- endif -%}\n\nwith date_spine as\n(\n\n    {{ dbt_date.date_spine(\n        datepart=datepart,\n        start_date=start_date,\n        end_date=end_date,\n       )\n    }}\n\n)\nselect\n    cast(d.date_{{ datepart }} as {{ dbt.type_timestamp() }}) as date_{{ datepart }}\nfrom\n    date_spine d\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt_date.today", "macro.dbt_date.tomorrow", "macro.dbt_date.date_spine", "macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2827652, "supported_languages": null}, "macro.dbt_date.trino__get_base_dates": {"name": "trino__get_base_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "unique_id": "macro.dbt_date.trino__get_base_dates", "macro_sql": "{% macro trino__get_base_dates(start_date, end_date, n_dateparts, datepart) %}\n\n{%- if start_date and end_date -%}\n{%- set start_date=\"cast('\" ~ start_date ~ \"' as \" ~ dbt.type_timestamp() ~ \")\" -%}\n{%- set end_date=\"cast('\" ~ end_date ~ \"' as \" ~ dbt.type_timestamp() ~ \")\"  -%}\n\n{%- elif n_dateparts and datepart -%}\n\n{%- set start_date = dbt.dateadd(datepart, -1 * n_dateparts, dbt_date.now()) -%}\n{%- set end_date = dbt_date.tomorrow() -%}\n{%- endif -%}\n\nwith date_spine as\n(\n\n    {{ dbt_date.date_spine(\n        datepart=datepart,\n        start_date=start_date,\n        end_date=end_date,\n       )\n    }}\n\n)\nselect\n    cast(d.date_{{ datepart }} as {{ dbt.type_timestamp() }}) as date_{{ datepart }}\nfrom\n    date_spine d\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp", "macro.dbt.dateadd", "macro.dbt_date.now", "macro.dbt_date.tomorrow", "macro.dbt_date.date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.283515, "supported_languages": null}, "macro.dbt_date.get_intervals_between": {"name": "get_intervals_between", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/date_spine.sql", "original_file_path": "macros/_utils/date_spine.sql", "unique_id": "macro.dbt_date.get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n    {{ return(adapter.dispatch('get_intervals_between', 'dbt_date')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.284232, "supported_languages": null}, "macro.dbt_date.default__get_intervals_between": {"name": "default__get_intervals_between", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/date_spine.sql", "original_file_path": "macros/_utils/date_spine.sql", "unique_id": "macro.dbt_date.default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n    {%- call statement('get_intervals_between', fetch_result=True) %}\n\n        select {{ dbt.datediff(start_date, end_date, datepart) }}\n\n    {%- endcall -%}\n\n    {%- set value_list = load_result('get_intervals_between') -%}\n\n    {%- if value_list and value_list['data'] -%}\n        {%- set values = value_list['data'] | map(attribute=0) | list %}\n        {{ return(values[0]) }}\n    {%- else -%}\n        {{ return(1) }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.284828, "supported_languages": null}, "macro.dbt_date.date_spine": {"name": "date_spine", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/date_spine.sql", "original_file_path": "macros/_utils/date_spine.sql", "unique_id": "macro.dbt_date.date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n    {{ return(adapter.dispatch('date_spine', 'dbt_date')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2850611, "supported_languages": null}, "macro.dbt_date.default__date_spine": {"name": "default__date_spine", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/date_spine.sql", "original_file_path": "macros/_utils/date_spine.sql", "unique_id": "macro.dbt_date.default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n{# call as follows:\n\ndate_spine(\n    \"day\",\n    \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n    \"dbt.dateadd(week, 1, current_date)\"\n) #}\n\n\nwith rawdata as (\n\n    {{\n        dbt_date.generate_series(\n            dbt_date.get_intervals_between(start_date, end_date, datepart)\n        )\n    }}\n\n),\n\nall_periods as (\n\n    select (\n        {{\n            dbt.dateadd(\n                datepart,\n                \"(row_number() over (order by 1) - 1)\",\n                start_date\n            )\n        }}\n    ) as date_{{datepart}}\n    from rawdata\n\n),\n\nfiltered as (\n\n    select *\n    from all_periods\n    where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.generate_series", "macro.dbt_date.get_intervals_between", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.285429, "supported_languages": null}, "macro.dbt_date.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/generate_series.sql", "original_file_path": "macros/_utils/generate_series.sql", "unique_id": "macro.dbt_date.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n    {{ return(adapter.dispatch('get_powers_of_two', 'dbt_date')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.286268, "supported_languages": null}, "macro.dbt_date.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/generate_series.sql", "original_file_path": "macros/_utils/generate_series.sql", "unique_id": "macro.dbt_date.default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n    {% if upper_bound <= 0 %}\n    {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n    {% endif %}\n\n    {% for _ in range(1, 100) %}\n       {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n    {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.28669, "supported_languages": null}, "macro.dbt_date.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/generate_series.sql", "original_file_path": "macros/_utils/generate_series.sql", "unique_id": "macro.dbt_date.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n    {{ return(adapter.dispatch('generate_series', 'dbt_date')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2868779, "supported_languages": null}, "macro.dbt_date.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/generate_series.sql", "original_file_path": "macros/_utils/generate_series.sql", "unique_id": "macro.dbt_date.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n    {% set n = dbt_date.get_powers_of_two(upper_bound) %}\n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    {% for i in range(n) %}\n    p{{i}}.generated_number * power(2, {{i}})\n    {% if not loop.last %} + {% endif %}\n    {% endfor %}\n    + 1\n    as generated_number\n\n    from\n\n    {% for i in range(n) %}\n    p as p{{i}}\n    {% if not loop.last %} cross join {% endif %}\n    {% endfor %}\n\n    )\n\n    select *\n    from unioned\n    where generated_number <= {{upper_bound}}\n    order by generated_number\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.287403, "supported_languages": null}, "macro.dbt_date.date": {"name": "date", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/modules_datetime.sql", "original_file_path": "macros/_utils/modules_datetime.sql", "unique_id": "macro.dbt_date.date", "macro_sql": "{% macro date(year, month, day) %}\n    {{ return(modules.datetime.date(year, month, day)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.287743, "supported_languages": null}, "macro.dbt_date.datetime": {"name": "datetime", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/modules_datetime.sql", "original_file_path": "macros/_utils/modules_datetime.sql", "unique_id": "macro.dbt_date.datetime", "macro_sql": "{% macro datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tz=None) %}\n    {% set tz = tz if tz else var(\"dbt_date:time_zone\") %}\n    {{ return(\n        modules.datetime.datetime(\n            year=year, month=month, day=day, hour=hour,\n            minute=minute, second=second, microsecond=microsecond,\n            tzinfo=modules.pytz.timezone(tz)\n        )\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.288306, "supported_languages": null}, "macro.dbt_date.get_fiscal_year_dates": {"name": "get_fiscal_year_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/fiscal_date/get_fiscal_year_dates.sql", "original_file_path": "macros/fiscal_date/get_fiscal_year_dates.sql", "unique_id": "macro.dbt_date.get_fiscal_year_dates", "macro_sql": "{% macro get_fiscal_year_dates(dates, year_end_month=12, week_start_day=1, shift_year=1) %}\n{{ adapter.dispatch('get_fiscal_year_dates', 'dbt_date') (dates, year_end_month, week_start_day, shift_year) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__get_fiscal_year_dates"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2901492, "supported_languages": null}, "macro.dbt_date.default__get_fiscal_year_dates": {"name": "default__get_fiscal_year_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/fiscal_date/get_fiscal_year_dates.sql", "original_file_path": "macros/fiscal_date/get_fiscal_year_dates.sql", "unique_id": "macro.dbt_date.default__get_fiscal_year_dates", "macro_sql": "{% macro default__get_fiscal_year_dates(dates, year_end_month, week_start_day, shift_year) %}\n-- this gets all the dates within a fiscal year\n-- determined by the given year-end-month\n-- ending on the saturday closest to that month's end date\nwith fsc_date_dimension as (\n    select * from {{ dates }}\n),\nyear_month_end as (\n\n    select\n       d.year_number - {{ shift_year }} as fiscal_year_number,\n       d.month_end_date\n    from\n        fsc_date_dimension d\n    where\n        d.month_of_year = {{ year_end_month }}\n    group by 1,2\n\n),\nweeks as (\n\n    select\n        d.year_number,\n        d.month_of_year,\n        d.date_day as week_start_date,\n        cast({{ dbt.dateadd('day', 6, 'd.date_day') }} as date) as week_end_date\n    from\n        fsc_date_dimension d\n    where\n        d.day_of_week = {{ week_start_day }}\n\n),\n-- get all the weeks that start in the month the year ends\nyear_week_ends as (\n\n    select\n        d.year_number - {{ shift_year }} as fiscal_year_number,\n        d.week_end_date\n    from\n        weeks d\n    where\n        d.month_of_year = {{ year_end_month }}\n    group by\n        1,2\n\n),\n-- then calculate which Saturday is closest to month end\nweeks_at_month_end as (\n\n    select\n        d.fiscal_year_number,\n        d.week_end_date,\n        m.month_end_date,\n        rank() over\n            (partition by d.fiscal_year_number\n                order by\n                abs({{ dbt.datediff('d.week_end_date', 'm.month_end_date', 'day') }})\n\n            ) as closest_to_month_end\n    from\n        year_week_ends d\n        join\n        year_month_end m on d.fiscal_year_number = m.fiscal_year_number\n),\nfiscal_year_range as (\n\n    select\n        w.fiscal_year_number,\n        cast(\n            {{ dbt.dateadd('day', 1,\n            'lag(w.week_end_date) over(order by w.week_end_date)') }}\n            as date) as fiscal_year_start_date,\n        w.week_end_date as fiscal_year_end_date\n    from\n        weeks_at_month_end w\n    where\n        w.closest_to_month_end = 1\n\n),\nfiscal_year_dates as (\n\n    select\n        d.date_day,\n        m.fiscal_year_number,\n        m.fiscal_year_start_date,\n        m.fiscal_year_end_date,\n        w.week_start_date,\n        w.week_end_date,\n        -- we reset the weeks of the year starting with the merch year start date\n        dense_rank()\n            over(\n                partition by m.fiscal_year_number\n                order by w.week_start_date\n                ) as fiscal_week_of_year\n    from\n        fsc_date_dimension d\n        join\n        fiscal_year_range m on d.date_day between m.fiscal_year_start_date and m.fiscal_year_end_date\n        join\n        weeks w on d.date_day between w.week_start_date and w.week_end_date\n\n)\nselect * from fiscal_year_dates order by 1\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.290764, "supported_languages": null}, "macro.dbt_date.get_fiscal_periods": {"name": "get_fiscal_periods", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/fiscal_date/get_fiscal_periods.sql", "original_file_path": "macros/fiscal_date/get_fiscal_periods.sql", "unique_id": "macro.dbt_date.get_fiscal_periods", "macro_sql": "{% macro get_fiscal_periods(dates, year_end_month, week_start_day, shift_year=1) %}\n{#\nThis macro requires you to pass in a ref to a date dimension, created via\ndbt_date.get_date_dimension()s\n#}\nwith fscl_year_dates_for_periods as (\n    {{ dbt_date.get_fiscal_year_dates(dates, year_end_month, week_start_day, shift_year) }}\n),\nfscl_year_w13 as (\n\n    select\n        f.*,\n        -- We count the weeks in a 13 week period\n        -- and separate the 4-5-4 week sequences\n        mod(cast(\n            (f.fiscal_week_of_year-1) as {{ dbt.type_int() }}\n            ), 13) as w13_number,\n        -- Chop weeks into 13 week merch quarters\n        cast(\n            least(\n                floor((f.fiscal_week_of_year-1)/13.0)\n                , 3)\n            as {{ dbt.type_int() }}) as quarter_number\n    from\n        fscl_year_dates_for_periods f\n\n),\nfscl_periods as (\n\n    select\n        f.date_day,\n        f.fiscal_year_number,\n        f.week_start_date,\n        f.week_end_date,\n        f.fiscal_week_of_year,\n        case\n            -- we move week 53 into the 3rd period of the quarter\n            when f.fiscal_week_of_year = 53 then 3\n            when f.w13_number between 0 and 3 then 1\n            when f.w13_number between 4 and 8 then 2\n            when f.w13_number between 9 and 12 then 3\n        end as period_of_quarter,\n        f.quarter_number\n    from\n        fscl_year_w13 f\n\n),\nfscl_periods_quarters as (\n\n    select\n        f.*,\n        cast((\n            (f.quarter_number * 3) + f.period_of_quarter\n         ) as {{ dbt.type_int() }}) as fiscal_period_number\n    from\n        fscl_periods f\n\n)\nselect\n    date_day,\n    fiscal_year_number,\n    week_start_date,\n    week_end_date,\n    fiscal_week_of_year,\n    dense_rank() over(partition by fiscal_period_number order by fiscal_week_of_year) as fiscal_week_of_period,\n    fiscal_period_number,\n    quarter_number+1 as fiscal_quarter_number,\n    period_of_quarter as fiscal_period_of_quarter\nfrom\n    fscl_periods_quarters\norder by 1,2\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.get_fiscal_year_dates", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.291737, "supported_languages": null}, "macro.dbt_date.tomorrow": {"name": "tomorrow", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/tomorrow.sql", "original_file_path": "macros/calendar_date/tomorrow.sql", "unique_id": "macro.dbt_date.tomorrow", "macro_sql": "{%- macro tomorrow(date=None, tz=None) -%}\n{{ dbt_date.n_days_away(1, date, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.291958, "supported_languages": null}, "macro.dbt_date.next_week": {"name": "next_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/next_week.sql", "original_file_path": "macros/calendar_date/next_week.sql", "unique_id": "macro.dbt_date.next_week", "macro_sql": "{%- macro next_week(tz=None) -%}\n{{ dbt_date.n_weeks_away(1, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_weeks_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2921422, "supported_languages": null}, "macro.dbt_date.next_month_name": {"name": "next_month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/next_month_name.sql", "original_file_path": "macros/calendar_date/next_month_name.sql", "unique_id": "macro.dbt_date.next_month_name", "macro_sql": "{%- macro next_month_name(short=True, tz=None) -%}\n{{ dbt_date.month_name(dbt_date.next_month(tz), short=short) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.month_name", "macro.dbt_date.next_month"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.292446, "supported_languages": null}, "macro.dbt_date.next_month": {"name": "next_month", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/next_month.sql", "original_file_path": "macros/calendar_date/next_month.sql", "unique_id": "macro.dbt_date.next_month", "macro_sql": "{%- macro next_month(tz=None) -%}\n{{ dbt_date.n_months_away(1, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_months_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2926311, "supported_languages": null}, "macro.dbt_date.day_name": {"name": "day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.day_name", "macro_sql": "{%- macro day_name(date, short=True) -%}\n    {{ adapter.dispatch('day_name', 'dbt_date') (date, short) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.snowflake__day_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.293464, "supported_languages": null}, "macro.dbt_date.default__day_name": {"name": "default__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.default__day_name", "macro_sql": "\n\n{%- macro default__day_name(date, short) -%}\n{%- set f = 'Dy' if short else 'Day' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2936692, "supported_languages": null}, "macro.dbt_date.snowflake__day_name": {"name": "snowflake__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.snowflake__day_name", "macro_sql": "\n\n{%- macro snowflake__day_name(date, short) -%}\n    {%- if short -%}\n    dayname({{ date }})\n    {%- else -%}\n    -- long version not implemented on Snowflake so we're doing it manually :/\n    case dayname({{ date }})\n        when 'Mon' then 'Monday'\n        when 'Tue' then 'Tuesday'\n        when 'Wed' then 'Wednesday'\n        when 'Thu' then 'Thursday'\n        when 'Fri' then 'Friday'\n        when 'Sat' then 'Saturday'\n        when 'Sun' then 'Sunday'\n    end\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2938821, "supported_languages": null}, "macro.dbt_date.bigquery__day_name": {"name": "bigquery__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.bigquery__day_name", "macro_sql": "\n\n{%- macro bigquery__day_name(date, short) -%}\n{%- set f = '%a' if short else '%A' -%}\n    format_date('{{ f }}', cast({{ date }} as date))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.294087, "supported_languages": null}, "macro.dbt_date.postgres__day_name": {"name": "postgres__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.postgres__day_name", "macro_sql": "\n\n{%- macro postgres__day_name(date, short) -%}\n{# FM = Fill mode, which suppresses padding blanks #}\n{%- set f = 'FMDy' if short else 'FMDay' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.294299, "supported_languages": null}, "macro.dbt_date.duckdb__day_name": {"name": "duckdb__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.duckdb__day_name", "macro_sql": "\n\n{%- macro duckdb__day_name(date, short) -%}\n    {%- if short -%}\n    substr(dayname({{ date }}), 1, 3)\n    {%- else -%}\n    dayname({{ date }})\n    {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.29449, "supported_languages": null}, "macro.dbt_date.spark__day_name": {"name": "spark__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.spark__day_name", "macro_sql": "\n\n{%- macro spark__day_name(date, short) -%}\n{%- set f = 'E' if short else 'EEEE' -%}\n    date_format({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.294691, "supported_languages": null}, "macro.dbt_date.trino__day_name": {"name": "trino__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.trino__day_name", "macro_sql": "\n\n{%- macro trino__day_name(date, short) -%}\n{%- set f = 'a' if short else 'W' -%}\n    date_format({{ date }}, '%{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.29489, "supported_languages": null}, "macro.dbt_date.to_unixtimestamp": {"name": "to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.to_unixtimestamp", "macro_sql": "{%- macro to_unixtimestamp(timestamp) -%}\n    {{ adapter.dispatch('to_unixtimestamp', 'dbt_date') (timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.snowflake__to_unixtimestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.295299, "supported_languages": null}, "macro.dbt_date.default__to_unixtimestamp": {"name": "default__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.default__to_unixtimestamp", "macro_sql": "\n\n{%- macro default__to_unixtimestamp(timestamp) -%}\n    {{ dbt_date.date_part('epoch', timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.295439, "supported_languages": null}, "macro.dbt_date.snowflake__to_unixtimestamp": {"name": "snowflake__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.snowflake__to_unixtimestamp", "macro_sql": "\n\n{%- macro snowflake__to_unixtimestamp(timestamp) -%}\n    {{ dbt_date.date_part('epoch_seconds', timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.295582, "supported_languages": null}, "macro.dbt_date.bigquery__to_unixtimestamp": {"name": "bigquery__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.bigquery__to_unixtimestamp", "macro_sql": "\n\n{%- macro bigquery__to_unixtimestamp(timestamp) -%}\n    unix_seconds({{ timestamp }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.295685, "supported_languages": null}, "macro.dbt_date.spark__to_unixtimestamp": {"name": "spark__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.spark__to_unixtimestamp", "macro_sql": "\n\n{%- macro spark__to_unixtimestamp(timestamp) -%}\n    unix_timestamp({{ timestamp }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.295786, "supported_languages": null}, "macro.dbt_date.trino__to_unixtimestamp": {"name": "trino__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.trino__to_unixtimestamp", "macro_sql": "\n\n{%- macro trino__to_unixtimestamp(timestamp) -%}\n    to_unixtime({{ timestamp }} AT TIME ZONE 'UTC')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.295888, "supported_languages": null}, "macro.dbt_date.n_days_away": {"name": "n_days_away", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_days_away.sql", "original_file_path": "macros/calendar_date/n_days_away.sql", "unique_id": "macro.dbt_date.n_days_away", "macro_sql": "{%- macro n_days_away(n, date=None, tz=None) -%}\n{{ dbt_date.n_days_ago(-1 * n, date, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_days_ago"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.296132, "supported_languages": null}, "macro.dbt_date.week_start": {"name": "week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.week_start", "macro_sql": "{%- macro week_start(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('week_start', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.snowflake__week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.296629, "supported_languages": null}, "macro.dbt_date.default__week_start": {"name": "default__week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.default__week_start", "macro_sql": "{%- macro default__week_start(date) -%}\ncast({{ dbt.date_trunc('week', date) }} as date)\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2967858, "supported_languages": null}, "macro.dbt_date.snowflake__week_start": {"name": "snowflake__week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.snowflake__week_start", "macro_sql": "\n\n{%- macro snowflake__week_start(date) -%}\n    {#\n        Get the day of week offset: e.g. if the date is a Sunday,\n        dbt_date.day_of_week returns 1, so we subtract 1 to get a 0 offset\n    #}\n    {% set off_set = dbt_date.day_of_week(date, isoweek=False) ~ \" - 1\" %}\n    cast({{ dbt.dateadd(\"day\", \"-1 * (\" ~ off_set ~ \")\", date) }} as date)\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.day_of_week", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.297139, "supported_languages": null}, "macro.dbt_date.postgres__week_start": {"name": "postgres__week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.postgres__week_start", "macro_sql": "\n\n{%- macro postgres__week_start(date) -%}\n-- Sunday as week start date\ncast({{ dbt.dateadd('day', -1, dbt.date_trunc('week', dbt.dateadd('day', 1, date))) }} as date)\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2974, "supported_languages": null}, "macro.dbt_date.duckdb__week_start": {"name": "duckdb__week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.duckdb__week_start", "macro_sql": "\n\n{%- macro duckdb__week_start(date) -%}\n{{ return(dbt_date.postgres__week_start(date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2975512, "supported_languages": null}, "macro.dbt_date.iso_week_start": {"name": "iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.iso_week_start", "macro_sql": "{%- macro iso_week_start(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('iso_week_start', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.snowflake__iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.298212, "supported_languages": null}, "macro.dbt_date._iso_week_start": {"name": "_iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date._iso_week_start", "macro_sql": "{%- macro _iso_week_start(date, week_type) -%}\ncast({{ dbt.date_trunc(week_type, date) }} as date)\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.298369, "supported_languages": null}, "macro.dbt_date.default__iso_week_start": {"name": "default__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.default__iso_week_start", "macro_sql": "\n\n{%- macro default__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'isoweek') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.298511, "supported_languages": null}, "macro.dbt_date.snowflake__iso_week_start": {"name": "snowflake__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.snowflake__iso_week_start", "macro_sql": "\n\n{%- macro snowflake__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.298651, "supported_languages": null}, "macro.dbt_date.postgres__iso_week_start": {"name": "postgres__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.postgres__iso_week_start", "macro_sql": "\n\n{%- macro postgres__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.298788, "supported_languages": null}, "macro.dbt_date.duckdb__iso_week_start": {"name": "duckdb__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.duckdb__iso_week_start", "macro_sql": "\n\n{%- macro duckdb__iso_week_start(date) -%}\n{{ return(dbt_date.postgres__iso_week_start(date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.298931, "supported_languages": null}, "macro.dbt_date.spark__iso_week_start": {"name": "spark__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.spark__iso_week_start", "macro_sql": "\n\n{%- macro spark__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.299071, "supported_languages": null}, "macro.dbt_date.trino__iso_week_start": {"name": "trino__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.trino__iso_week_start", "macro_sql": "\n\n{%- macro trino__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.29921, "supported_languages": null}, "macro.dbt_date.n_days_ago": {"name": "n_days_ago", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_days_ago.sql", "original_file_path": "macros/calendar_date/n_days_ago.sql", "unique_id": "macro.dbt_date.n_days_ago", "macro_sql": "{%- macro n_days_ago(n, date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{%- set n = n|int -%}\ncast({{ dbt.dateadd('day', -1 * n, dt) }} as date)\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.299619, "supported_languages": null}, "macro.dbt_date.last_week": {"name": "last_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/last_week.sql", "original_file_path": "macros/calendar_date/last_week.sql", "unique_id": "macro.dbt_date.last_week", "macro_sql": "{%- macro last_week(tz=None) -%}\n{{ dbt_date.n_weeks_ago(1, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_weeks_ago"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.2998028, "supported_languages": null}, "macro.dbt_date.now": {"name": "now", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/now.sql", "original_file_path": "macros/calendar_date/now.sql", "unique_id": "macro.dbt_date.now", "macro_sql": "{%- macro now(tz=None) -%}\n{{ dbt_date.convert_timezone(dbt.current_timestamp(), tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.convert_timezone", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.300006, "supported_languages": null}, "macro.dbt_date.periods_since": {"name": "periods_since", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/periods_since.sql", "original_file_path": "macros/calendar_date/periods_since.sql", "unique_id": "macro.dbt_date.periods_since", "macro_sql": "{%- macro periods_since(date_col, period_name='day', tz=None) -%}\n{{ dbt.datediff(date_col, dbt_date.now(tz), period_name) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt_date.now"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.300266, "supported_languages": null}, "macro.dbt_date.today": {"name": "today", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/today.sql", "original_file_path": "macros/calendar_date/today.sql", "unique_id": "macro.dbt_date.today", "macro_sql": "{%- macro today(tz=None) -%}\ncast({{ dbt_date.now(tz) }} as date)\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.now"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.300441, "supported_languages": null}, "macro.dbt_date.last_month": {"name": "last_month", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/last_month.sql", "original_file_path": "macros/calendar_date/last_month.sql", "unique_id": "macro.dbt_date.last_month", "macro_sql": "{%- macro last_month(tz=None) -%}\n{{ dbt_date.n_months_ago(1, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_months_ago"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.30062, "supported_languages": null}, "macro.dbt_date.day_of_year": {"name": "day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.day_of_year", "macro_sql": "{%- macro day_of_year(date) -%}\n{{ adapter.dispatch('day_of_year', 'dbt_date') (date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__day_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.301025, "supported_languages": null}, "macro.dbt_date.default__day_of_year": {"name": "default__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.default__day_of_year", "macro_sql": "\n\n{%- macro default__day_of_year(date) -%}\n    {{ dbt_date.date_part('dayofyear', date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.301226, "supported_languages": null}, "macro.dbt_date.postgres__day_of_year": {"name": "postgres__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.postgres__day_of_year", "macro_sql": "\n\n{%- macro postgres__day_of_year(date) -%}\n    {{ dbt_date.date_part('doy', date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.301366, "supported_languages": null}, "macro.dbt_date.redshift__day_of_year": {"name": "redshift__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.redshift__day_of_year", "macro_sql": "\n\n{%- macro redshift__day_of_year(date) -%}\n    cast({{ dbt_date.date_part('dayofyear', date) }} as {{ dbt.type_bigint() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.301547, "supported_languages": null}, "macro.dbt_date.spark__day_of_year": {"name": "spark__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.spark__day_of_year", "macro_sql": "\n\n{%- macro spark__day_of_year(date) -%}\n    dayofyear({{ date }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.301822, "supported_languages": null}, "macro.dbt_date.trino__day_of_year": {"name": "trino__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.trino__day_of_year", "macro_sql": "\n\n{%- macro trino__day_of_year(date) -%}\n    {{ dbt_date.date_part('day_of_year', date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.301965, "supported_languages": null}, "macro.dbt_date.round_timestamp": {"name": "round_timestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/round_timestamp.sql", "original_file_path": "macros/calendar_date/round_timestamp.sql", "unique_id": "macro.dbt_date.round_timestamp", "macro_sql": "{% macro round_timestamp(timestamp) %}\n    {{ dbt.date_trunc(\"day\", dbt.dateadd(\"hour\", 12, timestamp)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.30221, "supported_languages": null}, "macro.dbt_date.from_unixtimestamp": {"name": "from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.from_unixtimestamp", "macro_sql": "{%- macro from_unixtimestamp(epochs, format=\"seconds\") -%}\n    {{ adapter.dispatch('from_unixtimestamp', 'dbt_date') (epochs, format) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.snowflake__from_unixtimestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.304384, "supported_languages": null}, "macro.dbt_date.default__from_unixtimestamp": {"name": "default__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.default__from_unixtimestamp", "macro_sql": "\n\n{%- macro default__from_unixtimestamp(epochs, format=\"seconds\") -%}\n    {%- if format != \"seconds\" -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n    to_timestamp({{ epochs }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3046489, "supported_languages": null}, "macro.dbt_date.postgres__from_unixtimestamp": {"name": "postgres__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.postgres__from_unixtimestamp", "macro_sql": "\n\n{%- macro postgres__from_unixtimestamp(epochs, format=\"seconds\") -%}\n    {%- if format != \"seconds\" -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n    cast(to_timestamp({{ epochs }}) at time zone 'UTC' as timestamp)\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.304914, "supported_languages": null}, "macro.dbt_date.snowflake__from_unixtimestamp": {"name": "snowflake__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.snowflake__from_unixtimestamp", "macro_sql": "\n\n{%- macro snowflake__from_unixtimestamp(epochs, format) -%}\n    {%- if format == \"seconds\" -%}\n    {%- set scale = 0 -%}\n    {%- elif format == \"milliseconds\" -%}\n    {%- set scale = 3 -%}\n    {%- elif format == \"microseconds\" -%}\n    {%- set scale = 6 -%}\n    {%- else -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n    to_timestamp_ntz({{ epochs }}, {{ scale }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.305384, "supported_languages": null}, "macro.dbt_date.bigquery__from_unixtimestamp": {"name": "bigquery__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.bigquery__from_unixtimestamp", "macro_sql": "\n\n{%- macro bigquery__from_unixtimestamp(epochs, format) -%}\n    {%- if format == \"seconds\" -%}\n        timestamp_seconds({{ epochs }})\n    {%- elif format == \"milliseconds\" -%}\n        timestamp_millis({{ epochs }})\n    {%- elif format == \"microseconds\" -%}\n        timestamp_micros({{ epochs }})\n    {%- else -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.305781, "supported_languages": null}, "macro.dbt_date.trino__from_unixtimestamp": {"name": "trino__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.trino__from_unixtimestamp", "macro_sql": "\n\n{%- macro trino__from_unixtimestamp(epochs, format) -%}\n    {%- if format == \"seconds\" -%}\n        cast(from_unixtime({{ epochs }}) AT TIME ZONE 'UTC' as {{ dbt.type_timestamp() }})\n    {%- elif format == \"milliseconds\" -%}\n        cast(from_unixtime_nanos({{ epochs }} * pow(10, 6)) AT TIME ZONE 'UTC' as {{ dbt.type_timestamp() }})\n    {%- elif format == \"microseconds\" -%}\n        cast(from_unixtime_nanos({{ epochs }} * pow(10, 3)) AT TIME ZONE 'UTC' as {{ dbt.type_timestamp() }})\n    {%- elif format == \"nanoseconds\" -%}\n        cast(from_unixtime_nanos({{ epochs }}) AT TIME ZONE 'UTC' as {{ dbt.type_timestamp() }})\n    {%- else -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.306391, "supported_languages": null}, "macro.dbt_date.n_months_ago": {"name": "n_months_ago", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_months_ago.sql", "original_file_path": "macros/calendar_date/n_months_ago.sql", "unique_id": "macro.dbt_date.n_months_ago", "macro_sql": "{%- macro n_months_ago(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt.date_trunc('month',\n    dbt.dateadd('month', -1 * n,\n        dbt_date.today(tz)\n        )\n    ) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.306768, "supported_languages": null}, "macro.dbt_date.date_part": {"name": "date_part", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "unique_id": "macro.dbt_date.date_part", "macro_sql": "{% macro date_part(datepart, date) -%}\n    {{ adapter.dispatch('date_part', 'dbt_date') (datepart, date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.307115, "supported_languages": null}, "macro.dbt_date.default__date_part": {"name": "default__date_part", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "unique_id": "macro.dbt_date.default__date_part", "macro_sql": "{% macro default__date_part(datepart, date) -%}\n    date_part('{{ datepart }}', {{  date }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3072488, "supported_languages": null}, "macro.dbt_date.bigquery__date_part": {"name": "bigquery__date_part", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "unique_id": "macro.dbt_date.bigquery__date_part", "macro_sql": "{% macro bigquery__date_part(datepart, date) -%}\n    extract({{ datepart }} from {{ date }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3073778, "supported_languages": null}, "macro.dbt_date.trino__date_part": {"name": "trino__date_part", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "unique_id": "macro.dbt_date.trino__date_part", "macro_sql": "{% macro trino__date_part(datepart, date) -%}\n    extract({{ datepart }} from {{ date }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.307509, "supported_languages": null}, "macro.dbt_date.n_weeks_away": {"name": "n_weeks_away", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_weeks_away.sql", "original_file_path": "macros/calendar_date/n_weeks_away.sql", "unique_id": "macro.dbt_date.n_weeks_away", "macro_sql": "{%- macro n_weeks_away(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt.date_trunc('week',\n    dbt.dateadd('week', n,\n        dbt_date.today(tz)\n        )\n    ) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.30786, "supported_languages": null}, "macro.dbt_date.day_of_month": {"name": "day_of_month", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_month.sql", "original_file_path": "macros/calendar_date/day_of_month.sql", "unique_id": "macro.dbt_date.day_of_month", "macro_sql": "{%- macro day_of_month(date) -%}\n{{ dbt_date.date_part('day', date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.308073, "supported_languages": null}, "macro.dbt_date.redshift__day_of_month": {"name": "redshift__day_of_month", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_month.sql", "original_file_path": "macros/calendar_date/day_of_month.sql", "unique_id": "macro.dbt_date.redshift__day_of_month", "macro_sql": "\n\n{%- macro redshift__day_of_month(date) -%}\ncast({{ dbt_date.date_part('day', date) }} as {{ dbt.type_bigint() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.308256, "supported_languages": null}, "macro.dbt_date.yesterday": {"name": "yesterday", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/yesterday.sql", "original_file_path": "macros/calendar_date/yesterday.sql", "unique_id": "macro.dbt_date.yesterday", "macro_sql": "{%- macro yesterday(date=None, tz=None) -%}\n{{ dbt_date.n_days_ago(1, date, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_days_ago"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.308473, "supported_languages": null}, "macro.dbt_date.day_of_week": {"name": "day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.day_of_week", "macro_sql": "{%- macro day_of_week(date, isoweek=true) -%}\n{{ adapter.dispatch('day_of_week', 'dbt_date') (date, isoweek) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.snowflake__day_of_week"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.311222, "supported_languages": null}, "macro.dbt_date.default__day_of_week": {"name": "default__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.default__day_of_week", "macro_sql": "\n\n{%- macro default__day_of_week(date, isoweek) -%}\n\n    {%- set dow = dbt_date.date_part('dayofweek', date) -%}\n\n    {%- if isoweek -%}\n    case\n        -- Shift start of week from Sunday (0) to Monday (1)\n        when {{ dow }} = 0 then 7\n        else {{ dow }}\n    end\n    {%- else -%}\n    {{ dow }} + 1\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.311578, "supported_languages": null}, "macro.dbt_date.snowflake__day_of_week": {"name": "snowflake__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.snowflake__day_of_week", "macro_sql": "\n\n{%- macro snowflake__day_of_week(date, isoweek) -%}\n\n    {%- if isoweek -%}\n        {%- set dow_part = 'dayofweekiso' -%}\n        {{ dbt_date.date_part(dow_part, date) }}\n    {%- else -%}\n        {%- set dow_part = 'dayofweek' -%}\n        case\n            when {{ dbt_date.date_part(dow_part, date) }} = 7 then 1\n            else {{ dbt_date.date_part(dow_part, date) }} + 1\n        end\n    {%- endif -%}\n\n\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.311994, "supported_languages": null}, "macro.dbt_date.bigquery__day_of_week": {"name": "bigquery__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.bigquery__day_of_week", "macro_sql": "\n\n{%- macro bigquery__day_of_week(date, isoweek) -%}\n\n    {%- set dow = dbt_date.date_part('dayofweek', date) -%}\n\n    {%- if isoweek -%}\n    case\n        -- Shift start of week from Sunday (1) to Monday (2)\n        when {{ dow }} = 1 then 7\n        else {{ dow }} - 1\n    end\n    {%- else -%}\n    {{ dow }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.312287, "supported_languages": null}, "macro.dbt_date.postgres__day_of_week": {"name": "postgres__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.postgres__day_of_week", "macro_sql": "\n\n\n{%- macro postgres__day_of_week(date, isoweek) -%}\n\n    {%- if isoweek -%}\n        {%- set dow_part = 'isodow' -%}\n        -- Monday(1) to Sunday (7)\n        cast({{ dbt_date.date_part(dow_part, date) }} as {{ dbt.type_int() }})\n    {%- else -%}\n        {%- set dow_part = 'dow' -%}\n        -- Sunday(1) to Saturday (7)\n        cast({{ dbt_date.date_part(dow_part, date) }} + 1 as {{ dbt.type_int() }})\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.312713, "supported_languages": null}, "macro.dbt_date.redshift__day_of_week": {"name": "redshift__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.redshift__day_of_week", "macro_sql": "\n\n\n{%- macro redshift__day_of_week(date, isoweek) -%}\n\n    {%- set dow = dbt_date.date_part('dayofweek', date) -%}\n\n    {%- if isoweek -%}\n    case\n        -- Shift start of week from Sunday (0) to Monday (1)\n        when {{ dow }} = 0 then 7\n        else cast({{ dow }} as {{ dbt.type_bigint() }})\n    end\n    {%- else -%}\n    cast({{ dow }} + 1 as {{ dbt.type_bigint() }})\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.313081, "supported_languages": null}, "macro.dbt_date.duckdb__day_of_week": {"name": "duckdb__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.duckdb__day_of_week", "macro_sql": "\n\n{%- macro duckdb__day_of_week(date, isoweek) -%}\n{{ return(dbt_date.postgres__day_of_week(date, isoweek)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__day_of_week"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3132548, "supported_languages": null}, "macro.dbt_date.spark__day_of_week": {"name": "spark__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.spark__day_of_week", "macro_sql": "\n\n\n{%- macro spark__day_of_week(date, isoweek) -%}\n\n    {%- set dow = \"dayofweek_iso\" if isoweek else \"dayofweek\" -%}\n\n    {{ dbt_date.date_part(dow, date) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.313471, "supported_languages": null}, "macro.dbt_date.trino__day_of_week": {"name": "trino__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.trino__day_of_week", "macro_sql": "\n\n\n{%- macro trino__day_of_week(date, isoweek) -%}\n\n    {%- set dow = dbt_date.date_part('day_of_week', date) -%}\n\n    {%- if isoweek -%}\n        {{ dow }}\n    {%- else -%}\n        case\n            when {{ dow }} = 7 then 1\n            else {{ dow }} + 1\n        end\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.313758, "supported_languages": null}, "macro.dbt_date.iso_week_end": {"name": "iso_week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "unique_id": "macro.dbt_date.iso_week_end", "macro_sql": "{%- macro iso_week_end(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('iso_week_end', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.snowflake__iso_week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.314214, "supported_languages": null}, "macro.dbt_date._iso_week_end": {"name": "_iso_week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "unique_id": "macro.dbt_date._iso_week_end", "macro_sql": "{%- macro _iso_week_end(date, week_type) -%}\n{%- set dt = dbt_date.iso_week_start(date) -%}\n{{ dbt_date.n_days_away(6, dt) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.iso_week_start", "macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3144279, "supported_languages": null}, "macro.dbt_date.default__iso_week_end": {"name": "default__iso_week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "unique_id": "macro.dbt_date.default__iso_week_end", "macro_sql": "\n\n{%- macro default__iso_week_end(date) -%}\n{{ dbt_date._iso_week_end(date, 'isoweek') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3145669, "supported_languages": null}, "macro.dbt_date.snowflake__iso_week_end": {"name": "snowflake__iso_week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "unique_id": "macro.dbt_date.snowflake__iso_week_end", "macro_sql": "\n\n{%- macro snowflake__iso_week_end(date) -%}\n{{ dbt_date._iso_week_end(date, 'weekiso') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.314708, "supported_languages": null}, "macro.dbt_date.n_weeks_ago": {"name": "n_weeks_ago", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_weeks_ago.sql", "original_file_path": "macros/calendar_date/n_weeks_ago.sql", "unique_id": "macro.dbt_date.n_weeks_ago", "macro_sql": "{%- macro n_weeks_ago(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt.date_trunc('week',\n    dbt.dateadd('week', -1 * n,\n        dbt_date.today(tz)\n        )\n    ) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.315097, "supported_languages": null}, "macro.dbt_date.month_name": {"name": "month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.month_name", "macro_sql": "{%- macro month_name(date, short=True) -%}\n    {{ adapter.dispatch('month_name', 'dbt_date') (date, short) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.snowflake__month_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3157802, "supported_languages": null}, "macro.dbt_date.default__month_name": {"name": "default__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.default__month_name", "macro_sql": "\n\n{%- macro default__month_name(date, short) -%}\n{%- set f = 'MON' if short else 'MONTH' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.315993, "supported_languages": null}, "macro.dbt_date.bigquery__month_name": {"name": "bigquery__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.bigquery__month_name", "macro_sql": "\n\n{%- macro bigquery__month_name(date, short) -%}\n{%- set f = '%b' if short else '%B' -%}\n    format_date('{{ f }}', cast({{ date }} as date))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.316202, "supported_languages": null}, "macro.dbt_date.snowflake__month_name": {"name": "snowflake__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.snowflake__month_name", "macro_sql": "\n\n{%- macro snowflake__month_name(date, short) -%}\n{%- set f = 'MON' if short else 'MMMM' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3164039, "supported_languages": null}, "macro.dbt_date.postgres__month_name": {"name": "postgres__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.postgres__month_name", "macro_sql": "\n\n{%- macro postgres__month_name(date, short) -%}\n{# FM = Fill mode, which suppresses padding blanks #}\n{%- set f = 'FMMon' if short else 'FMMonth' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.316612, "supported_languages": null}, "macro.dbt_date.duckdb__month_name": {"name": "duckdb__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.duckdb__month_name", "macro_sql": "\n\n\n{%- macro duckdb__month_name(date, short) -%}\n    {%- if short -%}\n    substr(monthname({{ date }}), 1, 3)\n    {%- else -%}\n    monthname({{ date }})\n    {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3168042, "supported_languages": null}, "macro.dbt_date.spark__month_name": {"name": "spark__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.spark__month_name", "macro_sql": "\n\n{%- macro spark__month_name(date, short) -%}\n{%- set f = 'LLL' if short else 'LLLL' -%}\n    date_format({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3170052, "supported_languages": null}, "macro.dbt_date.trino__month_name": {"name": "trino__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.trino__month_name", "macro_sql": "\n\n{%- macro trino__month_name(date, short) -%}\n{%- set f = 'b' if short else 'M' -%}\n    date_format({{ date }}, '%{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.317269, "supported_languages": null}, "macro.dbt_date.last_month_name": {"name": "last_month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/last_month_name.sql", "original_file_path": "macros/calendar_date/last_month_name.sql", "unique_id": "macro.dbt_date.last_month_name", "macro_sql": "{%- macro last_month_name(short=True, tz=None) -%}\n{{ dbt_date.month_name(dbt_date.last_month(tz), short=short) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.month_name", "macro.dbt_date.last_month"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.317512, "supported_languages": null}, "macro.dbt_date.week_of_year": {"name": "week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "unique_id": "macro.dbt_date.week_of_year", "macro_sql": "{%- macro week_of_year(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('week_of_year', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3179631, "supported_languages": null}, "macro.dbt_date.default__week_of_year": {"name": "default__week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "unique_id": "macro.dbt_date.default__week_of_year", "macro_sql": "{%- macro default__week_of_year(date) -%}\ncast({{ dbt_date.date_part('week', date) }} as {{ dbt.type_int() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.318153, "supported_languages": null}, "macro.dbt_date.postgres__week_of_year": {"name": "postgres__week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "unique_id": "macro.dbt_date.postgres__week_of_year", "macro_sql": "\n\n{%- macro postgres__week_of_year(date) -%}\n{# postgresql 'week' returns isoweek. Use to_char instead.\n   WW = the first week starts on the first day of the year #}\ncast(to_char({{ date }}, 'WW') as {{ dbt.type_int() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.318306, "supported_languages": null}, "macro.dbt_date.duckdb__week_of_year": {"name": "duckdb__week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "unique_id": "macro.dbt_date.duckdb__week_of_year", "macro_sql": "\n\n{%- macro duckdb__week_of_year(date) -%}\ncast(ceil(dayofyear({{ date }}) / 7) as int)\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.318409, "supported_languages": null}, "macro.dbt_date.convert_timezone": {"name": "convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.convert_timezone", "macro_sql": "{%- macro convert_timezone(column, target_tz=None, source_tz=None) -%}\n{%- set source_tz = \"UTC\" if not source_tz else source_tz -%}\n{%- set target_tz = var(\"dbt_date:time_zone\") if not target_tz else target_tz -%}\n{{ adapter.dispatch('convert_timezone', 'dbt_date') (column, target_tz, source_tz) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.default__convert_timezone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.319679, "supported_languages": null}, "macro.dbt_date.default__convert_timezone": {"name": "default__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.default__convert_timezone", "macro_sql": "{% macro default__convert_timezone(column, target_tz, source_tz) -%}\nconvert_timezone('{{ source_tz }}', '{{ target_tz }}',\n    cast({{ column }} as {{ dbt.type_timestamp() }})\n)\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.319886, "supported_languages": null}, "macro.dbt_date.bigquery__convert_timezone": {"name": "bigquery__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.bigquery__convert_timezone", "macro_sql": "{%- macro bigquery__convert_timezone(column, target_tz, source_tz=None) -%}\ntimestamp(datetime({{ column }}, '{{ target_tz}}'))\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.320043, "supported_languages": null}, "macro.dbt_date.postgres__convert_timezone": {"name": "postgres__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.postgres__convert_timezone", "macro_sql": "{% macro postgres__convert_timezone(column, target_tz, source_tz) -%}\ncast(\n    cast({{ column }} as {{ dbt.type_timestamp() }})\n        at time zone '{{ source_tz }}' at time zone '{{ target_tz }}' as {{ dbt.type_timestamp() }}\n)\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.320298, "supported_languages": null}, "macro.dbt_date.redshift__convert_timezone": {"name": "redshift__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.redshift__convert_timezone", "macro_sql": "{%- macro redshift__convert_timezone(column, target_tz, source_tz) -%}\n{{ return(dbt_date.default__convert_timezone(column, target_tz, source_tz)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.default__convert_timezone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.320488, "supported_languages": null}, "macro.dbt_date.duckdb__convert_timezone": {"name": "duckdb__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.duckdb__convert_timezone", "macro_sql": "{% macro duckdb__convert_timezone(column, target_tz, source_tz) -%}\n{{ return(dbt_date.postgres__convert_timezone(column, target_tz, source_tz)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.postgres__convert_timezone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.320678, "supported_languages": null}, "macro.dbt_date.spark__convert_timezone": {"name": "spark__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.spark__convert_timezone", "macro_sql": "{%- macro spark__convert_timezone(column, target_tz, source_tz) -%}\nfrom_utc_timestamp(\n        to_utc_timestamp({{ column }}, '{{ source_tz }}'),\n        '{{ target_tz }}'\n        )\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.320846, "supported_languages": null}, "macro.dbt_date.trino__convert_timezone": {"name": "trino__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.trino__convert_timezone", "macro_sql": "{%- macro trino__convert_timezone(column, target_tz, source_tz) -%}\n    cast((at_timezone(with_timezone(cast({{ column }} as {{ dbt.type_timestamp() }}), '{{ source_tz }}'), '{{ target_tz }}')) as {{ dbt.type_timestamp() }})\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.321082, "supported_languages": null}, "macro.dbt_date.n_months_away": {"name": "n_months_away", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_months_away.sql", "original_file_path": "macros/calendar_date/n_months_away.sql", "unique_id": "macro.dbt_date.n_months_away", "macro_sql": "{%- macro n_months_away(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt.date_trunc('month',\n    dbt.dateadd('month', n,\n        dbt_date.today(tz)\n        )\n    ) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.321437, "supported_languages": null}, "macro.dbt_date.iso_week_of_year": {"name": "iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.iso_week_of_year", "macro_sql": "{%- macro iso_week_of_year(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('iso_week_of_year', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.snowflake__iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3221672, "supported_languages": null}, "macro.dbt_date._iso_week_of_year": {"name": "_iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date._iso_week_of_year", "macro_sql": "{%- macro _iso_week_of_year(date, week_type) -%}\ncast({{ dbt_date.date_part(week_type, date) }} as {{ dbt.type_int() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.322366, "supported_languages": null}, "macro.dbt_date.default__iso_week_of_year": {"name": "default__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.default__iso_week_of_year", "macro_sql": "\n\n{%- macro default__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'isoweek') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.322509, "supported_languages": null}, "macro.dbt_date.snowflake__iso_week_of_year": {"name": "snowflake__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.snowflake__iso_week_of_year", "macro_sql": "\n\n{%- macro snowflake__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'weekiso') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.322657, "supported_languages": null}, "macro.dbt_date.postgres__iso_week_of_year": {"name": "postgres__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.postgres__iso_week_of_year", "macro_sql": "\n\n{%- macro postgres__iso_week_of_year(date) -%}\n-- postgresql week is isoweek, the first week of a year containing January 4 of that year.\n{{ dbt_date._iso_week_of_year(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.322865, "supported_languages": null}, "macro.dbt_date.duckdb__iso_week_of_year": {"name": "duckdb__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.duckdb__iso_week_of_year", "macro_sql": "\n\n{%- macro duckdb__iso_week_of_year(date) -%}\n{{ return(dbt_date.postgres__iso_week_of_year(date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3230138, "supported_languages": null}, "macro.dbt_date.spark__iso_week_of_year": {"name": "spark__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.spark__iso_week_of_year", "macro_sql": "\n\n{%- macro spark__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.323155, "supported_languages": null}, "macro.dbt_date.trino__iso_week_of_year": {"name": "trino__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.trino__iso_week_of_year", "macro_sql": "\n\n{%- macro trino__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.323297, "supported_languages": null}, "macro.dbt_date.week_end": {"name": "week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.week_end", "macro_sql": "{%- macro week_end(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('week_end', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.snowflake__week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.323806, "supported_languages": null}, "macro.dbt_date.default__week_end": {"name": "default__week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.default__week_end", "macro_sql": "{%- macro default__week_end(date) -%}\n{{ last_day(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3239412, "supported_languages": null}, "macro.dbt_date.snowflake__week_end": {"name": "snowflake__week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.snowflake__week_end", "macro_sql": "\n\n{%- macro snowflake__week_end(date) -%}\n{%- set dt = dbt_date.week_start(date) -%}\n{{ dbt_date.n_days_away(6, dt) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.week_start", "macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3241441, "supported_languages": null}, "macro.dbt_date.postgres__week_end": {"name": "postgres__week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.postgres__week_end", "macro_sql": "\n\n{%- macro postgres__week_end(date) -%}\n{%- set dt = dbt_date.week_start(date) -%}\n{{ dbt_date.n_days_away(6, dt) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.week_start", "macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3243499, "supported_languages": null}, "macro.dbt_date.duckdb__week_end": {"name": "duckdb__week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.duckdb__week_end", "macro_sql": "\n\n{%- macro duckdb__week_end(date) -%}\n{{ return(dbt_date.postgres__week_end(date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.324497, "supported_languages": null}, "macro.dbt_date.next_month_number": {"name": "next_month_number", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/next_month_number.sql", "original_file_path": "macros/calendar_date/next_month_number.sql", "unique_id": "macro.dbt_date.next_month_number", "macro_sql": "{%- macro next_month_number(tz=None) -%}\n{{ dbt_date.date_part('month', dbt_date.next_month(tz)) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_date.next_month"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.324714, "supported_languages": null}, "macro.dbt_date.last_month_number": {"name": "last_month_number", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/last_month_number.sql", "original_file_path": "macros/calendar_date/last_month_number.sql", "unique_id": "macro.dbt_date.last_month_number", "macro_sql": "{%- macro last_month_number(tz=None) -%}\n{{ dbt_date.date_part('month', dbt_date.last_month(tz)) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_date.last_month"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.324929, "supported_languages": null}, "macro.fivetran_utils.enabled_vars": {"name": "enabled_vars", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/enabled_vars.sql", "original_file_path": "macros/enabled_vars.sql", "unique_id": "macro.fivetran_utils.enabled_vars", "macro_sql": "{% macro enabled_vars(vars) %}\n\n{% for v in vars %}\n    \n    {% if var(v, True) == False %}\n    {{ return(False) }}\n    {% endif %}\n\n{% endfor %}\n\n{{ return(True) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3253279, "supported_languages": null}, "macro.fivetran_utils.percentile": {"name": "percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.percentile", "macro_sql": "{% macro percentile(percentile_field, partition_field, percent) -%}\n\n{{ adapter.dispatch('percentile', 'fivetran_utils') (percentile_field, partition_field, percent) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__percentile"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.326276, "supported_languages": null}, "macro.fivetran_utils.default__percentile": {"name": "default__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.default__percentile", "macro_sql": "{% macro default__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile_cont( \n        {{ percent }} )\n        within group ( order by {{ percentile_field }} )\n        over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.326447, "supported_languages": null}, "macro.fivetran_utils.redshift__percentile": {"name": "redshift__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.redshift__percentile", "macro_sql": "{% macro redshift__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile_cont( \n        {{ percent }} )\n        within group ( order by {{ percentile_field }} )\n        over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.326617, "supported_languages": null}, "macro.fivetran_utils.bigquery__percentile": {"name": "bigquery__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.bigquery__percentile", "macro_sql": "{% macro bigquery__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile_cont( \n        {{ percentile_field }}, \n        {{ percent }}) \n        over (partition by {{ partition_field }}    \n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.326782, "supported_languages": null}, "macro.fivetran_utils.postgres__percentile": {"name": "postgres__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.postgres__percentile", "macro_sql": "{% macro postgres__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile_cont( \n        {{ percent }} )\n        within group ( order by {{ percentile_field }} )\n    /* have to group by partition field */\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.326926, "supported_languages": null}, "macro.fivetran_utils.spark__percentile": {"name": "spark__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.spark__percentile", "macro_sql": "{% macro spark__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile( \n        {{ percentile_field }}, \n        {{ percent }}) \n        over (partition by {{ partition_field }}    \n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.327093, "supported_languages": null}, "macro.fivetran_utils.pivot_json_extract": {"name": "pivot_json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/pivot_json_extract.sql", "original_file_path": "macros/pivot_json_extract.sql", "unique_id": "macro.fivetran_utils.pivot_json_extract", "macro_sql": "{% macro pivot_json_extract(string, list_of_properties) %}\n\n{%- for property in list_of_properties -%}\n{%- if property is mapping -%}\nreplace( {{ fivetran_utils.json_extract(string, property.name) }}, '\"', '') as {{ property.alias if property.alias else property.name | replace(' ', '_') | replace('.', '_') | lower }}\n\n{%- else -%}\nreplace( {{ fivetran_utils.json_extract(string, property) }}, '\"', '') as {{ property | replace(' ', '_') | lower }}\n\n{%- endif -%}\n{%- if not loop.last -%},{%- endif %}\n{% endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.json_extract"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.32789, "supported_languages": null}, "macro.fivetran_utils.persist_pass_through_columns": {"name": "persist_pass_through_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/persist_pass_through_columns.sql", "original_file_path": "macros/persist_pass_through_columns.sql", "unique_id": "macro.fivetran_utils.persist_pass_through_columns", "macro_sql": "{% macro persist_pass_through_columns(pass_through_variable, identifier=none, transform='') %}\n\n{% if var(pass_through_variable, none) %}\n    {% for field in var(pass_through_variable) %}\n        , {{ transform ~ '(' ~ (identifier ~ '.' if identifier else '') ~ (field.alias if field.alias else field.name) ~ ')' }} as {{ field.alias if field.alias else field.name }}\n    {% endfor %}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.328602, "supported_languages": null}, "macro.fivetran_utils.json_parse": {"name": "json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.json_parse", "macro_sql": "{% macro json_parse(string, string_path) -%}\n\n{{ adapter.dispatch('json_parse', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.snowflake__json_parse"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.329955, "supported_languages": null}, "macro.fivetran_utils.default__json_parse": {"name": "default__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.default__json_parse", "macro_sql": "{% macro default__json_parse(string, string_path) %}\n\n  json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3302112, "supported_languages": null}, "macro.fivetran_utils.redshift__json_parse": {"name": "redshift__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.redshift__json_parse", "macro_sql": "{% macro redshift__json_parse(string, string_path) %}\n\n  json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3304598, "supported_languages": null}, "macro.fivetran_utils.bigquery__json_parse": {"name": "bigquery__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.bigquery__json_parse", "macro_sql": "{% macro bigquery__json_parse(string, string_path) %}\n\n \n  json_extract_scalar({{string}}, '$.{%- for s in string_path -%}{{ s }}{%- if not loop.last -%}.{%- endif -%}{%- endfor -%} ')\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.330705, "supported_languages": null}, "macro.fivetran_utils.postgres__json_parse": {"name": "postgres__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.postgres__json_parse", "macro_sql": "{% macro postgres__json_parse(string, string_path) %}\n\n  {{string}}::json #>> '{ {%- for s in string_path -%}{{ s }}{%- if not loop.last -%},{%- endif -%}{%- endfor -%} }'\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.330946, "supported_languages": null}, "macro.fivetran_utils.snowflake__json_parse": {"name": "snowflake__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.snowflake__json_parse", "macro_sql": "{% macro snowflake__json_parse(string, string_path) %}\n\n  parse_json( {{string}} ) {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.331213, "supported_languages": null}, "macro.fivetran_utils.spark__json_parse": {"name": "spark__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.spark__json_parse", "macro_sql": "{% macro spark__json_parse(string, string_path) %}\n\n  {{string}} : {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3314838, "supported_languages": null}, "macro.fivetran_utils.sqlserver__json_parse": {"name": "sqlserver__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.sqlserver__json_parse", "macro_sql": "{% macro sqlserver__json_parse(string, string_path) %}\n\n  json_value({{string}}, '$.{%- for s in string_path -%}{{ s }}{%- if not loop.last -%}.{%- endif -%}{%- endfor -%} ')\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.33173, "supported_languages": null}, "macro.fivetran_utils.max_bool": {"name": "max_bool", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "unique_id": "macro.fivetran_utils.max_bool", "macro_sql": "{% macro max_bool(boolean_field) -%}\n\n{{ adapter.dispatch('max_bool', 'fivetran_utils') (boolean_field) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.snowflake__max_bool"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.332053, "supported_languages": null}, "macro.fivetran_utils.default__max_bool": {"name": "default__max_bool", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "unique_id": "macro.fivetran_utils.default__max_bool", "macro_sql": "{% macro default__max_bool(boolean_field)  %}\n\n    bool_or( {{ boolean_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.332157, "supported_languages": null}, "macro.fivetran_utils.snowflake__max_bool": {"name": "snowflake__max_bool", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "unique_id": "macro.fivetran_utils.snowflake__max_bool", "macro_sql": "{% macro snowflake__max_bool(boolean_field)  %}\n\n    max( {{ boolean_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3322592, "supported_languages": null}, "macro.fivetran_utils.bigquery__max_bool": {"name": "bigquery__max_bool", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "unique_id": "macro.fivetran_utils.bigquery__max_bool", "macro_sql": "{% macro bigquery__max_bool(boolean_field)  %}\n\n    max( {{ boolean_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.332363, "supported_languages": null}, "macro.fivetran_utils.calculated_fields": {"name": "calculated_fields", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/calculated_fields.sql", "original_file_path": "macros/calculated_fields.sql", "unique_id": "macro.fivetran_utils.calculated_fields", "macro_sql": "{% macro calculated_fields(variable) -%}\n\n{% if var(variable, none) %}\n    {% for field in var(variable) %}\n        , {{ field.transform_sql }} as {{ field.name }} \n    {% endfor %}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.332733, "supported_languages": null}, "macro.fivetran_utils.drop_schemas_automation": {"name": "drop_schemas_automation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/drop_schemas_automation.sql", "original_file_path": "macros/drop_schemas_automation.sql", "unique_id": "macro.fivetran_utils.drop_schemas_automation", "macro_sql": "{% macro drop_schemas_automation(drop_target_schema=true) %}\n    {{ return(adapter.dispatch('drop_schemas_automation', 'fivetran_utils')(drop_target_schema)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__drop_schemas_automation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.333424, "supported_languages": null}, "macro.fivetran_utils.default__drop_schemas_automation": {"name": "default__drop_schemas_automation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/drop_schemas_automation.sql", "original_file_path": "macros/drop_schemas_automation.sql", "unique_id": "macro.fivetran_utils.default__drop_schemas_automation", "macro_sql": "{% macro default__drop_schemas_automation(drop_target_schema=true) %}\n\n{% set fetch_list_sql %}\n    {% if target.type not in ('databricks', 'spark') %}\n        select schema_name\n        from \n        {{ wrap_in_quotes(target.database) }}.INFORMATION_SCHEMA.SCHEMATA\n        where lower(schema_name) like '{{ target.schema | lower }}{%- if not drop_target_schema -%}_{%- endif -%}%'\n    {% else %}\n        SHOW SCHEMAS LIKE '{{ target.schema }}{%- if not drop_target_schema -%}_{%- endif -%}*'\n    {% endif %}\n{% endset %}\n\n{% set results = run_query(fetch_list_sql) %}\n\n{% if execute %}\n    {% set results_list = results.columns[0].values() %}\n{% else %}\n    {% set results_list = [] %}\n{% endif %}\n\n{% for schema_to_drop in results_list %}\n    {% do adapter.drop_schema(api.Relation.create(database=target.database, schema=schema_to_drop)) %}\n    {{ print('Schema ' ~ schema_to_drop ~ ' successfully dropped from the ' ~ target.database ~ ' database.\\n')}}\n{% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.wrap_in_quotes", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3345191, "supported_languages": null}, "macro.fivetran_utils.seed_data_helper": {"name": "seed_data_helper", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/seed_data_helper.sql", "original_file_path": "macros/seed_data_helper.sql", "unique_id": "macro.fivetran_utils.seed_data_helper", "macro_sql": "{% macro seed_data_helper(seed_name, warehouses) %}\n\n{% if target.type in warehouses %}\n    {% for w in warehouses %}\n        {% if target.type == w %}\n            {{ return(ref(seed_name ~ \"_\" ~ w ~ \"\")) }}\n        {% endif %}\n    {% endfor %}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.335111, "supported_languages": null}, "macro.fivetran_utils.fill_pass_through_columns": {"name": "fill_pass_through_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fill_pass_through_columns.sql", "original_file_path": "macros/fill_pass_through_columns.sql", "unique_id": "macro.fivetran_utils.fill_pass_through_columns", "macro_sql": "{% macro fill_pass_through_columns(pass_through_variable) %}\n\n{% if var(pass_through_variable) %}\n    {% for field in var(pass_through_variable) %}\n        {% if field is mapping %}\n            {% if field.transform_sql %}\n                , {{ field.transform_sql }} as {{ field.alias if field.alias else field.name }}\n            {% else %}\n                , {{ field.alias if field.alias else field.name }}\n            {% endif %}\n        {% else %}\n        , {{ field }}\n        {% endif %}\n    {% endfor %}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.335912, "supported_languages": null}, "macro.fivetran_utils.string_agg": {"name": "string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.string_agg", "macro_sql": "{% macro string_agg(field_to_agg, delimiter) -%}\n\n{{ adapter.dispatch('string_agg', 'fivetran_utils') (field_to_agg, delimiter) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.snowflake__string_agg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.336389, "supported_languages": null}, "macro.fivetran_utils.default__string_agg": {"name": "default__string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.default__string_agg", "macro_sql": "{% macro default__string_agg(field_to_agg, delimiter) %}\n    string_agg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.336527, "supported_languages": null}, "macro.fivetran_utils.snowflake__string_agg": {"name": "snowflake__string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.snowflake__string_agg", "macro_sql": "{% macro snowflake__string_agg(field_to_agg, delimiter) %}\n    listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3366568, "supported_languages": null}, "macro.fivetran_utils.redshift__string_agg": {"name": "redshift__string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.redshift__string_agg", "macro_sql": "{% macro redshift__string_agg(field_to_agg, delimiter) %}\n    listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.33679, "supported_languages": null}, "macro.fivetran_utils.spark__string_agg": {"name": "spark__string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.spark__string_agg", "macro_sql": "{% macro spark__string_agg(field_to_agg, delimiter) %}\n    -- collect set will remove duplicates\n    replace(replace(replace(cast( collect_set({{ field_to_agg }}) as string), '[', ''), ']', ''), ', ', {{ delimiter }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.336929, "supported_languages": null}, "macro.fivetran_utils.timestamp_diff": {"name": "timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.timestamp_diff", "macro_sql": "{% macro timestamp_diff(first_date, second_date, datepart) %}\n  {{ adapter.dispatch('timestamp_diff', 'fivetran_utils')(first_date, second_date, datepart) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__timestamp_diff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.339944, "supported_languages": null}, "macro.fivetran_utils.default__timestamp_diff": {"name": "default__timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.default__timestamp_diff", "macro_sql": "{% macro default__timestamp_diff(first_date, second_date, datepart) %}\n\n    datediff(\n        {{ datepart }},\n        {{ first_date }},\n        {{ second_date }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3401139, "supported_languages": null}, "macro.fivetran_utils.redshift__timestamp_diff": {"name": "redshift__timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.redshift__timestamp_diff", "macro_sql": "{% macro redshift__timestamp_diff(first_date, second_date, datepart) %}\n\n    datediff(\n        {{ datepart }},\n        {{ first_date }},\n        {{ second_date }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3402822, "supported_languages": null}, "macro.fivetran_utils.bigquery__timestamp_diff": {"name": "bigquery__timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.bigquery__timestamp_diff", "macro_sql": "{% macro bigquery__timestamp_diff(first_date, second_date, datepart) %}\n\n    timestamp_diff(\n        {{second_date}},\n        {{first_date}},\n        {{datepart}}\n    )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3404422, "supported_languages": null}, "macro.fivetran_utils.postgres__timestamp_diff": {"name": "postgres__timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.postgres__timestamp_diff", "macro_sql": "{% macro postgres__timestamp_diff(first_date, second_date, datepart) %}\n\n    {% if datepart == 'year' %}\n        (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n    {% elif datepart == 'quarter' %}\n        ({{ dbt.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n    {% elif datepart == 'month' %}\n        ({{ dbt.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n    {% elif datepart == 'day' %}\n        (({{second_date}})::date - ({{first_date}})::date)\n    {% elif datepart == 'week' %}\n        ({{ dbt.datediff(first_date, second_date, 'day') }} / 7 + case\n            when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n                case when {{first_date}} <= {{second_date}} then 0 else -1 end\n            else\n                case when {{first_date}} <= {{second_date}} then 1 else 0 end\n        end)\n    {% elif datepart == 'hour' %}\n        ({{ dbt.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n    {% elif datepart == 'minute' %}\n        ({{ dbt.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n    {% elif datepart == 'second' %}\n        ({{ dbt.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n    {% elif datepart == 'millisecond' %}\n        ({{ dbt.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n    {% elif datepart == 'microsecond' %}\n        ({{ dbt.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n    {% else %}\n        {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3422348, "supported_languages": null}, "macro.fivetran_utils.try_cast": {"name": "try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.try_cast", "macro_sql": "{% macro try_cast(field, type) %}\n    {{ adapter.dispatch('try_cast', 'fivetran_utils') (field, type) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.snowflake__try_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.343193, "supported_languages": null}, "macro.fivetran_utils.default__try_cast": {"name": "default__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.default__try_cast", "macro_sql": "{% macro default__try_cast(field, type) %}\n    {# most databases don't support this function yet\n    so we just need to use cast #}\n    cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.343333, "supported_languages": null}, "macro.fivetran_utils.redshift__try_cast": {"name": "redshift__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.redshift__try_cast", "macro_sql": "{% macro redshift__try_cast(field, type) %}\n{%- if type == 'numeric' -%}\n\n    case\n        when trim({{field}}) ~ '^(0|[1-9][0-9]*)$' then trim({{field}})\n        else null\n    end::{{type}}\n\n{% else %}\n    {{ exceptions.raise_compiler_error(\n            \"non-numeric datatypes are not currently supported\") }}\n\n{% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.343612, "supported_languages": null}, "macro.fivetran_utils.postgres__try_cast": {"name": "postgres__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.postgres__try_cast", "macro_sql": "{% macro postgres__try_cast(field, type) %}\n{%- if type == 'numeric' -%}\n\n    case\n        when replace(cast({{field}} as varchar),cast(' ' as varchar),cast('' as varchar)) ~ '^(0|[1-9][0-9]*)$' \n        then replace(cast({{field}} as varchar),cast(' ' as varchar),cast('' as varchar))\n        else null\n    end::{{type}}\n\n{% else %}\n    {{ exceptions.raise_compiler_error(\n            \"non-numeric datatypes are not currently supported\") }}\n\n{% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3439062, "supported_languages": null}, "macro.fivetran_utils.snowflake__try_cast": {"name": "snowflake__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.snowflake__try_cast", "macro_sql": "{% macro snowflake__try_cast(field, type) %}\n    try_cast(cast({{field}} as varchar) as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3440378, "supported_languages": null}, "macro.fivetran_utils.bigquery__try_cast": {"name": "bigquery__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.bigquery__try_cast", "macro_sql": "{% macro bigquery__try_cast(field, type) %}\n    safe_cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.344165, "supported_languages": null}, "macro.fivetran_utils.spark__try_cast": {"name": "spark__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.spark__try_cast", "macro_sql": "{% macro spark__try_cast(field, type) %}\n    try_cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.344296, "supported_languages": null}, "macro.fivetran_utils.sqlserver__try_cast": {"name": "sqlserver__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.sqlserver__try_cast", "macro_sql": "{% macro sqlserver__try_cast(field, type) %}\n    try_cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.344425, "supported_languages": null}, "macro.fivetran_utils.source_relation": {"name": "source_relation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "unique_id": "macro.fivetran_utils.source_relation", "macro_sql": "{% macro source_relation(union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('source_relation', 'fivetran_utils') (union_schema_variable, union_database_variable) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__source_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.344915, "supported_languages": null}, "macro.fivetran_utils.default__source_relation": {"name": "default__source_relation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "unique_id": "macro.fivetran_utils.default__source_relation", "macro_sql": "{% macro default__source_relation(union_schema_variable, union_database_variable) %}\n\n{% if var(union_schema_variable, none)  %}\n, case\n    {% for schema in var(union_schema_variable) %}\n    when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%.{{ schema|lower }}.%' then '{{ schema|lower }}'\n    {% endfor %}\n  end as source_relation\n{% elif var(union_database_variable, none) %}\n, case\n    {% for database in var(union_database_variable) %}\n    when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%{{ database|lower }}.%' then '{{ database|lower }}'\n    {% endfor %}\n  end as source_relation\n{% else %}\n, cast('' as {{ dbt.type_string() }}) as source_relation\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3455, "supported_languages": null}, "macro.fivetran_utils.first_value": {"name": "first_value", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "unique_id": "macro.fivetran_utils.first_value", "macro_sql": "{% macro first_value(first_value_field, partition_field, order_by_field, order=\"asc\") -%}\n\n{{ adapter.dispatch('first_value', 'fivetran_utils') (first_value_field, partition_field, order_by_field, order) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__first_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.346, "supported_languages": null}, "macro.fivetran_utils.default__first_value": {"name": "default__first_value", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "unique_id": "macro.fivetran_utils.default__first_value", "macro_sql": "{% macro default__first_value(first_value_field, partition_field, order_by_field, order=\"asc\")  %}\n\n    first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.346205, "supported_languages": null}, "macro.fivetran_utils.redshift__first_value": {"name": "redshift__first_value", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "unique_id": "macro.fivetran_utils.redshift__first_value", "macro_sql": "{% macro redshift__first_value(first_value_field, partition_field, order_by_field, order=\"asc\") %}\n\n    first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} , {{ partition_field }} rows unbounded preceding )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.34643, "supported_languages": null}, "macro.fivetran_utils.add_dbt_source_relation": {"name": "add_dbt_source_relation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/add_dbt_source_relation.sql", "original_file_path": "macros/add_dbt_source_relation.sql", "unique_id": "macro.fivetran_utils.add_dbt_source_relation", "macro_sql": "{% macro add_dbt_source_relation() %}\n\n{% if var('union_schemas', none) or var('union_databases', none) %}\n, _dbt_source_relation\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.346687, "supported_languages": null}, "macro.fivetran_utils.add_pass_through_columns": {"name": "add_pass_through_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/add_pass_through_columns.sql", "original_file_path": "macros/add_pass_through_columns.sql", "unique_id": "macro.fivetran_utils.add_pass_through_columns", "macro_sql": "{% macro add_pass_through_columns(base_columns, pass_through_var) %}\n\n  {% if pass_through_var %}\n\n    {% for column in pass_through_var %}\n\n    {% if column is mapping %}\n\n      {% if column.alias %}\n\n        {% do base_columns.append({ \"name\": column.name, \"alias\": column.alias, \"datatype\": column.datatype if column.datatype else dbt.type_string()}) %}\n\n      {% else %}\n\n        {% do base_columns.append({ \"name\": column.name, \"datatype\": column.datatype if column.datatype else dbt.type_string()}) %}\n        \n      {% endif %}\n\n    {% else %}\n\n      {% do base_columns.append({ \"name\": column, \"datatype\": dbt.type_string()}) %}\n\n    {% endif %}\n\n    {% endfor %}\n\n  {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.347858, "supported_languages": null}, "macro.fivetran_utils.union_relations": {"name": "union_relations", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "unique_id": "macro.fivetran_utils.union_relations", "macro_sql": "{%- macro union_relations(relations, aliases=none, column_override=none, include=[], exclude=[], source_column_name=none) -%}\n\n    {%- if exclude and include -%}\n        {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n    {%- endif -%}\n\n    {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n    {%- if not execute %}\n        {{ return('') }}\n    {% endif -%}\n\n    {%- set column_override = column_override if column_override is not none else {} -%}\n    {%- set source_column_name = source_column_name if source_column_name is not none else '_dbt_source_relation' -%}\n\n    {%- set relation_columns = {} -%}\n    {%- set column_superset = {} -%}\n\n    {%- for relation in relations -%}\n\n        {%- do relation_columns.update({relation: []}) -%}\n\n        {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n        {%- set cols = adapter.get_columns_in_relation(relation) -%}\n        {%- for col in cols -%}\n\n        {#- If an exclude list was provided and the column is in the list, do nothing -#}\n        {%- if exclude and col.column in exclude -%}\n\n        {#- If an include list was provided and the column is not in the list, do nothing -#}\n        {%- elif include and col.column not in include -%}\n\n        {#- Otherwise add the column to the column superset -#}\n        {%- else -%}\n\n            {#- update the list of columns in this relation -#}\n            {%- do relation_columns[relation].append(col.column) -%}\n\n            {%- if col.column in column_superset -%}\n\n                {%- set stored = column_superset[col.column] -%}\n                {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n                    {%- do column_superset.update({col.column: col}) -%}\n\n                {%- endif %}\n\n            {%- else -%}\n\n                {%- do column_superset.update({col.column: col}) -%}\n\n            {%- endif -%}\n\n        {%- endif -%}\n\n        {%- endfor -%}\n    {%- endfor -%}\n\n    {%- set ordered_column_names = column_superset.keys() -%}\n\n    {%- for relation in relations %}\n\n        (\n            select\n\n                cast({{ dbt.string_literal(relation) }} as {{ dbt.type_string() }}) as {{ source_column_name }},\n                {% for col_name in ordered_column_names -%}\n\n                    {%- set col = column_superset[col_name] %}\n                    {%- set col_type = column_override.get(col.column, col.data_type) %}\n                    {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n                    cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n                {%- endfor %}\n\n            from {{ aliases[loop.index0] if aliases else relation }}\n        )\n\n        {% if not loop.last -%}\n            union all\n        {% endif -%}\n\n    {%- endfor -%}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt.string_literal", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.351892, "supported_languages": null}, "macro.fivetran_utils.union_tables": {"name": "union_tables", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "unique_id": "macro.fivetran_utils.union_tables", "macro_sql": "{%- macro union_tables(tables, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_table') -%}\n\n    {%- do exceptions.warn(\"Warning: the `union_tables` macro is no longer supported and will be deprecated in a future release of dbt-utils. Use the `union_relations` macro instead\") -%}\n\n    {{ return(dbt_utils.union_relations(tables, column_override, include, exclude, source_column_name)) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_utils.union_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.352268, "supported_languages": null}, "macro.fivetran_utils.snowflake_seed_data": {"name": "snowflake_seed_data", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/snowflake_seed_data.sql", "original_file_path": "macros/snowflake_seed_data.sql", "unique_id": "macro.fivetran_utils.snowflake_seed_data", "macro_sql": "{% macro snowflake_seed_data(seed_name) %}\n\n{% if target.type == 'snowflake' %}\n{{ return(ref(seed_name ~ '_snowflake')) }}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.352649, "supported_languages": null}, "macro.fivetran_utils.fill_staging_columns": {"name": "fill_staging_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "unique_id": "macro.fivetran_utils.fill_staging_columns", "macro_sql": "{% macro fill_staging_columns(source_columns, staging_columns) -%}\n\n{%- set source_column_names = source_columns|map(attribute='name')|map('lower')|list -%}\n\n{%- for column in staging_columns %}\n    {% if column.name|lower in source_column_names -%}\n        {{ fivetran_utils.quote_column(column) }} as \n        {%- if 'alias' in column %} {{ column.alias }} {% else %} {{ fivetran_utils.quote_column(column) }} {%- endif -%}\n    {%- else -%}\n        cast(null as {{ column.datatype }})\n        {%- if 'alias' in column %} as {{ column.alias }} {% else %} as {{ fivetran_utils.quote_column(column) }} {% endif -%}\n    {%- endif -%}\n    {%- if not loop.last -%} , {% endif -%}\n{% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.quote_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.354248, "supported_languages": null}, "macro.fivetran_utils.quote_column": {"name": "quote_column", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "unique_id": "macro.fivetran_utils.quote_column", "macro_sql": "{% macro quote_column(column) %}\n    {% if 'quote' in column %}\n        {% if column.quote %}\n            {% if target.type in ('bigquery', 'spark', 'databricks') %}\n            `{{ column.name }}`\n            {% elif target.type == 'snowflake' %}\n            \"{{ column.name | upper }}\"\n            {% else %}\n            \"{{ column.name }}\"\n            {% endif %}\n        {% else %}\n        {{ column.name }}\n        {% endif %}\n    {% else %}\n    {{ column.name }}\n    {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.354826, "supported_languages": null}, "macro.fivetran_utils.json_extract": {"name": "json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.json_extract", "macro_sql": "{% macro json_extract(string, string_path) -%}\n\n{{ adapter.dispatch('json_extract', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.snowflake__json_extract"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.355405, "supported_languages": null}, "macro.fivetran_utils.default__json_extract": {"name": "default__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.default__json_extract", "macro_sql": "{% macro default__json_extract(string, string_path) %}\n\n  json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} )\n \n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.355562, "supported_languages": null}, "macro.fivetran_utils.snowflake__json_extract": {"name": "snowflake__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.snowflake__json_extract", "macro_sql": "{% macro snowflake__json_extract(string, string_path) %}\n\n  json_extract_path_text(try_parse_json( {{string}} ), {{ \"'\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3557189, "supported_languages": null}, "macro.fivetran_utils.redshift__json_extract": {"name": "redshift__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.redshift__json_extract", "macro_sql": "{% macro redshift__json_extract(string, string_path) %}\n\n  case when is_valid_json( {{string}} ) then json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} ) else null end\n \n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.355893, "supported_languages": null}, "macro.fivetran_utils.bigquery__json_extract": {"name": "bigquery__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.bigquery__json_extract", "macro_sql": "{% macro bigquery__json_extract(string, string_path) %}\n\n  json_extract_scalar({{string}}, {{ \"'$.\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.356043, "supported_languages": null}, "macro.fivetran_utils.postgres__json_extract": {"name": "postgres__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.postgres__json_extract", "macro_sql": "{% macro postgres__json_extract(string, string_path) %}\n\n  {{string}}::json->>{{\"'\" ~ string_path ~ \"'\" }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.356197, "supported_languages": null}, "macro.fivetran_utils.collect_freshness": {"name": "collect_freshness", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "unique_id": "macro.fivetran_utils.collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n  {{ return(adapter.dispatch('collect_freshness')(source, loaded_at_field, filter))}}\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3570318, "supported_languages": null}, "macro.fivetran_utils.default__collect_freshness": {"name": "default__collect_freshness", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "unique_id": "macro.fivetran_utils.default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n  {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n\n  {%- set enabled_array = [] -%}\n  {% for node in graph.sources.values() %}\n    {% if node.identifier == source.identifier %}\n      {% if (node.meta['is_enabled'] | default(true)) %}\n        {%- do enabled_array.append(1) -%}\n      {% endif %}\n    {% endif %}\n  {% endfor %}\n  {% set is_enabled = (enabled_array != []) %}\n\n    select\n      {% if is_enabled %}\n      max({{ loaded_at_field }})\n      {% else %} \n      {{ current_timestamp() }} {% endif %} as max_loaded_at,\n      {{ current_timestamp() }} as snapshotted_at\n\n    {% if is_enabled %}\n    from {{ source }}\n      {% if filter %}\n      where {{ filter }}\n      {% endif %}\n    {% endif %}\n\n  {% endcall %}\n\n  {% if dbt_version.split('.') | map('int') | list >= [1, 5, 0]  %}\n    {{ return(load_result('collect_freshness')) }}\n  {% else %}\n    {{ return(load_result('collect_freshness').table) }}\n  {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.358316, "supported_languages": null}, "macro.fivetran_utils.timestamp_add": {"name": "timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.timestamp_add", "macro_sql": "{% macro timestamp_add(datepart, interval, from_timestamp) -%}\n\n{{ adapter.dispatch('timestamp_add', 'fivetran_utils') (datepart, interval, from_timestamp) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__timestamp_add"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.359031, "supported_languages": null}, "macro.fivetran_utils.default__timestamp_add": {"name": "default__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.default__timestamp_add", "macro_sql": "{% macro default__timestamp_add(datepart, interval, from_timestamp) %}\n\n    timestampadd(\n        {{ datepart }},\n        {{ interval }},\n        {{ from_timestamp }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3592021, "supported_languages": null}, "macro.fivetran_utils.bigquery__timestamp_add": {"name": "bigquery__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.bigquery__timestamp_add", "macro_sql": "{% macro bigquery__timestamp_add(datepart, interval, from_timestamp) %}\n\n        timestamp_add({{ from_timestamp }}, interval  {{ interval }} {{ datepart }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.359367, "supported_languages": null}, "macro.fivetran_utils.redshift__timestamp_add": {"name": "redshift__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.redshift__timestamp_add", "macro_sql": "{% macro redshift__timestamp_add(datepart, interval, from_timestamp) %}\n\n        dateadd(\n        {{ datepart }},\n        {{ interval }},\n        {{ from_timestamp }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.35953, "supported_languages": null}, "macro.fivetran_utils.postgres__timestamp_add": {"name": "postgres__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.postgres__timestamp_add", "macro_sql": "{% macro postgres__timestamp_add(datepart, interval, from_timestamp) %}\n\n    {{ from_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.359692, "supported_languages": null}, "macro.fivetran_utils.spark__timestamp_add": {"name": "spark__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.spark__timestamp_add", "macro_sql": "{% macro spark__timestamp_add(datepart, interval, from_timestamp) %}\n\n    {{ dbt.dateadd(datepart, interval, from_timestamp) }}\n        \n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3598678, "supported_languages": null}, "macro.fivetran_utils.ceiling": {"name": "ceiling", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "unique_id": "macro.fivetran_utils.ceiling", "macro_sql": "{% macro ceiling(num) -%}\n\n{{ adapter.dispatch('ceiling', 'fivetran_utils') (num) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.snowflake__ceiling"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.36012, "supported_languages": null}, "macro.fivetran_utils.default__ceiling": {"name": "default__ceiling", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "unique_id": "macro.fivetran_utils.default__ceiling", "macro_sql": "{% macro default__ceiling(num) %}\n    ceiling({{ num }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3602262, "supported_languages": null}, "macro.fivetran_utils.snowflake__ceiling": {"name": "snowflake__ceiling", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "unique_id": "macro.fivetran_utils.snowflake__ceiling", "macro_sql": "{% macro snowflake__ceiling(num) %}\n    ceil({{ num }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.360331, "supported_languages": null}, "macro.fivetran_utils.remove_prefix_from_columns": {"name": "remove_prefix_from_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/remove_prefix_from_columns.sql", "original_file_path": "macros/remove_prefix_from_columns.sql", "unique_id": "macro.fivetran_utils.remove_prefix_from_columns", "macro_sql": "{% macro remove_prefix_from_columns(columns, prefix='', exclude=[]) %}\n\n        {%- for col in columns if col.name not in exclude -%}\n        {%- if col.name[:prefix|length]|lower == prefix -%}\n        {{ col.name }} as {{ col.name[prefix|length:] }}\n        {%- else -%}\n        {{ col.name }}\n        {%- endif -%}\n        {%- if not loop.last -%},{%- endif %}\n        {% endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.360967, "supported_languages": null}, "macro.fivetran_utils.fivetran_date_spine": {"name": "fivetran_date_spine", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fivetran_date_spine.sql", "original_file_path": "macros/fivetran_date_spine.sql", "unique_id": "macro.fivetran_utils.fivetran_date_spine", "macro_sql": "{% macro fivetran_date_spine(datepart, start_date, end_date) -%}\n\n{{ return(adapter.dispatch('fivetran_date_spine', 'fivetran_utils') (datepart, start_date, end_date)) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__fivetran_date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3623428, "supported_languages": null}, "macro.fivetran_utils.default__fivetran_date_spine": {"name": "default__fivetran_date_spine", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fivetran_date_spine.sql", "original_file_path": "macros/fivetran_date_spine.sql", "unique_id": "macro.fivetran_utils.default__fivetran_date_spine", "macro_sql": "{% macro default__fivetran_date_spine(datepart, start_date, end_date) %}\n\n    {{ dbt_utils.date_spine(datepart, start_date, end_date) }}\n        \n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3625238, "supported_languages": null}, "macro.fivetran_utils.sqlserver__fivetran_date_spine": {"name": "sqlserver__fivetran_date_spine", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fivetran_date_spine.sql", "original_file_path": "macros/fivetran_date_spine.sql", "unique_id": "macro.fivetran_utils.sqlserver__fivetran_date_spine", "macro_sql": "{% macro sqlserver__fivetran_date_spine(datepart, start_date, end_date) -%}\n\n    {% set date_spine_query %}\n        with\n\n        l0 as (\n\n            select c\n            from (select 1 union all select 1) as d(c)\n\n        ),\n        l1 as (\n\n            select\n                1 as c\n            from l0 as a\n            cross join l0 as b\n\n        ),\n\n        l2 as (\n\n            select 1 as c\n            from l1 as a\n            cross join l1 as b\n        ),\n\n        l3 as (\n\n            select 1 as c\n            from l2 as a\n            cross join l2 as b\n        ),\n\n        l4 as (\n\n            select 1 as c\n            from l3 as a\n            cross join l3 as b\n        ),\n\n        l5 as (\n\n            select 1 as c\n            from l4 as a\n            cross join l4 as b\n        ),\n\n        nums as (\n\n            select row_number() over (order by (select null)) as rownum\n            from l5\n        ),\n\n        rawdata as (\n\n            select top ({{dbt.datediff(start_date, end_date, datepart)}}) rownum -1 as n\n            from nums\n            order by rownum\n        ),\n\n        all_periods as (\n\n            select (\n                {{\n                    dbt.dateadd(\n                        datepart,\n                        'n',\n                        start_date\n                    )\n                }}\n            ) as date_{{datepart}}\n            from rawdata\n        ),\n\n        filtered as (\n\n            select *\n            from all_periods\n            where date_{{datepart}} <= {{ end_date }}\n\n        )\n\n        select * from filtered\n        order by 1\n\n    {% endset %}\n\n    {% set results = run_query(date_spine_query) %}\n\n    {% if execute %}\n\n        {% set results_list = results.columns[0].values() %}\n    \n    {% else %}\n\n        {% set results_list = [] %}\n\n    {% endif %}\n\n    {%- for date_field in results_list %}\n        select cast('{{ date_field }}' as date) as date_{{datepart}} {{ 'union all ' if not loop.last else '' }}\n    {% endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt.dateadd", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.363373, "supported_languages": null}, "macro.fivetran_utils.union_data": {"name": "union_data", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "unique_id": "macro.fivetran_utils.union_data", "macro_sql": "{%- macro union_data(table_identifier, database_variable, schema_variable, default_database, default_schema, default_variable, union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('union_data', 'fivetran_utils') (\n    table_identifier, \n    database_variable, \n    schema_variable, \n    default_database, \n    default_schema, \n    default_variable,\n    union_schema_variable,\n    union_database_variable\n    ) }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.fivetran_utils.default__union_data"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.366953, "supported_languages": null}, "macro.fivetran_utils.default__union_data": {"name": "default__union_data", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "unique_id": "macro.fivetran_utils.default__union_data", "macro_sql": "{%- macro default__union_data(\n    table_identifier, \n    database_variable, \n    schema_variable, \n    default_database, \n    default_schema, \n    default_variable,\n    union_schema_variable,\n    union_database_variable\n    ) -%}\n\n{%- if var(union_schema_variable, none) -%}\n\n    {%- set relations = [] -%}\n    \n    {%- if var(union_schema_variable) is string -%}\n    {%- set trimmed = var(union_schema_variable)|trim('[')|trim(']') -%}\n    {%- set schemas = trimmed.split(',')|map('trim',\" \")|map('trim','\"')|map('trim',\"'\") -%}\n    {%- else -%}\n    {%- set schemas = var(union_schema_variable) -%}\n    {%- endif -%}\n\n    {%- for schema in var(union_schema_variable) -%}\n    {%- set relation=adapter.get_relation(\n        database=source(schema, table_identifier).database if var('has_defined_sources', false) else var(database_variable, default_database),\n        schema=source(schema, table_identifier).schema if var('has_defined_sources', false) else schema,\n        identifier=source(schema, table_identifier).identifier if var('has_defined_sources', false) else table_identifier\n    ) -%}\n    \n    {%- set relation_exists=relation is not none -%}\n\n    {%- if relation_exists -%}\n        {%- do relations.append(relation) -%}\n    {%- endif -%}\n\n    {%- endfor -%}\n    \n    {%- if relations != [] -%}\n        {{ dbt_utils.union_relations(relations) }}\n    {%- else -%}\n    {% if execute and not var('fivetran__remove_empty_table_warnings', false) -%}\n    {{ exceptions.warn(\"\\n\\nPlease be aware: The \" ~ table_identifier|upper ~ \" table was not found in your \" ~ default_schema|upper ~ \" schema(s). The Fivetran dbt package will create a completely empty \" ~ table_identifier|upper ~ \" staging model as to not break downstream transformations. To turn off these warnings, set the `fivetran__remove_empty_table_warnings` variable to TRUE (see https://github.com/fivetran/dbt_fivetran_utils/tree/releases/v0.4.latest#union_data-source for details).\\n\") }}\n    {% endif -%}\n    select \n        cast(null as {{ dbt.type_string() }}) as _dbt_source_relation\n    limit 0\n    {%- endif -%}\n\n{%- elif var(union_database_variable, none) -%}\n\n    {%- set relations = [] -%}\n\n    {%- for database in var(union_database_variable) -%}\n    {%- set relation=adapter.get_relation(\n        database=source(schema, table_identifier).database if var('has_defined_sources', false) else database,\n        schema=source(schema, table_identifier).schema if var('has_defined_sources', false) else var(schema_variable, default_schema),\n        identifier=source(schema, table_identifier).identifier if var('has_defined_sources', false) else table_identifier\n    ) -%}\n\n    {%- set relation_exists=relation is not none -%}\n\n    {%- if relation_exists -%}\n        {%- do relations.append(relation) -%}\n    {%- endif -%}\n\n    {%- endfor -%}\n\n    {%- if relations != [] -%}\n        {{ dbt_utils.union_relations(relations) }}\n    {%- else -%}\n    {% if execute and not var('fivetran__remove_empty_table_warnings', false) -%}\n    {{ exceptions.warn(\"\\n\\nPlease be aware: The \" ~ table_identifier|upper ~ \" table was not found in your \" ~ default_schema|upper ~ \" schema(s). The Fivetran dbt package will create a completely empty \" ~ table_identifier|upper ~ \" staging model as to not break downstream transformations. To turn off these warnings, set the `fivetran__remove_empty_table_warnings` variable to TRUE (see https://github.com/fivetran/dbt_fivetran_utils/tree/releases/v0.4.latest#union_data-source for details).\\n\") }}\n    {% endif -%}\n    select \n        cast(null as {{ dbt.type_string() }}) as _dbt_source_relation\n    limit 0\n    {%- endif -%}\n\n{%- else -%}\n    {% set exception_schemas = {\"linkedin_company_pages\": \"linkedin_pages\", \"instagram_business_pages\": \"instagram_business\"} %}\n    {% set relation = namespace(value=\"\") %}\n    {% if default_schema in exception_schemas.keys() %}\n        {% for corrected_schema_name in exception_schemas.items() %}   \n            {% if default_schema in corrected_schema_name %}\n                {# In order for this macro to effectively work within upstream integration tests (mainly used by the Fivetran dbt package maintainers), this identifier variable selection is required to use the macro with different identifier names. #}\n                {% set identifier_var = corrected_schema_name[1] + \"_\" + table_identifier + \"_identifier\"  %}\n                {%- set relation.value=adapter.get_relation(\n                    database=source(corrected_schema_name[1], table_identifier).database,\n                    schema=source(corrected_schema_name[1], table_identifier).schema,\n                    identifier=var(identifier_var, table_identifier)\n                ) -%}\n            {% endif %}\n        {% endfor %}\n    {% else %}\n        {# In order for this macro to effectively work within upstream integration tests (mainly used by the Fivetran dbt package maintainers), this identifier variable selection is required to use the macro with different identifier names. #}\n        {% set identifier_var = default_schema + \"_\" + table_identifier + \"_identifier\"  %}\n        {# Unfortunately the Twitter Organic identifiers were misspelled. As such, we will need to account for this in the model. This will be adjusted in the Twitter Organic package, but to ensure backwards compatibility, this needs to be included. #}\n        {% if var(identifier_var, none) is none %} \n            {% set identifier_var = default_schema + \"_\" + table_identifier + \"_identifer\"  %}\n        {% endif %}\n        {%- set relation.value=adapter.get_relation(\n            database=source(default_schema, table_identifier).database,\n            schema=source(default_schema, table_identifier).schema,\n            identifier=var(identifier_var, table_identifier)\n        ) -%}\n    {% endif %}\n{%- set table_exists=relation.value is not none -%}\n\n{%- if table_exists -%}\n    select * \n    from {{ relation.value }}\n{%- else -%}\n    {% if execute and not var('fivetran__remove_empty_table_warnings', false) -%}\n    {{ exceptions.warn(\"\\n\\nPlease be aware: The \" ~ table_identifier|upper ~ \" table was not found in your \" ~ default_schema|upper ~ \" schema(s). The Fivetran dbt package will create a completely empty \" ~ table_identifier|upper ~ \" staging model as to not break downstream transformations. To turn off these warnings, set the `fivetran__remove_empty_table_warnings` variable to TRUE (see https://github.com/fivetran/dbt_fivetran_utils/tree/releases/v0.4.latest#union_data-source for details).\\n\") }}\n    {% endif -%}\n    select \n        cast(null as {{ dbt.type_string() }}) as _dbt_source_relation\n    limit 0\n{%- endif -%}\n{%- endif -%}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_utils.union_relations", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3716888, "supported_languages": null}, "macro.fivetran_utils.dummy_coalesce_value": {"name": "dummy_coalesce_value", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/dummy_coalesce_value.sql", "original_file_path": "macros/dummy_coalesce_value.sql", "unique_id": "macro.fivetran_utils.dummy_coalesce_value", "macro_sql": "{% macro dummy_coalesce_value(column) %}\n\n{% set coalesce_value = {\n 'STRING': \"'DUMMY_STRING'\",\n 'BOOLEAN': 'null',\n 'INT': 999999999,\n 'FLOAT': 999999999.99,\n 'TIMESTAMP': 'cast(\"2099-12-31\" as timestamp)',\n 'DATE': 'cast(\"2099-12-31\" as date)',\n} %}\n\n{% if column.is_float() %}\n{{ return(coalesce_value['FLOAT']) }}\n\n{% elif column.is_numeric() %}\n{{ return(coalesce_value['INT']) }}\n\n{% elif column.is_string() %}\n{{ return(coalesce_value['STRING']) }}\n\n{% elif column.data_type|lower == 'boolean' %}\n{{ return(coalesce_value['BOOLEAN']) }}\n\n{% elif 'timestamp' in column.data_type|lower %}\n{{ return(coalesce_value['TIMESTAMP']) }}\n\n{% elif 'date' in column.data_type|lower %}\n{{ return(coalesce_value['DATE']) }}\n\n{% elif 'int' in column.data_type|lower %}\n{{ return(coalesce_value['INT']) }}\n\n{% endif %}\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.373164, "supported_languages": null}, "macro.fivetran_utils.extract_url_parameter": {"name": "extract_url_parameter", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/extract_url_parameter.sql", "original_file_path": "macros/extract_url_parameter.sql", "unique_id": "macro.fivetran_utils.extract_url_parameter", "macro_sql": "{% macro extract_url_parameter(field, url_parameter) -%}\n\n{{ adapter.dispatch('extract_url_parameter', 'fivetran_utils') (field, url_parameter) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__extract_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.373513, "supported_languages": null}, "macro.fivetran_utils.default__extract_url_parameter": {"name": "default__extract_url_parameter", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/extract_url_parameter.sql", "original_file_path": "macros/extract_url_parameter.sql", "unique_id": "macro.fivetran_utils.default__extract_url_parameter", "macro_sql": "{% macro default__extract_url_parameter(field, url_parameter) -%}\n\n{{ dbt_utils.get_url_parameter(field, url_parameter) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.373667, "supported_languages": null}, "macro.fivetran_utils.spark__extract_url_parameter": {"name": "spark__extract_url_parameter", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/extract_url_parameter.sql", "original_file_path": "macros/extract_url_parameter.sql", "unique_id": "macro.fivetran_utils.spark__extract_url_parameter", "macro_sql": "{% macro spark__extract_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"=([^&]+)'\" -%}\nnullif(regexp_extract({{ field }}, {{ formatted_url_parameter }}, 1), '')\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.373866, "supported_languages": null}, "macro.fivetran_utils.wrap_in_quotes": {"name": "wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.wrap_in_quotes", "macro_sql": "{%- macro wrap_in_quotes(object_to_quote) -%}\n\n{{ return(adapter.dispatch('wrap_in_quotes', 'fivetran_utils')(object_to_quote)) }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.fivetran_utils.snowflake__wrap_in_quotes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.374208, "supported_languages": null}, "macro.fivetran_utils.default__wrap_in_quotes": {"name": "default__wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.default__wrap_in_quotes", "macro_sql": "{%- macro default__wrap_in_quotes(object_to_quote)  -%}\n{# bigquery, spark, databricks #}\n    `{{ object_to_quote }}`\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.374327, "supported_languages": null}, "macro.fivetran_utils.snowflake__wrap_in_quotes": {"name": "snowflake__wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.snowflake__wrap_in_quotes", "macro_sql": "{%- macro snowflake__wrap_in_quotes(object_to_quote)  -%}\n    \"{{ object_to_quote | upper }}\"\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.374444, "supported_languages": null}, "macro.fivetran_utils.redshift__wrap_in_quotes": {"name": "redshift__wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.redshift__wrap_in_quotes", "macro_sql": "{%- macro redshift__wrap_in_quotes(object_to_quote)  -%}\n    \"{{ object_to_quote }}\"\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3745458, "supported_languages": null}, "macro.fivetran_utils.postgres__wrap_in_quotes": {"name": "postgres__wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.postgres__wrap_in_quotes", "macro_sql": "{%- macro postgres__wrap_in_quotes(object_to_quote)  -%}\n    \"{{ object_to_quote }}\"\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.374646, "supported_languages": null}, "macro.fivetran_utils.array_agg": {"name": "array_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "unique_id": "macro.fivetran_utils.array_agg", "macro_sql": "{% macro array_agg(field_to_agg) -%}\n\n{{ adapter.dispatch('array_agg', 'fivetran_utils') (field_to_agg) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__array_agg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.374906, "supported_languages": null}, "macro.fivetran_utils.default__array_agg": {"name": "default__array_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "unique_id": "macro.fivetran_utils.default__array_agg", "macro_sql": "{% macro default__array_agg(field_to_agg) %}\n    array_agg({{ field_to_agg }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.375013, "supported_languages": null}, "macro.fivetran_utils.redshift__array_agg": {"name": "redshift__array_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "unique_id": "macro.fivetran_utils.redshift__array_agg", "macro_sql": "{% macro redshift__array_agg(field_to_agg) %}\n    listagg({{ field_to_agg }}, ',')\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3751192, "supported_languages": null}, "macro.fivetran_utils.empty_variable_warning": {"name": "empty_variable_warning", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/empty_variable_warning.sql", "original_file_path": "macros/empty_variable_warning.sql", "unique_id": "macro.fivetran_utils.empty_variable_warning", "macro_sql": "{% macro empty_variable_warning(variable, downstream_model) %}\n\n{% if not var(variable) %}\n{{ log(\n    \"\"\"\n    Warning: You have passed an empty list to the \"\"\" ~ variable ~ \"\"\".\n    As a result, you won't see the history of any columns in the \"\"\" ~ downstream_model ~ \"\"\" model.\n    \"\"\",\n    info=True\n) }}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.375521, "supported_languages": null}, "macro.fivetran_utils.enabled_vars_one_true": {"name": "enabled_vars_one_true", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/enabled_vars_one_true.sql", "original_file_path": "macros/enabled_vars_one_true.sql", "unique_id": "macro.fivetran_utils.enabled_vars_one_true", "macro_sql": "{% macro enabled_vars_one_true(vars) %}\n\n{% for v in vars %}\n    \n    {% if var(v, False) == True %}\n    {{ return(True) }}\n    {% endif %}\n\n{% endfor %}\n\n{{ return(False) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.375921, "supported_languages": null}, "macro.fivetran_log.get_log_columns": {"name": "get_log_columns", "resource_type": "macro", "package_name": "fivetran_log", "path": "macros/get_log_columns.sql", "original_file_path": "macros/get_log_columns.sql", "unique_id": "macro.fivetran_log.get_log_columns", "macro_sql": "{% macro get_log_columns() %}\n\n{% set columns = [\n    {\"name\": \"_fivetran_synced\", \"datatype\": dbt.type_timestamp()},\n    {\"name\": \"connector_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"event\", \"datatype\": dbt.type_string()},\n    {\"name\": \"id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"message_data\", \"datatype\": dbt.type_string()},\n    {\"name\": \"message_event\", \"datatype\": dbt.type_string()},\n    {\"name\": \"sync_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"time_stamp\", \"datatype\": dbt.type_timestamp()},\n    {\"name\": \"transformation_id\", \"datatype\": dbt.type_string()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3770618, "supported_languages": null}, "macro.fivetran_log.does_table_exist": {"name": "does_table_exist", "resource_type": "macro", "package_name": "fivetran_log", "path": "macros/does_table_exist.sql", "original_file_path": "macros/does_table_exist.sql", "unique_id": "macro.fivetran_log.does_table_exist", "macro_sql": "{%- macro does_table_exist(table_name) -%}\n    {%- if execute -%} -- returns true when dbt is in execute mode\n    {%- set ns = namespace(has_table=false) -%} -- declare boolean namespace and default value \n        {%- for node in graph.sources.values() -%} -- grab sources from the dictionary of nodes \n        -- call the database for the matching table\n            {%- if node.name | lower == table_name | lower -%} \n                {%- set source_relation = adapter.get_relation(\n                        database=node.database,\n                        schema=node.schema,\n                        identifier=node.identifier ) -%} \n            {% endif %}\n            {%- if source_relation == None -%} \n                {{ return(False) }} -- return false if relation identified by the database.schema.identifier does not exist for the given table name\n            {% endif %}\n        {%- endfor -%}\n        {{ return(True) }}\n    {%- endif -%} \n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.378027, "supported_languages": null}, "macro.fivetran_log.get_connector_columns": {"name": "get_connector_columns", "resource_type": "macro", "package_name": "fivetran_log", "path": "macros/get_brand_columns.sql", "original_file_path": "macros/get_brand_columns.sql", "unique_id": "macro.fivetran_log.get_connector_columns", "macro_sql": "{% macro get_connector_columns() %}\n\n{% set columns = [\n    {\"name\": \"_fivetran_deleted\", \"datatype\": dbt.type_boolean()},\n    {\"name\": \"_fivetran_synced\", \"datatype\": dbt.type_timestamp()},\n    {\"name\": \"connecting_user_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"connector_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"connector_name\", \"datatype\": dbt.type_string()},\n    {\"name\": \"connector_type\", \"datatype\": dbt.type_string()},\n    {\"name\": \"connector_type_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"destination_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"paused\", \"datatype\": dbt.type_boolean()},\n    {\"name\": \"service_version\", \"datatype\": dbt.type_int()},\n    {\"name\": \"signed_up\", \"datatype\": dbt.type_timestamp()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_boolean", "macro.dbt.type_timestamp", "macro.dbt.type_string", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702408015.3793228, "supported_languages": null}}, "docs": {"doc.dbt.__overview__": {"name": "__overview__", "resource_type": "doc", "package_name": "dbt", "path": "overview.md", "original_file_path": "docs/overview.md", "unique_id": "doc.dbt.__overview__", "block_contents": "### Welcome!\n\nWelcome to the auto-generated documentation for your dbt project!\n\n### Navigation\n\nYou can use the `Project` and `Database` navigation tabs on the left side of the window to explore the models\nin your project.\n\n#### Project Tab\nThe `Project` tab mirrors the directory structure of your dbt project. In this tab, you can see all of the\nmodels defined in your dbt project, as well as models imported from dbt packages.\n\n#### Database Tab\nThe `Database` tab also exposes your models, but in a format that looks more like a database explorer. This view\nshows relations (tables and views) grouped into database schemas. Note that ephemeral models are _not_ shown\nin this interface, as they do not exist in the database.\n\n### Graph Exploration\nYou can click the blue icon on the bottom-right corner of the page to view the lineage graph of your models.\n\nOn model pages, you'll see the immediate parents and children of the model you're exploring. By clicking the `Expand`\nbutton at the top-right of this lineage pane, you'll be able to see all of the models that are used to build,\nor are built from, the model you're exploring.\n\nOnce expanded, you'll be able to use the `--select` and `--exclude` model selection syntax to filter the\nmodels in the graph. For more information on model selection, check out the [dbt docs](https://docs.getdbt.com/docs/model-selection-syntax).\n\nNote that you can also right-click on models to interactively filter and explore the graph.\n\n---\n\n### More information\n\n- [What is dbt](https://docs.getdbt.com/docs/introduction)?\n- Read the [dbt viewpoint](https://docs.getdbt.com/docs/viewpoint)\n- [Installation](https://docs.getdbt.com/docs/installation)\n- Join the [dbt Community](https://www.getdbt.com/community/) for questions and discussion"}}, "exposures": {}, "metrics": {}, "groups": {}, "selectors": {}, "disabled": {}, "parent_map": {"seed.fivetran_log_integration_tests.log": [], "seed.fivetran_log_integration_tests.destination_membership": [], "seed.fivetran_log_integration_tests.credits_used": [], "seed.fivetran_log_integration_tests.destination": [], "seed.fivetran_log_integration_tests.connector": [], "seed.fivetran_log_integration_tests.user": [], "seed.fivetran_log_integration_tests.account": [], "seed.fivetran_log_integration_tests.usage_cost": [], "seed.fivetran_log_integration_tests.incremental_mar": [], "model.fivetran_log.fivetran_platform__schema_changelog": ["model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.stg_fivetran_platform__log"], "model.fivetran_log.fivetran_platform__connector_daily_events": ["model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.stg_fivetran_platform__log", "source.fivetran_log.fivetran_platform.connector"], "model.fivetran_log.fivetran_platform__audit_user_activity": ["model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination", "model.fivetran_log.stg_fivetran_platform__destination_membership", "model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.stg_fivetran_platform__user"], "model.fivetran_log.fivetran_platform__connector_status": ["model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination", "model.fivetran_log.stg_fivetran_platform__log"], "model.fivetran_log.fivetran_platform__usage_mar_destination_history": ["model.fivetran_log.fivetran_platform__mar_table_history", "model.fivetran_log.stg_fivetran_platform__credits_used", "model.fivetran_log.stg_fivetran_platform__usage_cost"], "model.fivetran_log.fivetran_platform__audit_table": ["model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.stg_fivetran_platform__log"], "model.fivetran_log.fivetran_platform__mar_table_history": ["model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination", "model.fivetran_log.stg_fivetran_platform__incremental_mar"], "model.fivetran_log.stg_fivetran_platform__user": ["source.fivetran_log.fivetran_platform.user"], "model.fivetran_log.stg_fivetran_platform__destination_membership": ["source.fivetran_log.fivetran_platform.destination_membership"], "model.fivetran_log.stg_fivetran_platform__credits_used": [], "model.fivetran_log.stg_fivetran_platform__usage_cost": [], "model.fivetran_log.stg_fivetran_platform__destination": ["source.fivetran_log.fivetran_platform.destination"], "model.fivetran_log.stg_fivetran_platform__log": ["model.fivetran_log.stg_fivetran_platform__log_tmp"], "model.fivetran_log.stg_fivetran_platform__incremental_mar": ["source.fivetran_log.fivetran_platform.incremental_mar"], "model.fivetran_log.stg_fivetran_platform__connector": ["model.fivetran_log.stg_fivetran_platform__connector_tmp"], "model.fivetran_log.stg_fivetran_platform__account": ["source.fivetran_log.fivetran_platform.account"], "model.fivetran_log.stg_fivetran_platform__connector_tmp": ["source.fivetran_log.fivetran_platform.connector"], "model.fivetran_log.stg_fivetran_platform__log_tmp": ["source.fivetran_log.fivetran_platform.log"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89": ["model.fivetran_log.fivetran_platform__connector_status"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441": ["model.fivetran_log.fivetran_platform__mar_table_history"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f": ["model.fivetran_log.fivetran_platform__connector_daily_events"], "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7": ["model.fivetran_log.fivetran_platform__audit_table"], "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af": ["model.fivetran_log.fivetran_platform__audit_table"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493": ["model.fivetran_log.fivetran_platform__schema_changelog"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at.be572689a3": ["model.fivetran_log.fivetran_platform__audit_user_activity"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a": ["model.fivetran_log.stg_fivetran_platform__connector"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38": ["model.fivetran_log.stg_fivetran_platform__credits_used"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f": ["model.fivetran_log.stg_fivetran_platform__usage_cost"], "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed": ["model.fivetran_log.stg_fivetran_platform__destination"], "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780": ["model.fivetran_log.stg_fivetran_platform__destination"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d": ["model.fivetran_log.stg_fivetran_platform__log"], "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc": ["model.fivetran_log.stg_fivetran_platform__account"], "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e": ["model.fivetran_log.stg_fivetran_platform__account"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a": ["model.fivetran_log.stg_fivetran_platform__destination_membership"], "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9": ["model.fivetran_log.stg_fivetran_platform__user"], "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0": ["model.fivetran_log.stg_fivetran_platform__user"], "source.fivetran_log.fivetran_platform.incremental_mar": [], "source.fivetran_log.fivetran_platform.connector": [], "source.fivetran_log.fivetran_platform.credits_used": [], "source.fivetran_log.fivetran_platform.usage_cost": [], "source.fivetran_log.fivetran_platform.destination": [], "source.fivetran_log.fivetran_platform.log": [], "source.fivetran_log.fivetran_platform.account": [], "source.fivetran_log.fivetran_platform.destination_membership": [], "source.fivetran_log.fivetran_platform.user": []}, "child_map": {"seed.fivetran_log_integration_tests.log": [], "seed.fivetran_log_integration_tests.destination_membership": [], "seed.fivetran_log_integration_tests.credits_used": [], "seed.fivetran_log_integration_tests.destination": [], "seed.fivetran_log_integration_tests.connector": [], "seed.fivetran_log_integration_tests.user": [], "seed.fivetran_log_integration_tests.account": [], "seed.fivetran_log_integration_tests.usage_cost": [], "seed.fivetran_log_integration_tests.incremental_mar": [], "model.fivetran_log.fivetran_platform__schema_changelog": ["test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493"], "model.fivetran_log.fivetran_platform__connector_daily_events": ["test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f"], "model.fivetran_log.fivetran_platform__audit_user_activity": ["test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at.be572689a3"], "model.fivetran_log.fivetran_platform__connector_status": ["model.fivetran_log.fivetran_platform__audit_table", "model.fivetran_log.fivetran_platform__connector_daily_events", "model.fivetran_log.fivetran_platform__schema_changelog", "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89"], "model.fivetran_log.fivetran_platform__usage_mar_destination_history": ["test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd"], "model.fivetran_log.fivetran_platform__audit_table": ["test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af", "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7"], "model.fivetran_log.fivetran_platform__mar_table_history": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history", "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441"], "model.fivetran_log.stg_fivetran_platform__user": ["model.fivetran_log.fivetran_platform__audit_user_activity", "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0", "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9"], "model.fivetran_log.stg_fivetran_platform__destination_membership": ["model.fivetran_log.fivetran_platform__audit_user_activity", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a"], "model.fivetran_log.stg_fivetran_platform__credits_used": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38"], "model.fivetran_log.stg_fivetran_platform__usage_cost": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f"], "model.fivetran_log.stg_fivetran_platform__destination": ["model.fivetran_log.fivetran_platform__audit_user_activity", "model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.fivetran_platform__mar_table_history", "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780", "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed"], "model.fivetran_log.stg_fivetran_platform__log": ["model.fivetran_log.fivetran_platform__audit_table", "model.fivetran_log.fivetran_platform__audit_user_activity", "model.fivetran_log.fivetran_platform__connector_daily_events", "model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.fivetran_platform__schema_changelog", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d"], "model.fivetran_log.stg_fivetran_platform__incremental_mar": ["model.fivetran_log.fivetran_platform__mar_table_history"], "model.fivetran_log.stg_fivetran_platform__connector": ["model.fivetran_log.fivetran_platform__audit_user_activity", "model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.fivetran_platform__mar_table_history", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a"], "model.fivetran_log.stg_fivetran_platform__account": ["test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e", "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc"], "model.fivetran_log.stg_fivetran_platform__connector_tmp": ["model.fivetran_log.stg_fivetran_platform__connector"], "model.fivetran_log.stg_fivetran_platform__log_tmp": ["model.fivetran_log.stg_fivetran_platform__log"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f": [], "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7": [], "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at.be572689a3": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f": [], "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed": [], "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d": [], "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc": [], "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a": [], "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9": [], "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0": [], "source.fivetran_log.fivetran_platform.incremental_mar": ["model.fivetran_log.stg_fivetran_platform__incremental_mar"], "source.fivetran_log.fivetran_platform.connector": ["model.fivetran_log.fivetran_platform__connector_daily_events", "model.fivetran_log.stg_fivetran_platform__connector_tmp"], "source.fivetran_log.fivetran_platform.credits_used": [], "source.fivetran_log.fivetran_platform.usage_cost": [], "source.fivetran_log.fivetran_platform.destination": ["model.fivetran_log.stg_fivetran_platform__destination"], "source.fivetran_log.fivetran_platform.log": ["model.fivetran_log.stg_fivetran_platform__log_tmp"], "source.fivetran_log.fivetran_platform.account": ["model.fivetran_log.stg_fivetran_platform__account"], "source.fivetran_log.fivetran_platform.destination_membership": ["model.fivetran_log.stg_fivetran_platform__destination_membership"], "source.fivetran_log.fivetran_platform.user": ["model.fivetran_log.stg_fivetran_platform__user"]}, "group_map": {}, "saved_queries": {}, "semantic_models": {}}
\ No newline at end of file
+{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v11.json", "dbt_version": "1.7.3", "generated_at": "2023-12-13T20:53:21.551730Z", "invocation_id": "577df33a-3268-4af6-b091-fe0bceede99b", "env": {}, "project_name": "fivetran_log_integration_tests", "project_id": "601c934d3c286a01c58ed00bc69f8e64", "user_id": "2bfa9082-ea6e-467b-abdc-d0514ab111d9", "send_anonymous_usage_stats": true, "adapter_type": "bigquery"}, "nodes": {"seed.fivetran_log_integration_tests.log": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests", "name": "log", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "log.csv", "original_file_path": "seeds/log.csv", "unique_id": "seed.fivetran_log_integration_tests.log", "fqn": ["fivetran_log_integration_tests", "log"], "alias": "log", "checksum": {"name": "sha256", "checksum": "3637d563f8916ee1a902edb08e4cd17c35bb975b7b6ca34093b553853e58edcc"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "time_stamp": "timestamp", "transformation_id": "string"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"time_stamp": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}", "transformation_id": "{{ 'string' if target.type in ('bigquery', 'spark', 'databricks') else 'varchar' if target.type != 'sqlserver' else 'varchar(256)' }}"}}, "created_at": 1702500739.081266, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests`.`log`", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.destination_membership": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests", "name": "destination_membership", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "destination_membership.csv", "original_file_path": "seeds/destination_membership.csv", "unique_id": "seed.fivetran_log_integration_tests.destination_membership", "fqn": ["fivetran_log_integration_tests", "destination_membership"], "alias": "destination_membership", "checksum": {"name": "sha256", "checksum": "ea1c1b6a3929e8d4de990970c8cc497af21e2a5e12c1623be69462c22a3b0e1a"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "activated_at": "timestamp", "joined_at": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"activated_at": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}", "joined_at": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"}}, "created_at": 1702500739.090106, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests`.`destination_membership`", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.credits_used": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests", "name": "credits_used", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "credits_used.csv", "original_file_path": "seeds/credits_used.csv", "unique_id": "seed.fivetran_log_integration_tests.credits_used", "fqn": ["fivetran_log_integration_tests", "credits_used"], "alias": "credits_used", "checksum": {"name": "sha256", "checksum": "b6954f4070acaf5073fc4c4001c3ab8ebc254e0ddbe2226ba063e0cbc3001d7f"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "credits_consumed": "int64"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"credits_consumed": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"}}, "created_at": 1702500739.091616, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests`.`credits_used`", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.destination": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests", "name": "destination", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "destination.csv", "original_file_path": "seeds/destination.csv", "unique_id": "seed.fivetran_log_integration_tests.destination", "fqn": ["fivetran_log_integration_tests", "destination"], "alias": "destination", "checksum": {"name": "sha256", "checksum": "0f6955f215269c7d8754298fb9485f3196765564fccf9a138cf02a8ccb160ab3"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "created_at": "timestamp", "id": "string"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"created_at": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}", "id": "{{ 'string' if target.type in ('bigquery', 'spark', 'databricks') else 'varchar' if target.type != 'sqlserver' else 'varchar(256)' }}"}}, "created_at": 1702500739.0936918, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests`.`destination`", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.connector": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests", "name": "connector", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "connector.csv", "original_file_path": "seeds/connector.csv", "unique_id": "seed.fivetran_log_integration_tests.connector", "fqn": ["fivetran_log_integration_tests", "connector"], "alias": "connector", "checksum": {"name": "sha256", "checksum": "8b9be1f60c7b2e33da88c97eb66a3241cb6fffad4af3e7e32c355f8f27c0c34c"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "signed_up": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"signed_up": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"}}, "created_at": 1702500739.095144, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests`.`connector`", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.user": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests", "name": "user", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "user.csv", "original_file_path": "seeds/user.csv", "unique_id": "seed.fivetran_log_integration_tests.user", "fqn": ["fivetran_log_integration_tests", "user"], "alias": "user", "checksum": {"name": "sha256", "checksum": "ce690544aed43600d42695a8fdf5e1fa14c342c04b22cadcbdb0934a0cf92a0e"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "created_at": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"created_at": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"}}, "created_at": 1702500739.0965672, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests`.`user`", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.account": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests", "name": "account", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "account.csv", "original_file_path": "seeds/account.csv", "unique_id": "seed.fivetran_log_integration_tests.account", "fqn": ["fivetran_log_integration_tests", "account"], "alias": "account", "checksum": {"name": "sha256", "checksum": "ec33e80835ab8169b97dd17dd2699f84862f798de4c2d0a90c8d261a111d3495"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "created_at": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"created_at": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"}}, "created_at": 1702500739.097997, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests`.`account`", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.usage_cost": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests", "name": "usage_cost", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "usage_cost.csv", "original_file_path": "seeds/usage_cost.csv", "unique_id": "seed.fivetran_log_integration_tests.usage_cost", "fqn": ["fivetran_log_integration_tests", "usage_cost"], "alias": "usage_cost", "checksum": {"name": "sha256", "checksum": "3cbe3dadc6ca6dd2383cd5172fe2688bccf65af0b6bc30a7583c85aa41185a58"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"_fivetran_synced": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}"}}, "created_at": 1702500739.0993989, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests`.`usage_cost`", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "seed.fivetran_log_integration_tests.incremental_mar": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests", "name": "incremental_mar", "resource_type": "seed", "package_name": "fivetran_log_integration_tests", "path": "incremental_mar.csv", "original_file_path": "seeds/incremental_mar.csv", "unique_id": "seed.fivetran_log_integration_tests.incremental_mar", "fqn": ["fivetran_log_integration_tests", "incremental_mar"], "alias": "incremental_mar", "checksum": {"name": "sha256", "checksum": "e567d62bbb002d465ce48fea541f7d075cd7ceb5c82f439f4a9d4e715bd13018"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "measured_date": "timestamp", "incremental_rows": "int64"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"measured_date": "{{ 'datetime2' if target.type == 'sqlserver' else 'timestamp' }}", "incremental_rows": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"}}, "created_at": 1702500739.143123, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests`.`incremental_mar`", "raw_code": "", "root_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "depends_on": {"macros": []}}, "model.fivetran_log.fivetran_platform__schema_changelog": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "fivetran_platform__schema_changelog", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__schema_changelog.sql", "original_file_path": "models/fivetran_platform__schema_changelog.sql", "unique_id": "model.fivetran_log.fivetran_platform__schema_changelog", "fqn": ["fivetran_log", "fivetran_platform__schema_changelog"], "alias": "fivetran_platform__schema_changelog", "checksum": {"name": "sha256", "checksum": "66575c41e1af32f48a0a3e41cb83e79e191cc2c9389c884d52b2664a3a7c9044"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table capturing information around each kind of schema change made to a connector. Schema changes include altering and creating tables, changing the schema configuration, and creating schemas. \n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector whose schema was changed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination that the table is being written to.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the schema was changed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_subtype": {"name": "event_subtype", "description": "Type of schema change event. One of 'alter_table', 'create_table', 'change_schema_config', 'create_schema'.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_data": {"name": "message_data", "description": "The details of the event in JSON format.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Name of the table, if a table is being altered or created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "Name of the schema, if a schema or table is being created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702500739.440614, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__schema_changelog`", "raw_code": "with schema_changes as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__log') }}\n\n    where event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n),\n\nconnector as (\n\n    select *\n    from {{ ref('fivetran_platform__connector_status') }}\n),\n\nadd_connector_info as (\n\n    select \n        schema_changes.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n\n    from schema_changes join connector \n        on schema_changes.connector_id = connector.connector_id\n),\n\nfinal as (\n\n    select\n        connector_id,\n        connector_name,\n        destination_id,\n        destination_name,\n        created_at,\n        event_subtype,\n        message_data,\n\n        case \n        when event_subtype = 'alter_table' then {{ fivetran_utils.json_parse(string='message_data', string_path=['table']) }} \n        when event_subtype = 'create_table' then {{ fivetran_utils.json_parse(string='message_data', string_path=['name']) }} \n        else null end as table_name,\n\n        case \n        when event_subtype = 'create_schema' or event_subtype = 'create_table' then {{ fivetran_utils.json_parse(string='message_data', string_path=['schema']) }} \n        else null end as schema_name\n    \n    from add_connector_info\n)\n\nselect * from final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "fivetran_platform__connector_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_utils.json_parse"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.fivetran_platform__connector_status"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__schema_changelog.sql", "compiled": true, "compiled_code": "with schema_changes as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log`\n\n    where event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n),\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__connector_status`\n),\n\nadd_connector_info as (\n\n    select \n        schema_changes.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n\n    from schema_changes join connector \n        on schema_changes.connector_id = connector.connector_id\n),\n\nfinal as (\n\n    select\n        connector_id,\n        connector_name,\n        destination_id,\n        destination_name,\n        created_at,\n        event_subtype,\n        message_data,\n\n        case \n        when event_subtype = 'alter_table' then \n\n \n  json_extract_scalar(message_data, '$.table')\n\n \n        when event_subtype = 'create_table' then \n\n \n  json_extract_scalar(message_data, '$.name')\n\n \n        else null end as table_name,\n\n        case \n        when event_subtype = 'create_schema' or event_subtype = 'create_table' then \n\n \n  json_extract_scalar(message_data, '$.schema')\n\n \n        else null end as schema_name\n    \n    from add_connector_info\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__connector_daily_events": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "fivetran_platform__connector_daily_events", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__connector_daily_events.sql", "original_file_path": "models/fivetran_platform__connector_daily_events.sql", "unique_id": "model.fivetran_log.fivetran_platform__connector_daily_events", "fqn": ["fivetran_log", "fivetran_platform__connector_daily_events"], "alias": "fivetran_platform__connector_daily_events", "checksum": {"name": "sha256", "checksum": "eda37a3b96d26070cc5403c82a7da8259413a984783f0d9eaee4fe23f8272474"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of each connector's daily history of the quantity of api calls, schema changes, and records modified, starting at the connector's setup date. \n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination loading data from this connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "date_day": {"name": "date_day", "description": "Date on which the number of api calls for the connector is measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "count_api_calls": {"name": "count_api_calls", "description": "The number of api call events logged for this connector on this day.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "count_record_modifications": {"name": "count_record_modifications", "description": "The sum of all records modified (includes updates, inserts, and deletes).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "count_schema_changes": {"name": "count_schema_changes", "description": "The number of schema change events for this connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702500739.4375901, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__connector_daily_events`", "raw_code": "-- depends_on: {{ var('connector') }}\n\nwith connector as (\n    \n    select * \n    from {{ ref('fivetran_platform__connector_status') }}\n),\n\n-- grab api calls, schema changes, and record modifications\nlog_events as (\n\n    select \n        connector_id,\n        cast( {{ dbt.date_trunc('day', 'created_at') }} as date) as date_day,\n        case \n            when event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config') then 'schema_change' \n            else event_subtype end as event_subtype,\n\n        sum(case when event_subtype = 'records_modified' then cast( {{ fivetran_utils.json_parse(string='message_data', string_path=['count']) }} as {{ dbt.type_int()}} )\n        else 1 end) as count_events \n\n    from {{ ref('stg_fivetran_platform__log') }}\n\n    where event_subtype in ('api_call', \n                            'records_modified', \n                            'create_table', 'alter_table', 'create_schema', 'change_schema_config') -- all schema changes\n                            \n        and connector_id is not null\n\n    group by connector_id, cast( {{ dbt.date_trunc('day', 'created_at') }} as date), event_subtype\n),\n\npivot_out_events as (\n\n    select\n        connector_id,\n        date_day,\n        max(case when event_subtype = 'api_call' then count_events else 0 end) as count_api_calls,\n        max(case when event_subtype = 'records_modified' then count_events else 0 end) as count_record_modifications,\n        max(case when event_subtype = 'schema_change' then count_events else 0 end) as count_schema_changes\n\n    from log_events\n    group by connector_id, date_day\n), \n\nconnector_event_counts as (\n\n    select\n        pivot_out_events.date_day,\n        pivot_out_events.count_api_calls,\n        pivot_out_events.count_record_modifications,\n        pivot_out_events.count_schema_changes,\n        connector.connector_name,\n        connector.connector_id,\n        connector.connector_type,\n        connector.destination_name,\n        connector.destination_id,\n        connector.set_up_at\n    from\n    connector left join pivot_out_events \n        on pivot_out_events.connector_id = connector.connector_id\n),\n\nspine as (\n\n    {% if execute %}\n    {% set first_date_query %}\n        select  min( signed_up ) as min_date from {{ var('connector') }}\n    {% endset %}\n    {% set first_date = run_query(first_date_query).columns[0][0]|string %}\n    \n    {% else %} {% set first_date = \"2016-01-01\" %}\n    {% endif %}\n\n    select \n        cast(date_day as date) as date_day\n    from (\n        {{ fivetran_utils.fivetran_date_spine(\n            datepart = \"day\", \n            start_date =  \"cast('\" ~ first_date[0:10] ~ \"' as date)\", \n            end_date = dbt.dateadd(\"week\", 1, dbt.date_trunc('day', dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp())) \n            ) \n        }} \n    ) as date_spine\n),\n\nconnector_event_history as (\n\n    select\n        spine.date_day,\n        connector_event_counts.connector_name,\n        connector_event_counts.connector_id,\n        connector_event_counts.connector_type,\n        connector_event_counts.destination_name,\n        connector_event_counts.destination_id,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_api_calls\n            else 0\n        end) as count_api_calls,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_record_modifications\n            else 0\n        end) as count_record_modifications,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_schema_changes\n            else 0\n        end) as count_schema_changes\n    from\n    spine join connector_event_counts\n        on spine.date_day  >= cast({{ dbt.date_trunc('day', 'cast(connector_event_counts.set_up_at as date)') }} as date)\n\n    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id\n),\n\n-- now rejoin spine to get a complete calendar\njoin_event_history as (\n    \n    select\n        spine.date_day,\n        connector_event_history.connector_name,\n        connector_event_history.connector_id,\n        connector_event_history.connector_type,\n        connector_event_history.destination_name,\n        connector_event_history.destination_id,\n        max(connector_event_history.count_api_calls) as count_api_calls,\n        max(connector_event_history.count_record_modifications) as count_record_modifications,\n        max(connector_event_history.count_schema_changes) as count_schema_changes\n\n    from\n    spine left join connector_event_history\n        on spine.date_day = connector_event_history.date_day\n\n    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id\n),\n\nfinal as (\n\n    select *\n    from join_event_history\n\n    where date_day <= cast({{ dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp() }} as date)\n)\n\nselect *\nfrom final", "language": "sql", "refs": [{"name": "fivetran_platform__connector_status", "package": null, "version": null}, {"name": "stg_fivetran_platform__log", "package": null, "version": null}], "sources": [["fivetran_platform", "connector"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.fivetran_utils.json_parse", "macro.dbt.type_int", "macro.dbt.current_timestamp_backcompat", "macro.dbt.dateadd", "macro.fivetran_utils.fivetran_date_spine", "macro.dbt.run_query"], "nodes": ["source.fivetran_log.fivetran_platform.connector", "model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.stg_fivetran_platform__log"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__connector_daily_events.sql", "compiled": true, "compiled_code": "-- depends_on: `dbt-package-testing`.`fivetran_platform_integration_tests`.`connector`\n\nwith connector as (\n    \n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__connector_status`\n),\n\n-- grab api calls, schema changes, and record modifications\nlog_events as (\n\n    select \n        connector_id,\n        cast( timestamp_trunc(\n        cast(created_at as timestamp),\n        day\n    ) as date) as date_day,\n        case \n            when event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config') then 'schema_change' \n            else event_subtype end as event_subtype,\n\n        sum(case when event_subtype = 'records_modified' then cast( \n\n \n  json_extract_scalar(message_data, '$.count')\n\n as INT64 )\n        else 1 end) as count_events \n\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log`\n\n    where event_subtype in ('api_call', \n                            'records_modified', \n                            'create_table', 'alter_table', 'create_schema', 'change_schema_config') -- all schema changes\n                            \n        and connector_id is not null\n\n    group by connector_id, cast( timestamp_trunc(\n        cast(created_at as timestamp),\n        day\n    ) as date), event_subtype\n),\n\npivot_out_events as (\n\n    select\n        connector_id,\n        date_day,\n        max(case when event_subtype = 'api_call' then count_events else 0 end) as count_api_calls,\n        max(case when event_subtype = 'records_modified' then count_events else 0 end) as count_record_modifications,\n        max(case when event_subtype = 'schema_change' then count_events else 0 end) as count_schema_changes\n\n    from log_events\n    group by connector_id, date_day\n), \n\nconnector_event_counts as (\n\n    select\n        pivot_out_events.date_day,\n        pivot_out_events.count_api_calls,\n        pivot_out_events.count_record_modifications,\n        pivot_out_events.count_schema_changes,\n        connector.connector_name,\n        connector.connector_id,\n        connector.connector_type,\n        connector.destination_name,\n        connector.destination_id,\n        connector.set_up_at\n    from\n    connector left join pivot_out_events \n        on pivot_out_events.connector_id = connector.connector_id\n),\n\nspine as (\n\n    \n    \n    \n    \n    \n\n    select \n        cast(date_day as date) as date_day\n    from (\n        \n\n    \n\n\n\n\n\nwith rawdata as (\n\n    \n\n    \n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    \n    p0.generated_number * power(2, 0)\n     + \n    \n    p1.generated_number * power(2, 1)\n     + \n    \n    p2.generated_number * power(2, 2)\n     + \n    \n    p3.generated_number * power(2, 3)\n     + \n    \n    p4.generated_number * power(2, 4)\n     + \n    \n    p5.generated_number * power(2, 5)\n     + \n    \n    p6.generated_number * power(2, 6)\n     + \n    \n    p7.generated_number * power(2, 7)\n     + \n    \n    p8.generated_number * power(2, 8)\n     + \n    \n    p9.generated_number * power(2, 9)\n     + \n    \n    p10.generated_number * power(2, 10)\n    \n    \n    + 1\n    as generated_number\n\n    from\n\n    \n    p as p0\n     cross join \n    \n    p as p1\n     cross join \n    \n    p as p2\n     cross join \n    \n    p as p3\n     cross join \n    \n    p as p4\n     cross join \n    \n    p as p5\n     cross join \n    \n    p as p6\n     cross join \n    \n    p as p7\n     cross join \n    \n    p as p8\n     cross join \n    \n    p as p9\n     cross join \n    \n    p as p10\n    \n    \n\n    )\n\n    select *\n    from unioned\n    where generated_number <= 1734\n    order by generated_number\n\n\n\n),\n\nall_periods as (\n\n    select (\n        \n\n        datetime_add(\n            cast( cast('2019-03-22' as date) as datetime),\n        interval row_number() over (order by 1) - 1 day\n        )\n\n\n    ) as date_day\n    from rawdata\n\n),\n\nfiltered as (\n\n    select *\n    from all_periods\n    where date_day <= \n\n        datetime_add(\n            cast( timestamp_trunc(\n        cast(current_timestamp as timestamp),\n        day\n    ) as datetime),\n        interval 1 week\n        )\n\n\n\n)\n\nselect * from filtered\n\n\n        \n \n    ) as date_spine\n),\n\nconnector_event_history as (\n\n    select\n        spine.date_day,\n        connector_event_counts.connector_name,\n        connector_event_counts.connector_id,\n        connector_event_counts.connector_type,\n        connector_event_counts.destination_name,\n        connector_event_counts.destination_id,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_api_calls\n            else 0\n        end) as count_api_calls,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_record_modifications\n            else 0\n        end) as count_record_modifications,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_schema_changes\n            else 0\n        end) as count_schema_changes\n    from\n    spine join connector_event_counts\n        on spine.date_day  >= cast(timestamp_trunc(\n        cast(cast(connector_event_counts.set_up_at as date) as timestamp),\n        day\n    ) as date)\n\n    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id\n),\n\n-- now rejoin spine to get a complete calendar\njoin_event_history as (\n    \n    select\n        spine.date_day,\n        connector_event_history.connector_name,\n        connector_event_history.connector_id,\n        connector_event_history.connector_type,\n        connector_event_history.destination_name,\n        connector_event_history.destination_id,\n        max(connector_event_history.count_api_calls) as count_api_calls,\n        max(connector_event_history.count_record_modifications) as count_record_modifications,\n        max(connector_event_history.count_schema_changes) as count_schema_changes\n\n    from\n    spine left join connector_event_history\n        on spine.date_day = connector_event_history.date_day\n\n    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id\n),\n\nfinal as (\n\n    select *\n    from join_event_history\n\n    where date_day <= cast(current_timestamp as date)\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__audit_user_activity": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "fivetran_platform__audit_user_activity", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__audit_user_activity.sql", "original_file_path": "models/fivetran_platform__audit_user_activity.sql", "unique_id": "model.fivetran_log.fivetran_platform__audit_user_activity", "fqn": ["fivetran_log", "fivetran_platform__audit_user_activity"], "alias": "fivetran_platform__audit_user_activity", "checksum": {"name": "sha256", "checksum": "bb023dcde9b2d6ba20219f1818540bf5539108c0a826c87f6b281b853a34b3cf"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Each record represents a user-triggered action in your Fivetran instance.This model is intended for audit-trail purposes, as it can be very helpful when trying to trace a user action to a [log event](https://fivetran.com/docs/logs#logeventlist) such as a schema change, sync frequency update,  manual update, broken connection, etc.\n", "columns": {"date_day": {"name": "date_day", "description": "Date on which the user action occurred.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "day_name": {"name": "day_name", "description": "Abbreviated weekday name of the date on which this user action occurred (e.g. Mon, Tues, Wed)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "day_of_month": {"name": "day_of_month", "description": "Day of the month on which this user action occurred (e.g. 2022-03-06 --> 6).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "occurred_at": {"name": "occurred_at", "description": "Timestamp of when the event was logged.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "UI-facing name of the destination on which the user action was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` on which the user action was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector that the user acted upon.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "Foreign key referencing the `connector` that the user acted upon.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "Account email of the user who triggered the action.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "Given name of the user who triggered the action.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "Surname of the user who triggered the action.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "Foreign key referencing the `user` who triggered the action.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_role": {"name": "destination_role", "description": "The acting user's permissions for this individual destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_type": {"name": "event_type", "description": "The umbrella event type. Events can be classified as a warning, an error, or just an information log. Typically = 'INFO' for user-triggered actions.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_subtype": {"name": "event_subtype", "description": "The routine involved in the log event, defined [here](https://fivetran.com/docs/logs#logevents).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_data": {"name": "message_data", "description": "The details of the event in JSON format.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "log_id": {"name": "log_id", "description": "Unique ID of the log record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702500739.442663, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__audit_user_activity`", "raw_code": "with logs as (\n\n    select \n        *,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['actor']) }} as actor_email\n    from {{ ref('stg_fivetran_platform__log') }}\n),\n\nuser_logs as (\n\n    select *\n    from logs\n    where actor_email is not null \n        and lower(actor_email) != 'fivetran'\n),\n\nconnector as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__connector') }}\n),\n\ndestination as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__destination') }}\n),\n\n{%- if var('fivetran_platform_using_user', true) %}\nusers as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__user') }}\n),\n\n    {%- if var('fivetran_platform_using_destination_membership', true) %}\n    destination_membership as (\n\n        select *\n        from {{ ref('stg_fivetran_platform__destination_membership') }}\n    ),\n    {% endif -%}\n\n{% endif -%}\n\nfinal as (\n\n    select\n        {{ dbt.date_trunc('day', 'user_logs.created_at') }} as date_day,\n        \n        {% if target.type != 'sqlserver' -%}\n            {{ dbt_date.day_name('user_logs.created_at') }} as day_name,\n            {{ dbt_date.day_of_month('user_logs.created_at') }} as day_of_month,\n        {% else -%} \n            format(cast(user_logs.created_at as date), 'ddd') as day_name,\n            day(user_logs.created_at) as day_of_month,\n        {% endif -%} \n        \n        user_logs.created_at as occurred_at,\n        destination.destination_name,\n        destination.destination_id,\n        connector.connector_name,\n        connector.connector_id,\n        user_logs.actor_email as email,\n{%- if var('fivetran_platform_using_user', true) %}\n        users.first_name,\n        users.last_name,\n        users.user_id,\n    {%- if var('fivetran_platform_using_destination_membership', true) %}\n        destination_membership.destination_role,\n    {% endif -%}\n{% endif -%}\n\n        user_logs.event_type, -- should always be INFO for user-triggered actions but include just in case\n        user_logs.event_subtype,\n        user_logs.message_data,\n        user_logs.log_id\n\n    from user_logs\n    left join connector\n        on user_logs.connector_id = connector.connector_id\n    left join destination\n        on connector.destination_id = destination.destination_id\n\n{%- if var('fivetran_platform_using_user', true) %}\n    left join users \n        on lower(users.email) = lower(user_logs.actor_email)\n\n    {%- if var('fivetran_platform_using_destination_membership', true) %}\n    left join destination_membership\n        on destination.destination_id = destination_membership.destination_id\n        and users.user_id = destination_membership.user_id\n\n    {% endif -%}\n{% endif -%}\n\n)\n\nselect *\nfrom final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "stg_fivetran_platform__connector", "package": null, "version": null}, {"name": "stg_fivetran_platform__destination", "package": null, "version": null}, {"name": "stg_fivetran_platform__user", "package": null, "version": null}, {"name": "stg_fivetran_platform__destination_membership", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_utils.json_parse", "macro.dbt.date_trunc", "macro.dbt_date.day_name", "macro.dbt_date.day_of_month"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination", "model.fivetran_log.stg_fivetran_platform__user", "model.fivetran_log.stg_fivetran_platform__destination_membership"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__audit_user_activity.sql", "compiled": true, "compiled_code": "with logs as (\n\n    select \n        *,\n        \n\n \n  json_extract_scalar(message_data, '$.actor')\n\n as actor_email\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log`\n),\n\nuser_logs as (\n\n    select *\n    from logs\n    where actor_email is not null \n        and lower(actor_email) != 'fivetran'\n),\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__connector`\n),\n\ndestination as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__destination`\n),\nusers as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__user`\n),\n    destination_membership as (\n\n        select *\n        from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__destination_membership`\n    ),\n    final as (\n\n    select\n        timestamp_trunc(\n        cast(user_logs.created_at as timestamp),\n        day\n    ) as date_day,\n        \n        format_date('%a', cast(user_logs.created_at as date)) as day_name,\n            extract(day from user_logs.created_at) as day_of_month,\n        user_logs.created_at as occurred_at,\n        destination.destination_name,\n        destination.destination_id,\n        connector.connector_name,\n        connector.connector_id,\n        user_logs.actor_email as email,\n        users.first_name,\n        users.last_name,\n        users.user_id,\n        destination_membership.destination_role,\n    user_logs.event_type, -- should always be INFO for user-triggered actions but include just in case\n        user_logs.event_subtype,\n        user_logs.message_data,\n        user_logs.log_id\n\n    from user_logs\n    left join connector\n        on user_logs.connector_id = connector.connector_id\n    left join destination\n        on connector.destination_id = destination.destination_id\n    left join users \n        on lower(users.email) = lower(user_logs.actor_email)\n    left join destination_membership\n        on destination.destination_id = destination_membership.destination_id\n        and users.user_id = destination_membership.user_id\n\n    )\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__connector_status": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "fivetran_platform__connector_status", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__connector_status.sql", "original_file_path": "models/fivetran_platform__connector_status.sql", "unique_id": "model.fivetran_log.fivetran_platform__connector_status", "fqn": ["fivetran_log", "fivetran_platform__connector_status"], "alias": "fivetran_platform__connector_status", "checksum": {"name": "sha256", "checksum": "a52614c2945607d8d9e1bd4591df4e251a68d9c45c95e8afaee68af1616a1efb"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of each destination's connector and details surrounding its  connection and data-sync status.\n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination loading data from this connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_health": {"name": "connector_health", "description": "Status of the connector's data flow. Can be `\"broken\"`, `\"incomplete\"`, `\"connected\"`, `\"paused\"`, `\"initial sync in progress\"`, or `\"priority first sync\"`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_successful_sync_completed_at": {"name": "last_successful_sync_completed_at", "description": "Timestamp of when the last sync attempt was completed. This could be either a failure or a successful sync.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_sync_started_at": {"name": "last_sync_started_at", "description": "Timestamp of when the last sync was started. Note that if new data comes in after a sync has  begun, the new data will not be included in this sync.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_sync_completed_at": {"name": "last_sync_completed_at", "description": "Timestamp of when the last sync was completed.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "set_up_at": {"name": "set_up_at", "description": "Timestamp of when the connector was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "number_of_schema_changes_last_month": {"name": "number_of_schema_changes_last_month", "description": "The number of schema changes (creating tables or schemas and altering tables) in the past 30 days.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "errors_since_last_completed_sync": {"name": "errors_since_last_completed_sync", "description": "Aggregated line-separated list of error messages (in JSON format) raised synce the last  sync completion. Included by default for non-SQL Server targets, but can be disabled by setting the `fivetran_platform_using_sync_alert_messages` var to False.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "warnings_since_last_completed_sync": {"name": "warnings_since_last_completed_sync", "description": "Aggregated line-separated list of warning messages (in JSON format) raised synce the last  sync completion. Included by default for non-SQL Server targets, but can be disabled by setting the `fivetran_platform_using_sync_alert_messages` var to False.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702500739.433045, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__connector_status`", "raw_code": "with transformation_removal as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__log') }}\n    where transformation_id is null\n\n),\n\nconnector_log as (\n    select \n        *,\n        sum( case when event_subtype in ('sync_start') then 1 else 0 end) over ( partition by connector_id \n            order by created_at rows unbounded preceding) as sync_batch_id\n    from transformation_removal\n    -- only looking at errors, warnings, and syncs here\n    where event_type = 'SEVERE'\n        or event_type = 'WARNING'\n        or event_subtype like 'sync%'\n        or (event_subtype = 'status' \n            and {{ fivetran_utils.json_parse(string=\"message_data\", string_path=[\"status\"]) }} = 'RESCHEDULED'\n            \n            and {{ fivetran_utils.json_parse(string=\"message_data\", string_path=[\"reason\"]) }} like '%intended behavior%'\n            ) -- for priority-first syncs. these should be captured by event_type = 'WARNING' but let's make sure\n        or (event_subtype = 'status' \n            and {{ fivetran_utils.json_parse(string=\"message_data\", string_path=[\"status\"]) }} = 'SUCCESSFUL'\n        )\n        -- whole reason is \"We have rescheduled the connector to force flush data from the forward sync into your destination. This is intended behavior and means that the connector is working as expected.\"\n),\n\nschema_changes as (\n\n    select\n        connector_id,\n        count(*) as number_of_schema_changes_last_month\n\n    from {{ ref('stg_fivetran_platform__log') }}\n\n    where \n        {{ dbt.datediff('created_at', dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp(), 'day') }} <= 30\n        and event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n\n    group by connector_id\n\n),\n\nconnector as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__connector') }}\n\n),\n\ndestination as (\n\n    select * \n    from {{ ref('stg_fivetran_platform__destination') }}\n),\n\nconnector_metrics as (\n\n    select\n        connector.connector_id,\n        connector.connector_name,\n        connector.connector_type,\n        connector.destination_id,\n        connector.is_paused,\n        connector.set_up_at,\n        max(case when connector_log.event_subtype = 'sync_start' then connector_log.created_at else null end) as last_sync_started_at,\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.created_at else null end) as last_sync_completed_at,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"status\"]) }} ='SUCCESSFUL'\n            then connector_log.created_at else null end) as last_successful_sync_completed_at,\n\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.sync_batch_id else null end) as last_sync_batch_id,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"status\"]) }} ='RESCHEDULED'\n                and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"reason\"]) }} like '%intended behavior%'\n            then connector_log.created_at else null end) as last_priority_first_sync_completed_at,\n                \n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.created_at else null end) as last_error_at,\n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.sync_batch_id else null end) as last_error_batch,\n        max(case when event_type = 'WARNING' then connector_log.created_at else null end) as last_warning_at\n\n    from connector \n    left join connector_log \n        on connector_log.connector_id = connector.connector_id\n    group by connector.connector_id, connector.connector_name, connector.connector_type, connector.destination_id, connector.is_paused, connector.set_up_at\n),\n\nconnector_health_status as (\n\n    select\n        *,\n        case \n            -- connector is paused\n            when is_paused {{ ' = 1' if target.type == 'sqlserver' }} then 'paused'\n\n            -- a sync has never been attempted\n            when last_sync_started_at is null then 'incomplete'\n\n            -- a priority-first sync has occurred, but a normal sync has not\n            when last_priority_first_sync_completed_at is not null and last_sync_completed_at is null then 'priority first sync'\n\n            -- a priority sync has occurred more recently than a normal one (may occurr if the connector has been paused and resumed)\n            when last_priority_first_sync_completed_at > last_sync_completed_at then 'priority first sync'\n\n            -- a sync has been attempted, but not completed, and it's not due to errors. also a priority-first sync hasn't\n            when last_sync_completed_at is null and last_error_at is null then 'initial sync in progress'\n\n            -- the last attempted sync had an error\n            when last_sync_batch_id = last_error_batch then 'broken'\n\n            -- there's never been a successful sync and there have been errors\n            when last_sync_completed_at is null and last_error_at is not null then 'broken'\n\n        else 'connected' end as connector_health\n\n    from connector_metrics\n),\n\n-- Joining with log to grab pertinent error/warning messagees\nconnector_recent_logs as (\n\n    select \n        connector_health_status.connector_id,\n        connector_health_status.connector_name,\n        connector_health_status.connector_type,\n        connector_health_status.destination_id,\n        connector_health_status.connector_health,\n        connector_health_status.last_successful_sync_completed_at,\n        connector_health_status.last_sync_started_at,\n        connector_health_status.last_sync_completed_at,\n        connector_health_status.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n    from connector_health_status \n    left join connector_log \n        on connector_log.connector_id = connector_health_status.connector_id\n        -- limiting relevance to since the last successful sync completion (if there has been one)\n        and connector_log.created_at > coalesce(connector_health_status.last_sync_completed_at, connector_health_status.last_priority_first_sync_completed_at, '2000-01-01') \n        -- only looking at errors and warnings (excluding syncs - both normal and priority first)\n        and connector_log.event_type != 'INFO' \n        -- need to explicitly avoid priority first statuses because they are of event_type WARNING\n        and not (connector_log.event_subtype = 'status' \n            and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"status\"]) }} ='RESCHEDULED'\n            and {{ fivetran_utils.json_parse(string=\"connector_log.message_data\", string_path=[\"reason\"]) }} like '%intended behavior%')\n\n    group by -- remove duplicates, need explicit group by for SQL Server\n        connector_health_status.connector_id,\n        connector_health_status.connector_name,\n        connector_health_status.connector_type,\n        connector_health_status.destination_id,\n        connector_health_status.connector_health,\n        connector_health_status.last_successful_sync_completed_at,\n        connector_health_status.last_sync_started_at,\n        connector_health_status.last_sync_completed_at,\n        connector_health_status.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n),\n\nfinal as (\n\n    select\n        connector_recent_logs.connector_id,\n        connector_recent_logs.connector_name,\n        connector_recent_logs.connector_type,\n        connector_recent_logs.destination_id,\n        destination.destination_name,\n        connector_recent_logs.connector_health,\n        connector_recent_logs.last_successful_sync_completed_at,\n        connector_recent_logs.last_sync_started_at,\n        connector_recent_logs.last_sync_completed_at,\n        connector_recent_logs.set_up_at,\n        coalesce(schema_changes.number_of_schema_changes_last_month, 0) as number_of_schema_changes_last_month\n        \n        {% if var('fivetran_platform_using_sync_alert_messages', true) and target.type != 'sqlserver' %}\n        , {{ fivetran_utils.string_agg(\"distinct case when connector_recent_logs.event_type = 'SEVERE' then connector_recent_logs.message_data else null end\", \"'\\\\n'\") }} as errors_since_last_completed_sync\n        , {{ fivetran_utils.string_agg(\"distinct case when connector_recent_logs.event_type = 'WARNING' then connector_recent_logs.message_data else null end\", \"'\\\\n'\") }} as warnings_since_last_completed_sync\n        {% endif %}\n\n    from connector_recent_logs\n    left join schema_changes \n        on connector_recent_logs.connector_id = schema_changes.connector_id \n\n    join destination on destination.destination_id = connector_recent_logs.destination_id\n\n    -- need explicit group bys for SQL Server\n    group by \n        connector_recent_logs.connector_id, \n        connector_recent_logs.connector_name, \n        connector_recent_logs.connector_type, \n        connector_recent_logs.destination_id, \n        destination.destination_name, \n        connector_recent_logs.connector_health, \n        connector_recent_logs.last_successful_sync_completed_at, \n        connector_recent_logs.last_sync_started_at, \n        connector_recent_logs.last_sync_completed_at, \n        connector_recent_logs.set_up_at, \n        number_of_schema_changes_last_month\n)\n\nselect * from final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "stg_fivetran_platform__connector", "package": null, "version": null}, {"name": "stg_fivetran_platform__destination", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_utils.json_parse", "macro.dbt.current_timestamp_backcompat", "macro.dbt.datediff", "macro.fivetran_utils.string_agg"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__connector_status.sql", "compiled": true, "compiled_code": "with transformation_removal as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log`\n    where transformation_id is null\n\n),\n\nconnector_log as (\n    select \n        *,\n        sum( case when event_subtype in ('sync_start') then 1 else 0 end) over ( partition by connector_id \n            order by created_at rows unbounded preceding) as sync_batch_id\n    from transformation_removal\n    -- only looking at errors, warnings, and syncs here\n    where event_type = 'SEVERE'\n        or event_type = 'WARNING'\n        or event_subtype like 'sync%'\n        or (event_subtype = 'status' \n            and \n\n \n  json_extract_scalar(message_data, '$.status')\n\n = 'RESCHEDULED'\n            \n            and \n\n \n  json_extract_scalar(message_data, '$.reason')\n\n like '%intended behavior%'\n            ) -- for priority-first syncs. these should be captured by event_type = 'WARNING' but let's make sure\n        or (event_subtype = 'status' \n            and \n\n \n  json_extract_scalar(message_data, '$.status')\n\n = 'SUCCESSFUL'\n        )\n        -- whole reason is \"We have rescheduled the connector to force flush data from the forward sync into your destination. This is intended behavior and means that the connector is working as expected.\"\n),\n\nschema_changes as (\n\n    select\n        connector_id,\n        count(*) as number_of_schema_changes_last_month\n\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log`\n\n    where \n        \n\n    datetime_diff(\n        cast(current_timestamp as datetime),\n        cast(created_at as datetime),\n        day\n    )\n\n   <= 30\n        and event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n\n    group by connector_id\n\n),\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__connector`\n\n),\n\ndestination as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__destination`\n),\n\nconnector_metrics as (\n\n    select\n        connector.connector_id,\n        connector.connector_name,\n        connector.connector_type,\n        connector.destination_id,\n        connector.is_paused,\n        connector.set_up_at,\n        max(case when connector_log.event_subtype = 'sync_start' then connector_log.created_at else null end) as last_sync_started_at,\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.created_at else null end) as last_sync_completed_at,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and \n\n \n  json_extract_scalar(connector_log.message_data, '$.status')\n\n ='SUCCESSFUL'\n            then connector_log.created_at else null end) as last_successful_sync_completed_at,\n\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.sync_batch_id else null end) as last_sync_batch_id,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and \n\n \n  json_extract_scalar(connector_log.message_data, '$.status')\n\n ='RESCHEDULED'\n                and \n\n \n  json_extract_scalar(connector_log.message_data, '$.reason')\n\n like '%intended behavior%'\n            then connector_log.created_at else null end) as last_priority_first_sync_completed_at,\n                \n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.created_at else null end) as last_error_at,\n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.sync_batch_id else null end) as last_error_batch,\n        max(case when event_type = 'WARNING' then connector_log.created_at else null end) as last_warning_at\n\n    from connector \n    left join connector_log \n        on connector_log.connector_id = connector.connector_id\n    group by connector.connector_id, connector.connector_name, connector.connector_type, connector.destination_id, connector.is_paused, connector.set_up_at\n),\n\nconnector_health_status as (\n\n    select\n        *,\n        case \n            -- connector is paused\n            when is_paused  then 'paused'\n\n            -- a sync has never been attempted\n            when last_sync_started_at is null then 'incomplete'\n\n            -- a priority-first sync has occurred, but a normal sync has not\n            when last_priority_first_sync_completed_at is not null and last_sync_completed_at is null then 'priority first sync'\n\n            -- a priority sync has occurred more recently than a normal one (may occurr if the connector has been paused and resumed)\n            when last_priority_first_sync_completed_at > last_sync_completed_at then 'priority first sync'\n\n            -- a sync has been attempted, but not completed, and it's not due to errors. also a priority-first sync hasn't\n            when last_sync_completed_at is null and last_error_at is null then 'initial sync in progress'\n\n            -- the last attempted sync had an error\n            when last_sync_batch_id = last_error_batch then 'broken'\n\n            -- there's never been a successful sync and there have been errors\n            when last_sync_completed_at is null and last_error_at is not null then 'broken'\n\n        else 'connected' end as connector_health\n\n    from connector_metrics\n),\n\n-- Joining with log to grab pertinent error/warning messagees\nconnector_recent_logs as (\n\n    select \n        connector_health_status.connector_id,\n        connector_health_status.connector_name,\n        connector_health_status.connector_type,\n        connector_health_status.destination_id,\n        connector_health_status.connector_health,\n        connector_health_status.last_successful_sync_completed_at,\n        connector_health_status.last_sync_started_at,\n        connector_health_status.last_sync_completed_at,\n        connector_health_status.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n    from connector_health_status \n    left join connector_log \n        on connector_log.connector_id = connector_health_status.connector_id\n        -- limiting relevance to since the last successful sync completion (if there has been one)\n        and connector_log.created_at > coalesce(connector_health_status.last_sync_completed_at, connector_health_status.last_priority_first_sync_completed_at, '2000-01-01') \n        -- only looking at errors and warnings (excluding syncs - both normal and priority first)\n        and connector_log.event_type != 'INFO' \n        -- need to explicitly avoid priority first statuses because they are of event_type WARNING\n        and not (connector_log.event_subtype = 'status' \n            and \n\n \n  json_extract_scalar(connector_log.message_data, '$.status')\n\n ='RESCHEDULED'\n            and \n\n \n  json_extract_scalar(connector_log.message_data, '$.reason')\n\n like '%intended behavior%')\n\n    group by -- remove duplicates, need explicit group by for SQL Server\n        connector_health_status.connector_id,\n        connector_health_status.connector_name,\n        connector_health_status.connector_type,\n        connector_health_status.destination_id,\n        connector_health_status.connector_health,\n        connector_health_status.last_successful_sync_completed_at,\n        connector_health_status.last_sync_started_at,\n        connector_health_status.last_sync_completed_at,\n        connector_health_status.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n),\n\nfinal as (\n\n    select\n        connector_recent_logs.connector_id,\n        connector_recent_logs.connector_name,\n        connector_recent_logs.connector_type,\n        connector_recent_logs.destination_id,\n        destination.destination_name,\n        connector_recent_logs.connector_health,\n        connector_recent_logs.last_successful_sync_completed_at,\n        connector_recent_logs.last_sync_started_at,\n        connector_recent_logs.last_sync_completed_at,\n        connector_recent_logs.set_up_at,\n        coalesce(schema_changes.number_of_schema_changes_last_month, 0) as number_of_schema_changes_last_month\n        \n        \n        , \n    string_agg(distinct case when connector_recent_logs.event_type = 'SEVERE' then connector_recent_logs.message_data else null end, '\\n')\n\n as errors_since_last_completed_sync\n        , \n    string_agg(distinct case when connector_recent_logs.event_type = 'WARNING' then connector_recent_logs.message_data else null end, '\\n')\n\n as warnings_since_last_completed_sync\n        \n\n    from connector_recent_logs\n    left join schema_changes \n        on connector_recent_logs.connector_id = schema_changes.connector_id \n\n    join destination on destination.destination_id = connector_recent_logs.destination_id\n\n    -- need explicit group bys for SQL Server\n    group by \n        connector_recent_logs.connector_id, \n        connector_recent_logs.connector_name, \n        connector_recent_logs.connector_type, \n        connector_recent_logs.destination_id, \n        destination.destination_name, \n        connector_recent_logs.connector_health, \n        connector_recent_logs.last_successful_sync_completed_at, \n        connector_recent_logs.last_sync_started_at, \n        connector_recent_logs.last_sync_completed_at, \n        connector_recent_logs.set_up_at, \n        number_of_schema_changes_last_month\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__usage_mar_destination_history": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "fivetran_platform__usage_mar_destination_history", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__usage_mar_destination_history.sql", "original_file_path": "models/fivetran_platform__usage_mar_destination_history.sql", "unique_id": "model.fivetran_log.fivetran_platform__usage_mar_destination_history", "fqn": ["fivetran_log", "fivetran_platform__usage_mar_destination_history"], "alias": "fivetran_platform__usage_mar_destination_history", "checksum": {"name": "sha256", "checksum": "6872d7ca6c5bc46d66e9673ccf56ca0f2c38fb8d69b38085872cdac5eb9ef961"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of each destination's usage and active volume, per month. Includes the  usage per million MAR and MAR per usage. Usage either refers to a dollar or credit amount, depending on customer's pricing model. Read more about the relationship between usage and MAR [here](https://www.fivetran.com/legal/service-consumption-table).\n", "columns": {"measured_month": {"name": "measured_month", "description": "The month (yyyy-mm-01) of the usage/MAR measurement.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse housing the active rows.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination as it appears in the UI.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "free_monthly_active_rows": {"name": "free_monthly_active_rows", "description": "The number of free active rows measured in the destination for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_monthly_active_rows": {"name": "paid_monthly_active_rows", "description": "The number of paid active rows measured in the destination for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_monthly_active_rows": {"name": "total_monthly_active_rows", "description": "The total number of active rows measured in the destination for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "credits_spent_per_million_mar": {"name": "credits_spent_per_million_mar", "description": "The ratio of credits spent that month per every million active rows synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mar_per_credit_spent": {"name": "mar_per_credit_spent", "description": "The ratio of the month's active volume to credits spent.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "amount_spent_per_million_mar": {"name": "amount_spent_per_million_mar", "description": "The ratio of amount spent that month per every million active rows synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mar_per_amount_spent": {"name": "mar_per_amount_spent", "description": "The ratio of the month's active volume to amount spent.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "credits_spent": {"name": "credits_spent", "description": "The number of credits used by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dollars_spent": {"name": "dollars_spent", "description": "The dollar amount used by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702500739.436609, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__usage_mar_destination_history`", "raw_code": "with table_mar as (\n    \n    select *\n    from {{ ref('fivetran_platform__mar_table_history') }}\n),\n\ncredits_used as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__credits_used') }}\n),\n\nuseage_cost as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__usage_cost') }}\n),\n\ndestination_mar as (\n\n    select \n        cast(measured_month as date) as measured_month,\n        destination_id,\n        destination_name,\n        sum(free_monthly_active_rows) as free_monthly_active_rows,\n        sum(paid_monthly_active_rows) as paid_monthly_active_rows,\n        sum(total_monthly_active_rows) as total_monthly_active_rows\n    from table_mar\n    group by measured_month, destination_id, destination_name\n),\n\nusage as (\n\n    select \n        coalesce(credits_used.destination_id, useage_cost.destination_id) as destination_id,\n        credits_used.credits_spent,\n        useage_cost.dollars_spent,\n        cast(concat(coalesce(credits_used.measured_month,useage_cost.measured_month), '-01') as date) as measured_month -- match date format to join with MAR table\n    from credits_used\n    full outer join useage_cost\n        on useage_cost.measured_month = credits_used.measured_month\n        and useage_cost.destination_id = credits_used.destination_id\n),\n\njoin_usage_mar as (\n\n    select \n        destination_mar.measured_month,\n        destination_mar.destination_id,\n        destination_mar.destination_name,\n        usage.credits_spent,\n        usage.dollars_spent,\n        destination_mar.free_monthly_active_rows,\n        destination_mar.paid_monthly_active_rows,\n        destination_mar.total_monthly_active_rows,\n\n        -- credit and usage mar calculations\n        round( cast(nullif(usage.credits_spent,0) * 1000000.0 as {{ dbt.type_numeric() }}) / cast(nullif(destination_mar.total_monthly_active_rows,0) as {{ dbt.type_numeric() }}), 2) as credits_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as {{ dbt.type_numeric() }}) / cast(nullif(usage.credits_spent,0) as {{ dbt.type_numeric() }}), 0) as mar_per_credit_spent,\n        round( cast(nullif(usage.dollars_spent,0) * 1000000.0 as {{ dbt.type_numeric() }}) / cast(nullif(destination_mar.total_monthly_active_rows,0) as {{ dbt.type_numeric() }}), 2) as amount_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as {{ dbt.type_numeric() }}) / cast(nullif(usage.dollars_spent,0) as {{ dbt.type_numeric() }}), 0) as mar_per_amount_spent\n    from destination_mar \n    left join usage \n        on destination_mar.measured_month = cast(usage.measured_month as date)\n        and destination_mar.destination_id = usage.destination_id\n)\n\nselect * \nfrom join_usage_mar", "language": "sql", "refs": [{"name": "fivetran_platform__mar_table_history", "package": null, "version": null}, {"name": "stg_fivetran_platform__credits_used", "package": null, "version": null}, {"name": "stg_fivetran_platform__usage_cost", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_numeric"], "nodes": ["model.fivetran_log.fivetran_platform__mar_table_history", "model.fivetran_log.stg_fivetran_platform__credits_used", "model.fivetran_log.stg_fivetran_platform__usage_cost"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__usage_mar_destination_history.sql", "compiled": true, "compiled_code": "with table_mar as (\n    \n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__mar_table_history`\n),\n\ncredits_used as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__credits_used`\n),\n\nuseage_cost as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__usage_cost`\n),\n\ndestination_mar as (\n\n    select \n        cast(measured_month as date) as measured_month,\n        destination_id,\n        destination_name,\n        sum(free_monthly_active_rows) as free_monthly_active_rows,\n        sum(paid_monthly_active_rows) as paid_monthly_active_rows,\n        sum(total_monthly_active_rows) as total_monthly_active_rows\n    from table_mar\n    group by measured_month, destination_id, destination_name\n),\n\nusage as (\n\n    select \n        coalesce(credits_used.destination_id, useage_cost.destination_id) as destination_id,\n        credits_used.credits_spent,\n        useage_cost.dollars_spent,\n        cast(concat(coalesce(credits_used.measured_month,useage_cost.measured_month), '-01') as date) as measured_month -- match date format to join with MAR table\n    from credits_used\n    full outer join useage_cost\n        on useage_cost.measured_month = credits_used.measured_month\n        and useage_cost.destination_id = credits_used.destination_id\n),\n\njoin_usage_mar as (\n\n    select \n        destination_mar.measured_month,\n        destination_mar.destination_id,\n        destination_mar.destination_name,\n        usage.credits_spent,\n        usage.dollars_spent,\n        destination_mar.free_monthly_active_rows,\n        destination_mar.paid_monthly_active_rows,\n        destination_mar.total_monthly_active_rows,\n\n        -- credit and usage mar calculations\n        round( cast(nullif(usage.credits_spent,0) * 1000000.0 as numeric) / cast(nullif(destination_mar.total_monthly_active_rows,0) as numeric), 2) as credits_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as numeric) / cast(nullif(usage.credits_spent,0) as numeric), 0) as mar_per_credit_spent,\n        round( cast(nullif(usage.dollars_spent,0) * 1000000.0 as numeric) / cast(nullif(destination_mar.total_monthly_active_rows,0) as numeric), 2) as amount_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as numeric) / cast(nullif(usage.dollars_spent,0) as numeric), 0) as mar_per_amount_spent\n    from destination_mar \n    left join usage \n        on destination_mar.measured_month = cast(usage.measured_month as date)\n        and destination_mar.destination_id = usage.destination_id\n)\n\nselect * \nfrom join_usage_mar", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__audit_table": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "fivetran_platform__audit_table", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__audit_table.sql", "original_file_path": "models/fivetran_platform__audit_table.sql", "unique_id": "model.fivetran_log.fivetran_platform__audit_table", "fqn": ["fivetran_log", "fivetran_platform__audit_table"], "alias": "fivetran_platform__audit_table", "checksum": {"name": "sha256", "checksum": "953d41b74b6ebb8b499f54a40c920bf217ad82c097f420c156a4257d813440f6"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "incremental", "incremental_strategy": "insert_overwrite", "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": "unique_table_sync_key", "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "partition_by": {"field": "sync_start", "data_type": "timestamp", "granularity": "day"}, "file_format": "parquet"}, "tags": [], "description": "Table replacing the deprecated `fivetran_audit` table. For each table written to in a sync, captures timestamps and row quantities around table syncs. Each record represents a table being written to in a connector sync. Note: the quantities here will not match the deprecated `fivetran_audit` table completely, as `fivetran_audit` reported on pre-duplicated data loads.\n", "columns": {"unique_table_sync_key": {"name": "unique_table_sync_key", "description": "Primary key of this table, hashed on `schema_name`, `connector_id`, `destination_id`, `table_name`, and `unique_table_sync_key`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Name of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "Name of the schema. In cases when the schema is not provided the connector_name is used.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Name of the table being written to.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination that the table is being written to.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "write_to_table_start": {"name": "write_to_table_start", "description": "Timestamp of when Fivetran began to write to this table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "write_to_table_end": {"name": "write_to_table_end", "description": "Timestamp of when Fivetran finished writing to this table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_start": {"name": "sync_start", "description": "Timestamp of when this connector-level sync began.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_end": {"name": "sync_end", "description": "Timestamp of when this connector-level sync finished, if successful.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sum_rows_replaced_or_inserted": {"name": "sum_rows_replaced_or_inserted", "description": "Sum of the rows replaced or inserted into this table during a sync.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sum_rows_updated": {"name": "sum_rows_updated", "description": "Sum of the rows updated in this table during a sync.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sum_rows_deleted": {"name": "sum_rows_deleted", "description": "Sum of the rows deleted from this table during a sync.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_start_day": {"name": "sync_start_day", "description": "The `sync_start` field truncated to the `day`. This field is used for partitioning in Databricks while using the `insert_overwrite` incremental method.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "incremental", "schema": "fivetran_platform", "unique_key": "unique_table_sync_key", "partition_by": {"field": "sync_start", "data_type": "timestamp", "granularity": "day"}, "incremental_strategy": "insert_overwrite", "file_format": "parquet"}, "created_at": 1702500739.439706, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__audit_table`", "raw_code": "{{ config(\n    materialized='incremental',\n    unique_key='unique_table_sync_key',\n    partition_by={\n        'field': 'sync_start',\n        'data_type': 'timestamp',\n        'granularity': 'day'\n    } if target.type == 'bigquery' else ['sync_start_day'],\n    incremental_strategy='insert_overwrite' if target.type in ('bigquery', 'spark', 'databricks') else 'delete+insert',\n    file_format='parquet'\n) }}\n\nwith sync_log as (\n    \n    select \n        *,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['table']) }} as table_name\n    from {{ ref('stg_fivetran_platform__log') }}\n    where event_subtype in ('sync_start', 'sync_end', 'write_to_table_start', 'write_to_table_end', 'records_modified')\n\n    {% if is_incremental() %}\n\n    -- Capture the latest timestamp in a call statement instead of a subquery for optimizing BQ costs on incremental runs\n    {%- call statement('max_sync_start', fetch_result=True) -%}\n        select cast(max(sync_start) as date) from {{ this }}\n    {%- endcall -%}\n\n    -- load the result from the above query into a new variable\n    {%- set query_result = load_result('max_sync_start') -%}\n\n    -- the query_result is stored as a dataframe. Therefore, we want to now store it as a singular value.\n    {%- set max_sync_start = query_result['data'][0][0] -%}\n\n    -- compare the new batch of data to the latest sync already stored in this model\n    and cast(created_at as date) > '{{ max_sync_start }}'\n\n    {% endif %}\n),\n\n\nconnector as (\n\n    select *\n    from {{ ref('fivetran_platform__connector_status') }}\n),\n\nadd_connector_info as (\n\n    select \n        sync_log.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n    from sync_log \n    left join connector\n        on connector.connector_id = sync_log.connector_id\n),\n\nsync_timestamps as (\n\n    select\n        connector_id,\n        connector_name,\n        table_name,\n        event_subtype,\n        destination_id,\n        destination_name,\n        created_at as write_to_table_start,\n        min(case when event_subtype = 'write_to_table_end' then created_at else null end) \n            over (partition by connector_id, table_name order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as write_to_table_end,\n\n        max(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between UNBOUNDED PRECEDING and CURRENT ROW) as sync_start,\n\n        min(case when event_subtype = 'sync_end' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as sync_end, -- coalesce with next_sync_start\n\n        min(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as next_sync_start\n    from add_connector_info\n),\n\n-- this will be the base for every record in the final CTE\nlimit_to_table_starts as (\n\n    select *\n    from sync_timestamps \n    where event_subtype = 'write_to_table_start'\n),\n\nrecords_modified_log as (\n\n    select \n        connector_id,\n        created_at,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['table']) }} as table_name,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['schema']) }} as schema_name,\n        {{ fivetran_utils.json_parse(string='message_data', string_path=['operationType']) }} as operation_type,\n        cast ({{ fivetran_utils.json_parse(string='message_data', string_path=['count']) }} as {{ dbt.type_int() }}) as row_count\n    from sync_log \n    where event_subtype = 'records_modified'\n\n),\n\nsum_records_modified as (\n\n    select\n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name) as schema_name,\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end as sync_end,\n        sum(case when records_modified_log.operation_type = 'REPLACED_OR_INSERTED' then records_modified_log.row_count else 0 end) as sum_rows_replaced_or_inserted,\n        sum(case when records_modified_log.operation_type = 'UPDATED' then records_modified_log.row_count else 0 end) as sum_rows_updated,\n        sum(case when records_modified_log.operation_type = 'DELETED' then records_modified_log.row_count else 0 end) as sum_rows_deleted\n    from limit_to_table_starts\n    left join records_modified_log on \n        limit_to_table_starts.connector_id = records_modified_log.connector_id\n        and limit_to_table_starts.table_name = records_modified_log.table_name\n\n        -- confine it to one sync\n        and records_modified_log.created_at > limit_to_table_starts.sync_start \n        and records_modified_log.created_at < coalesce(limit_to_table_starts.sync_end, limit_to_table_starts.next_sync_start) \n\n    -- explicit group by needed for SQL Server\n    group by \n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name),\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end\n),\n\nfinal as (\n\n    select \n        *,\n        {{ dbt_utils.generate_surrogate_key(['schema_name','connector_id', 'destination_id', 'table_name', 'write_to_table_start']) }} as unique_table_sync_key, -- for incremental materialization \n        {{ dbt.date_trunc('day', 'sync_start') }} as sync_start_day -- for partitioning in databricks\n    from sum_records_modified\n)\n\nselect *\nfrom final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}, {"name": "fivetran_platform__connector_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_utils.json_parse", "macro.dbt.is_incremental", "macro.dbt.type_int", "macro.dbt_utils.generate_surrogate_key", "macro.dbt.date_trunc", "macro.dbt.statement"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.fivetran_platform__connector_status"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__audit_table.sql", "compiled": true, "compiled_code": "\n\nwith sync_log as (\n    \n    select \n        *,\n        \n\n \n  json_extract_scalar(message_data, '$.table')\n\n as table_name\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log`\n    where event_subtype in ('sync_start', 'sync_end', 'write_to_table_start', 'write_to_table_end', 'records_modified')\n\n    \n\n    -- Capture the latest timestamp in a call statement instead of a subquery for optimizing BQ costs on incremental runs-- load the result from the above query into a new variable-- the query_result is stored as a dataframe. Therefore, we want to now store it as a singular value.-- compare the new batch of data to the latest sync already stored in this model\n    and cast(created_at as date) > '2021-12-10'\n\n    \n),\n\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__connector_status`\n),\n\nadd_connector_info as (\n\n    select \n        sync_log.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n    from sync_log \n    left join connector\n        on connector.connector_id = sync_log.connector_id\n),\n\nsync_timestamps as (\n\n    select\n        connector_id,\n        connector_name,\n        table_name,\n        event_subtype,\n        destination_id,\n        destination_name,\n        created_at as write_to_table_start,\n        min(case when event_subtype = 'write_to_table_end' then created_at else null end) \n            over (partition by connector_id, table_name order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as write_to_table_end,\n\n        max(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between UNBOUNDED PRECEDING and CURRENT ROW) as sync_start,\n\n        min(case when event_subtype = 'sync_end' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as sync_end, -- coalesce with next_sync_start\n\n        min(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as next_sync_start\n    from add_connector_info\n),\n\n-- this will be the base for every record in the final CTE\nlimit_to_table_starts as (\n\n    select *\n    from sync_timestamps \n    where event_subtype = 'write_to_table_start'\n),\n\nrecords_modified_log as (\n\n    select \n        connector_id,\n        created_at,\n        \n\n \n  json_extract_scalar(message_data, '$.table')\n\n as table_name,\n        \n\n \n  json_extract_scalar(message_data, '$.schema')\n\n as schema_name,\n        \n\n \n  json_extract_scalar(message_data, '$.operationType')\n\n as operation_type,\n        cast (\n\n \n  json_extract_scalar(message_data, '$.count')\n\n as INT64) as row_count\n    from sync_log \n    where event_subtype = 'records_modified'\n\n),\n\nsum_records_modified as (\n\n    select\n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name) as schema_name,\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end as sync_end,\n        sum(case when records_modified_log.operation_type = 'REPLACED_OR_INSERTED' then records_modified_log.row_count else 0 end) as sum_rows_replaced_or_inserted,\n        sum(case when records_modified_log.operation_type = 'UPDATED' then records_modified_log.row_count else 0 end) as sum_rows_updated,\n        sum(case when records_modified_log.operation_type = 'DELETED' then records_modified_log.row_count else 0 end) as sum_rows_deleted\n    from limit_to_table_starts\n    left join records_modified_log on \n        limit_to_table_starts.connector_id = records_modified_log.connector_id\n        and limit_to_table_starts.table_name = records_modified_log.table_name\n\n        -- confine it to one sync\n        and records_modified_log.created_at > limit_to_table_starts.sync_start \n        and records_modified_log.created_at < coalesce(limit_to_table_starts.sync_end, limit_to_table_starts.next_sync_start) \n\n    -- explicit group by needed for SQL Server\n    group by \n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name),\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end\n),\n\nfinal as (\n\n    select \n        *,\n        to_hex(md5(cast(coalesce(cast(schema_name as string), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(connector_id as string), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(destination_id as string), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(table_name as string), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(write_to_table_start as string), '_dbt_utils_surrogate_key_null_') as string))) as unique_table_sync_key, -- for incremental materialization \n        timestamp_trunc(\n        cast(sync_start as timestamp),\n        day\n    ) as sync_start_day -- for partitioning in databricks\n    from sum_records_modified\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.fivetran_platform__mar_table_history": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "fivetran_platform__mar_table_history", "resource_type": "model", "package_name": "fivetran_log", "path": "fivetran_platform__mar_table_history.sql", "original_file_path": "models/fivetran_platform__mar_table_history.sql", "unique_id": "model.fivetran_log.fivetran_platform__mar_table_history", "fqn": ["fivetran_log", "fivetran_platform__mar_table_history"], "alias": "fivetran_platform__mar_table_history", "checksum": {"name": "sha256", "checksum": "cdcc43a0c920b283bd3ab35c3cf5adc3320f0ca2ca839d7a2112482009eb6c50"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of each table's monthly active rows (MAR) for all connectors, destinations, and schemas, per month. Read more about how monthly active rows are defined and calculated  [here](https://fivetran.com/docs/getting-started/consumption-based-pricing).\n", "columns": {"connector_name": {"name": "connector_name", "description": "Name of the connector loading this table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "System-generated uniqu ID of the connector loading this table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "Name of the schema in which the table lives.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Name of the table whose MAR was measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm-01) of the measurement.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_measured_at": {"name": "last_measured_at", "description": "Timestamp of when the last MAR measurement for the month was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "free_monthly_active_rows": {"name": "free_monthly_active_rows", "description": "The number of free active rows measured in the table for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_monthly_active_rows": {"name": "paid_monthly_active_rows", "description": "The number of paid active rows measured in the table for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_monthly_active_rows": {"name": "total_monthly_active_rows", "description": "The total number of active rows measured in the table for the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination as it appears in the UI.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702500739.4352, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__mar_table_history`", "raw_code": "with incremental_mar as (\n\n    select\n        *,\n        {{ dbt.date_trunc('month', 'measured_date') }} as measured_month\n\n    from {{ ref('stg_fivetran_platform__incremental_mar') }}\n),\n\nconnector as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__connector') }}\n),\n\ndestination as (\n\n    select *\n    from {{ ref('stg_fivetran_platform__destination') }}\n),\n\nordered_mar as (\n\n    select\n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        max(measured_date) as last_measured_at,\n        sum(incremental_rows) as incremental_rows,\n        sum(coalesce(case when lower(free_type) = 'paid'\n            then incremental_rows\n        end, 0)) as paid_monthly_active_rows,\n        sum(coalesce(case when lower(free_type) != 'paid'\n            then incremental_rows\n        end, 0)) as free_monthly_active_rows\n\n    from incremental_mar\n    group by connector_name, schema_name, table_name, destination_id, measured_month\n),\n\nlatest_mar as (\n    select \n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        cast(last_measured_at as date) as last_measured_at,\n        free_monthly_active_rows,\n        paid_monthly_active_rows,\n        (free_monthly_active_rows + paid_monthly_active_rows) as total_monthly_active_rows\n\n    from ordered_mar\n),\n\nmar_join as (\n\n    select\n        latest_mar.*,\n        connector.connector_type,\n        connector.connector_id,\n        destination.destination_name\n\n    from latest_mar\n    join connector\n        on latest_mar.connector_name = connector.connector_name\n        and latest_mar.destination_id = connector.destination_id\n    join destination on latest_mar.destination_id = destination.destination_id\n)\n\nselect * from mar_join", "language": "sql", "refs": [{"name": "stg_fivetran_platform__incremental_mar", "package": null, "version": null}, {"name": "stg_fivetran_platform__connector", "package": null, "version": null}, {"name": "stg_fivetran_platform__destination", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.date_trunc"], "nodes": ["model.fivetran_log.stg_fivetran_platform__incremental_mar", "model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform__mar_table_history.sql", "compiled": true, "compiled_code": "with incremental_mar as (\n\n    select\n        *,\n        timestamp_trunc(\n        cast(measured_date as timestamp),\n        month\n    ) as measured_month\n\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__incremental_mar`\n),\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__connector`\n),\n\ndestination as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__destination`\n),\n\nordered_mar as (\n\n    select\n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        max(measured_date) as last_measured_at,\n        sum(incremental_rows) as incremental_rows,\n        sum(coalesce(case when lower(free_type) = 'paid'\n            then incremental_rows\n        end, 0)) as paid_monthly_active_rows,\n        sum(coalesce(case when lower(free_type) != 'paid'\n            then incremental_rows\n        end, 0)) as free_monthly_active_rows\n\n    from incremental_mar\n    group by connector_name, schema_name, table_name, destination_id, measured_month\n),\n\nlatest_mar as (\n    select \n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        cast(last_measured_at as date) as last_measured_at,\n        free_monthly_active_rows,\n        paid_monthly_active_rows,\n        (free_monthly_active_rows + paid_monthly_active_rows) as total_monthly_active_rows\n\n    from ordered_mar\n),\n\nmar_join as (\n\n    select\n        latest_mar.*,\n        connector.connector_type,\n        connector.connector_id,\n        destination.destination_name\n\n    from latest_mar\n    join connector\n        on latest_mar.connector_name = connector.connector_name\n        and latest_mar.destination_id = connector.destination_id\n    join destination on latest_mar.destination_id = destination.destination_id\n)\n\nselect * from mar_join", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__user": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__user", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__user.sql", "original_file_path": "models/staging/stg_fivetran_platform__user.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__user", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__user"], "alias": "stg_fivetran_platform__user", "checksum": {"name": "sha256", "checksum": "a061bd0449c3600b417d561bac0464e00be250488cdd3d266e3693aec4cee7b3"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of users given access to this Fivetran account.", "columns": {"user_id": {"name": "user_id", "description": "Unique ID of the user's account", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the user was created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "Email associated with the user.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "has_disabled_email_notifications": {"name": "has_disabled_email_notifications", "description": "Boolean of whether they have disabled all email notifications.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "User's last name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "User's first name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "phone": {"name": "phone", "description": "Phone number associated with user.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "is_verified": {"name": "is_verified", "description": "Boolean that indicates whether the user has verified their email address in the account creation process.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform", "enabled": true}, "created_at": 1702500739.6073668, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__user`", "raw_code": "{{ config(enabled=var('fivetran_platform_using_user', True)) }}\n\nwith base as (\n\n    select * \n    from {{ var('user') }}\n),\n\nfields as (\n\n    select\n        id as user_id,\n        cast(created_at as {{ dbt.type_timestamp() }}) as created_at,\n        email,\n        email_disabled as has_disabled_email_notifications,\n        family_name as last_name,\n        given_name as first_name,\n        phone,\n        verified as is_verified\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "user"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.user"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__user.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests`.`user`\n),\n\nfields as (\n\n    select\n        id as user_id,\n        cast(created_at as timestamp) as created_at,\n        email,\n        email_disabled as has_disabled_email_notifications,\n        family_name as last_name,\n        given_name as first_name,\n        phone,\n        verified as is_verified\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__destination_membership": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__destination_membership", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__destination_membership.sql", "original_file_path": "models/staging/stg_fivetran_platform__destination_membership.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__destination_membership", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__destination_membership"], "alias": "stg_fivetran_platform__destination_membership", "checksum": {"name": "sha256", "checksum": "da8ba27410a264f15f17cd9fd774299fb5fc88fa2f07f898ead71aed3f7f91e8"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of the users given access to this destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the ID of the `destination` that the user is  amember of.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "Foreign key referencing the ID of the `user` belonging to the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "activated_at": {"name": "activated_at", "description": "Timestamp of when the user was activated in the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "joined_at": {"name": "joined_at", "description": "Timestamp when the user was added to the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_role": {"name": "destination_role", "description": "The user's permissions for this individual destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform", "enabled": true}, "created_at": 1702500739.606615, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__destination_membership`", "raw_code": "{{ config(enabled=var('fivetran_platform_using_destination_membership', True)) }}\n\nwith base as (\n    \n    select * from {{ var('destination_membership') }}\n),\n\nfields as (\n\n    select\n        destination_id,\n        user_id,\n        cast(activated_at as {{ dbt.type_timestamp() }}) as activated_at,\n        cast(joined_at as {{ dbt.type_timestamp() }}) as joined_at,\n        role as destination_role\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "destination_membership"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.destination_membership"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__destination_membership.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n    \n    select * from `dbt-package-testing`.`fivetran_platform_integration_tests`.`destination_membership`\n),\n\nfields as (\n\n    select\n        destination_id,\n        user_id,\n        cast(activated_at as timestamp) as activated_at,\n        cast(joined_at as timestamp) as joined_at,\n        role as destination_role\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__credits_used": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__credits_used", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__credits_used.sql", "original_file_path": "models/staging/stg_fivetran_platform__credits_used.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__credits_used", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__credits_used"], "alias": "stg_fivetran_platform__credits_used", "checksum": {"name": "sha256", "checksum": "a3cbd320d43b57e49856ef3d120ba91addccaa9280d74645ff168c94af2cdc7d"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of the credits used by the customer per month for each destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that was used.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm) of the usage activity.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "credits_spent": {"name": "credits_spent", "description": "The total credits used by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702500739.60455, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__credits_used`", "raw_code": "{% if var('fivetran_platform__credits_pricing', does_table_exist('credits_used')) %}\n\nwith base as (\n\n    select * \n    from {{ var('credits_used') }}\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        credits_consumed as credits_spent\n    from base\n)\n\nselect * \nfrom fields\n\n{% else %}\n\nselect\n    cast(null as {{ dbt.type_string() }}) as destination_id,\n    cast(null as {{ dbt.type_string() }}) as measured_month,\n    cast(null as {{ dbt.type_int() }}) as credits_spent\n\n{% endif %}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_log.does_table_exist", "macro.dbt.type_string", "macro.dbt.type_int"], "nodes": []}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__credits_used.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests`.`credits_used`\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        credits_consumed as credits_spent\n    from base\n)\n\nselect * \nfrom fields\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__usage_cost": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__usage_cost", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__usage_cost.sql", "original_file_path": "models/staging/stg_fivetran_platform__usage_cost.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__usage_cost", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__usage_cost"], "alias": "stg_fivetran_platform__usage_cost", "checksum": {"name": "sha256", "checksum": "740b47d6acccb2dd3708fe6bdd5c1bde9c127cc3eefa8bee2ddd8cec30b9d1c8"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of the amount spent by the customer per month for each destination. Amount is represented in USD.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that was used.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm) of the usage activity.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dollars_spent": {"name": "dollars_spent", "description": "The total amount spent by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702500739.604872, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__usage_cost`", "raw_code": "{% if var('fivetran_platform__usage_pricing', does_table_exist('usage_cost')) %}\nwith base as (\n\n    select * \n    from {{ var('usage_cost') }}\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        amount as dollars_spent\n    from base\n)\n\nselect * \nfrom fields\n\n{% else %}\n\nselect\n    cast(null as {{ dbt.type_string() }}) as destination_id,\n    cast(null as {{ dbt.type_string() }}) as measured_month,\n    cast(null as {{ dbt.type_int() }}) as dollars_spent\n\n{% endif %}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_log.does_table_exist", "macro.dbt.type_string", "macro.dbt.type_int"], "nodes": []}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__usage_cost.sql", "compiled": true, "compiled_code": "\nwith base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests`.`usage_cost`\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        amount as dollars_spent\n    from base\n)\n\nselect * \nfrom fields\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__destination": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__destination", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__destination.sql", "original_file_path": "models/staging/stg_fivetran_platform__destination.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__destination", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__destination"], "alias": "stg_fivetran_platform__destination", "checksum": {"name": "sha256", "checksum": "59e204b797ea6e878de36084e5d3bede69c4f652a31ba542528434ae07ea29c8"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of the destinations that have data loaded into them. For each declared source, there will be just one record.", "columns": {"destination_id": {"name": "destination_id", "description": "Unique ID of the destination warehouse", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "account_id": {"name": "account_id", "description": "Foreign key referencing the fivetran `account` associated with the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the destination was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_name": {"name": "destination_name", "description": "Name of the destination warehouse.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "region": {"name": "region", "description": "Geographical region of the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702500739.605311, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__destination`", "raw_code": "with base as (\n\n    select * \n    from {{ var('destination') }}\n),\n\nfields as (\n\n    select\n        id as destination_id,\n        account_id,\n        cast(created_at as {{ dbt.type_timestamp() }}) as created_at,\n        name as destination_name,\n        region\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "destination"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.destination"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__destination.sql", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests`.`destination`\n),\n\nfields as (\n\n    select\n        id as destination_id,\n        account_id,\n        cast(created_at as timestamp) as created_at,\n        name as destination_name,\n        region\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__log": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__log", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__log.sql", "original_file_path": "models/staging/stg_fivetran_platform__log.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__log", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__log"], "alias": "stg_fivetran_platform__log", "checksum": {"name": "sha256", "checksum": "3d7152127b8635b875e7bba19eeca061435b6c0550540fed56cd174a4b3dbd24"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of logged events related to data syncs. More info on error logs  [here](https://fivetran.com/docs/logs/fivetran-log#errorlogs)\n", "columns": {"log_id": {"name": "log_id", "description": "Unique ID of the log record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_id": {"name": "sync_id", "description": "Identifies which sync the event is associated with.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the event was logged.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "The name of the `connector` that the logged event pertains to.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_type": {"name": "event_type", "description": "The umbrella event type. Events can be classified as a warning, an error, or just an information log.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_data": {"name": "message_data", "description": "The details of the event in JSON format.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event_subtype": {"name": "event_subtype", "description": "The routine involved in the log, defined [here](https://fivetran.com/docs/logs#logevents).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "transformation_id": {"name": "transformation_id", "description": "Foreign key referencing the `transformation` if the event refers to a transformation run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702500739.6057332, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log`", "raw_code": "with base as (\n\n    select * \n    from {{ ref('stg_fivetran_platform__log_tmp') }}\n),\n\nfields as (\n    select\n        {{\n            fivetran_utils.fill_staging_columns(\n                source_columns=adapter.get_columns_in_relation(ref('stg_fivetran_platform__log_tmp')),\n                staging_columns=get_log_columns()\n            )\n        }}\n    from base\n),\n\nfinal as (\n\n    select\n        id as log_id, \n        sync_id,\n        cast(time_stamp as {{ dbt.type_timestamp() }}) as created_at,\n        connector_id, -- Note: the connector_id column used to erroneously equal the connector_name, NOT its id.\n        case when transformation_id is not null and event is null then 'TRANSFORMATION'\n        else event end as event_type, \n        message_data,\n        case \n        when transformation_id is not null and message_data like '%has succeeded%' then 'transformation run success'\n        when transformation_id is not null and message_data like '%has failed%' then 'transformation run failed'\n        else message_event end as event_subtype,\n        transformation_id\n    from fields\n)\n\nselect * \nfrom final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log_tmp", "package": null, "version": null}, {"name": "stg_fivetran_platform__log_tmp", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_log.get_log_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt.type_timestamp"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log_tmp"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__log.sql", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log_tmp`\n),\n\nfields as (\n    select\n        \n    \n    \n    _fivetran_synced\n    \n as \n    \n    _fivetran_synced\n    \n, \n    \n    \n    connector_id\n    \n as \n    \n    connector_id\n    \n, \n    \n    \n    event\n    \n as \n    \n    event\n    \n, \n    \n    \n    id\n    \n as \n    \n    id\n    \n, \n    \n    \n    message_data\n    \n as \n    \n    message_data\n    \n, \n    \n    \n    message_event\n    \n as \n    \n    message_event\n    \n, \n    \n    \n    sync_id\n    \n as \n    \n    sync_id\n    \n, \n    \n    \n    time_stamp\n    \n as \n    \n    time_stamp\n    \n, \n    \n    \n    transformation_id\n    \n as \n    \n    transformation_id\n    \n\n\n\n    from base\n),\n\nfinal as (\n\n    select\n        id as log_id, \n        sync_id,\n        cast(time_stamp as timestamp) as created_at,\n        connector_id, -- Note: the connector_id column used to erroneously equal the connector_name, NOT its id.\n        case when transformation_id is not null and event is null then 'TRANSFORMATION'\n        else event end as event_type, \n        message_data,\n        case \n        when transformation_id is not null and message_data like '%has succeeded%' then 'transformation run success'\n        when transformation_id is not null and message_data like '%has failed%' then 'transformation run failed'\n        else message_event end as event_subtype,\n        transformation_id\n    from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__incremental_mar": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__incremental_mar", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__incremental_mar.sql", "original_file_path": "models/staging/stg_fivetran_platform__incremental_mar.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__incremental_mar", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__incremental_mar"], "alias": "stg_fivetran_platform__incremental_mar", "checksum": {"name": "sha256", "checksum": "e9d206751314e30b94366c9d94ed110146767669605db72745ff1807226304f0"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of **monthly active row (MAR)** measurements made by table per date.  Each measurement is calculated cumulatively for the month and includes all types of mar (paid, free, etc.)\n", "columns": {"connector_name": {"name": "connector_name", "description": "The *name* of the connector being measured. Note - this is erroneously named and will be fixed soon by Fivetran.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` whose table is being measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "free_type": {"name": "free_type", "description": "If it is free MAR, the value indicates the type of free MAR. For paid MAR, the value is `PAID`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_date": {"name": "measured_date", "description": "Timestamp of when the MAR measurement was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "incremental_rows": {"name": "incremental_rows", "description": "The number of new distinct primary keys on the current day synced for the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_type": {"name": "sync_type", "description": "This defines whether the sync for which MAR calculated is HISTORICAL or INCREMENTAL. Currently, the available value is UNKNOWN.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "The name of the connector's schema that houses the measured table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "The name of the table whose MAR was measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Timestamp of when the record was last updated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702500739.6036339, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__incremental_mar`", "raw_code": "with base as (\n\n    select * \n    from {{ var('incremental_mar') }}\n),\n\nfields as (\n\n    select\n        connector_id as connector_name,\n        destination_id,\n        free_type,\n        cast(measured_date as {{ dbt.type_timestamp() }}) as measured_date,\n        schema_name,\n        sync_type,\n        table_name,\n        updated_at,\n        _fivetran_synced,\n        incremental_rows\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "incremental_mar"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.incremental_mar"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__incremental_mar.sql", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests`.`incremental_mar`\n),\n\nfields as (\n\n    select\n        connector_id as connector_name,\n        destination_id,\n        free_type,\n        cast(measured_date as timestamp) as measured_date,\n        schema_name,\n        sync_type,\n        table_name,\n        updated_at,\n        _fivetran_synced,\n        incremental_rows\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__connector": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__connector", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__connector.sql", "original_file_path": "models/staging/stg_fivetran_platform__connector.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__connector", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__connector"], "alias": "stg_fivetran_platform__connector", "checksum": {"name": "sha256", "checksum": "26bc8050ae36226bbee0e978acbd6e5bdaccbb2d73f66d609bcd82f199c4b6ef"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of all connectors loading data into warehouses. Note that deleted connectors  are not removed, but can be identified by having an older _fivetran_synced field relative  to other connectors.\n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated destination-unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connecting_user_id": {"name": "connecting_user_id", "description": "Foreign key referencing the `user` who set up the connection.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Individual name of the connector. Note that this could be different from the `incremental_mar.schema_name`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "is_paused": {"name": "is_paused", "description": "Boolean that is true if the connector's sync is currently paused.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "set_up_at": {"name": "set_up_at", "description": "Timestamp of when the connection was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702500739.6042292, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__connector`", "raw_code": "with base as (\n\n    select * \n    from {{ ref('stg_fivetran_platform__connector_tmp') }}\n),\n\nfields as (\n    select\n        {{\n            fivetran_utils.fill_staging_columns(\n                source_columns=adapter.get_columns_in_relation(ref('stg_fivetran_platform__connector_tmp')),\n                staging_columns=get_connector_columns()\n            )\n        }}\n        ,row_number() over ( partition by connector_name, destination_id order by _fivetran_synced desc ) as nth_last_record\n    from base\n),\n\nfinal as (\n\n    select \n        connector_id,\n        connector_name,\n        coalesce(connector_type_id, connector_type) as connector_type,\n        destination_id,\n        connecting_user_id,\n        paused as is_paused,\n        signed_up as set_up_at\n    from fields\n\n    -- Only look at the most recent one\n    where nth_last_record = 1\n)\n\nselect * \nfrom final", "language": "sql", "refs": [{"name": "stg_fivetran_platform__connector_tmp", "package": null, "version": null}, {"name": "stg_fivetran_platform__connector_tmp", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.fivetran_log.get_connector_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.fivetran_log.stg_fivetran_platform__connector_tmp"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__connector.sql", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__connector_tmp`\n),\n\nfields as (\n    select\n        \n    cast(null as boolean) as \n    \n    _fivetran_deleted\n    \n , \n    \n    \n    _fivetran_synced\n    \n as \n    \n    _fivetran_synced\n    \n, \n    \n    \n    connecting_user_id\n    \n as \n    \n    connecting_user_id\n    \n, \n    \n    \n    connector_id\n    \n as \n    \n    connector_id\n    \n, \n    \n    \n    connector_name\n    \n as \n    \n    connector_name\n    \n, \n    \n    \n    connector_type\n    \n as \n    \n    connector_type\n    \n, \n    cast(null as string) as \n    \n    connector_type_id\n    \n , \n    \n    \n    destination_id\n    \n as \n    \n    destination_id\n    \n, \n    \n    \n    paused\n    \n as \n    \n    paused\n    \n, \n    cast(null as INT64) as \n    \n    service_version\n    \n , \n    \n    \n    signed_up\n    \n as \n    \n    signed_up\n    \n\n\n\n        ,row_number() over ( partition by connector_name, destination_id order by _fivetran_synced desc ) as nth_last_record\n    from base\n),\n\nfinal as (\n\n    select \n        connector_id,\n        connector_name,\n        coalesce(connector_type_id, connector_type) as connector_type,\n        destination_id,\n        connecting_user_id,\n        paused as is_paused,\n        signed_up as set_up_at\n    from fields\n\n    -- Only look at the most recent one\n    where nth_last_record = 1\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__account": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__account", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/stg_fivetran_platform__account.sql", "original_file_path": "models/staging/stg_fivetran_platform__account.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__account", "fqn": ["fivetran_log", "staging", "stg_fivetran_platform__account"], "alias": "stg_fivetran_platform__account", "checksum": {"name": "sha256", "checksum": "877d7ad3b526b29b2806da63bbb80eceaab46ac8b530a132361bb0c2ab74a20a"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "Table of information on this Fivetran account.", "columns": {"account_id": {"name": "account_id", "description": "Unique ID of the account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "country": {"name": "country", "description": "Country of the account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the account was created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "account_name": {"name": "account_name", "description": "Name of the Fivetran account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of the Fivetran account (ie trial, frozen).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "fivetran_log://models/staging/stg_fivetran_platform.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "fivetran_platform"}, "created_at": 1702500739.606265, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__account`", "raw_code": "with base as (\n    \n    select * \n    from {{ var('account') }}\n),\n\nfields as (\n\n    select\n        id as account_id,\n        country,\n        cast(created_at as {{ dbt.type_timestamp() }}) as created_at,\n        name as account_name,\n        status\n    from base\n)\n\nselect * \nfrom fields", "language": "sql", "refs": [], "sources": [["fivetran_platform", "account"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp"], "nodes": ["source.fivetran_log.fivetran_platform.account"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform__account.sql", "compiled": true, "compiled_code": "with base as (\n    \n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests`.`account`\n),\n\nfields as (\n\n    select\n        id as account_id,\n        country,\n        cast(created_at as timestamp) as created_at,\n        name as account_name,\n        status\n    from base\n)\n\nselect * \nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__connector_tmp": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__connector_tmp", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/tmp/stg_fivetran_platform__connector_tmp.sql", "original_file_path": "models/staging/tmp/stg_fivetran_platform__connector_tmp.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__connector_tmp", "fqn": ["fivetran_log", "staging", "tmp", "stg_fivetran_platform__connector_tmp"], "alias": "stg_fivetran_platform__connector_tmp", "checksum": {"name": "sha256", "checksum": "37733092912c2e3514778a0a8826e3c673dc46b5202e6319f1f193da6e453a9e"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "fivetran_platform"}, "created_at": 1702500739.384832, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__connector_tmp`", "raw_code": "select *\nfrom {{ var('connector') }}", "language": "sql", "refs": [], "sources": [["fivetran_platform", "connector"]], "metrics": [], "depends_on": {"macros": [], "nodes": ["source.fivetran_log.fivetran_platform.connector"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/tmp/stg_fivetran_platform__connector_tmp.sql", "compiled": true, "compiled_code": "select *\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests`.`connector`", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.fivetran_log.stg_fivetran_platform__log_tmp": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_fivetran_platform", "name": "stg_fivetran_platform__log_tmp", "resource_type": "model", "package_name": "fivetran_log", "path": "staging/tmp/stg_fivetran_platform__log_tmp.sql", "original_file_path": "models/staging/tmp/stg_fivetran_platform__log_tmp.sql", "unique_id": "model.fivetran_log.stg_fivetran_platform__log_tmp", "fqn": ["fivetran_log", "staging", "tmp", "stg_fivetran_platform__log_tmp"], "alias": "stg_fivetran_platform__log_tmp", "checksum": {"name": "sha256", "checksum": "9e05b5b47bbe8eb4004c8113700379a9432e90318d78d548db6f933fd549ed1b"}, "config": {"enabled": true, "alias": null, "schema": "fivetran_platform", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "fivetran_platform"}, "created_at": 1702500739.390702, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log_tmp`", "raw_code": "select *\nfrom {{ var('log') }}", "language": "sql", "refs": [], "sources": [["fivetran_platform", "log"]], "metrics": [], "depends_on": {"macros": [], "nodes": ["source.fivetran_log.fivetran_platform.log"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/tmp/stg_fivetran_platform__log_tmp.sql", "compiled": true, "compiled_code": "select *\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests`.`log`", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_id", "destination_id"], "model": "{{ get_where_subquery(ref('fivetran_platform__connector_status')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id"], "alias": "dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43"}, "created_at": 1702500739.48644, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__connector_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__connector_status"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_9c256f55ad3a377c96e1dd3e7937ee43.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__connector_status`\n    group by connector_id, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__connector_status", "attached_node": "model.fivetran_log.fivetran_platform__connector_status"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_id", "destination_id", "schema_name", "table_name", "measured_month"], "model": "{{ get_where_subquery(ref('fivetran_platform__mar_table_history')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month"], "alias": "dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8"}, "created_at": 1702500739.493963, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__mar_table_history", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__mar_table_history"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_f0f14399f5c8529316783469547415e8.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, schema_name, table_name, measured_month\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__mar_table_history`\n    group by connector_id, destination_id, schema_name, table_name, measured_month\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__mar_table_history", "attached_node": "model.fivetran_log.fivetran_platform__mar_table_history"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["destination_id", "measured_month"], "model": "{{ get_where_subquery(ref('fivetran_platform__usage_mar_destination_history')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month"], "alias": "dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b"}, "created_at": 1702500739.496507, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__usage_mar_destination_history", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_da02d00f63e8a07792a8833576eda06b.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        destination_id, measured_month\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__usage_mar_destination_history`\n    group by destination_id, measured_month\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__usage_mar_destination_history", "attached_node": "model.fivetran_log.fivetran_platform__usage_mar_destination_history"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_id", "destination_id", "date_day"], "model": "{{ get_where_subquery(ref('fivetran_platform__connector_daily_events')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day"], "alias": "dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1"}, "created_at": 1702500739.499605, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__connector_daily_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__connector_daily_events"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_09e0b187d8bc993e5ae311c3de6144a1.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, date_day\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__connector_daily_events`\n    group by connector_id, destination_id, date_day\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__connector_daily_events", "attached_node": "model.fivetran_log.fivetran_platform__connector_daily_events"}, "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "unique_table_sync_key", "model": "{{ get_where_subquery(ref('fivetran_platform__audit_table')) }}"}, "namespace": null}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "unique_fivetran_platform__audit_table_unique_table_sync_key", "resource_type": "test", "package_name": "fivetran_log", "path": "unique_fivetran_platform__audit_table_unique_table_sync_key.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7", "fqn": ["fivetran_log", "unique_fivetran_platform__audit_table_unique_table_sync_key"], "alias": "unique_fivetran_platform__audit_table_unique_table_sync_key", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702500739.548446, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "fivetran_platform__audit_table", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__audit_table"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/unique_fivetran_platform__audit_table_unique_table_sync_key.sql", "compiled": true, "compiled_code": "\n    \n    \n\nwith dbt_test__target as (\n\n  select unique_table_sync_key as unique_field\n  from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__audit_table`\n  where unique_table_sync_key is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "unique_table_sync_key", "file_key_name": "models.fivetran_platform__audit_table", "attached_node": "model.fivetran_log.fivetran_platform__audit_table"}, "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "unique_table_sync_key", "model": "{{ get_where_subquery(ref('fivetran_platform__audit_table')) }}"}, "namespace": null}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "not_null_fivetran_platform__audit_table_unique_table_sync_key", "resource_type": "test", "package_name": "fivetran_log", "path": "not_null_fivetran_platform__audit_table_unique_table_sync_key.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af", "fqn": ["fivetran_log", "not_null_fivetran_platform__audit_table_unique_table_sync_key"], "alias": "not_null_fivetran_platform__audit_table_unique_table_sync_key", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702500739.54959, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "fivetran_platform__audit_table", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__audit_table"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/not_null_fivetran_platform__audit_table_unique_table_sync_key.sql", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect unique_table_sync_key\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__audit_table`\nwhere unique_table_sync_key is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "unique_table_sync_key", "file_key_name": "models.fivetran_platform__audit_table", "attached_node": "model.fivetran_log.fivetran_platform__audit_table"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_id", "destination_id", "message_data", "created_at"], "model": "{{ get_where_subquery(ref('fivetran_platform__schema_changelog')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at"], "alias": "dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd"}, "created_at": 1702500739.5507278, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__schema_changelog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__schema_changelog"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_9aef0d81d64508710644e2d85b13c3dd.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, message_data, created_at\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__schema_changelog`\n    group by connector_id, destination_id, message_data, created_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__schema_changelog", "attached_node": "model.fivetran_log.fivetran_platform__schema_changelog"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at.be572689a3": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["log_id", "occurred_at"], "model": "{{ get_where_subquery(ref('fivetran_platform__audit_user_activity')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_fec574df3883d2c29de1d09d9c7c0b8f.sql", "original_file_path": "models/fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at.be572689a3", "fqn": ["fivetran_log", "dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at"], "alias": "dbt_utils_unique_combination_o_fec574df3883d2c29de1d09d9c7c0b8f", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_fec574df3883d2c29de1d09d9c7c0b8f", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_fec574df3883d2c29de1d09d9c7c0b8f"}, "created_at": 1702500739.553508, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_fec574df3883d2c29de1d09d9c7c0b8f\") }}", "language": "sql", "refs": [{"name": "fivetran_platform__audit_user_activity", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.fivetran_platform__audit_user_activity"]}, "compiled_path": "target/compiled/fivetran_log/models/fivetran_platform.yml/dbt_utils_unique_combination_o_fec574df3883d2c29de1d09d9c7c0b8f.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        log_id, occurred_at\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__audit_user_activity`\n    group by log_id, occurred_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.fivetran_platform__audit_user_activity", "attached_node": "model.fivetran_log.fivetran_platform__audit_user_activity"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["connector_name", "destination_id"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__connector')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id"], "alias": "dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62"}, "created_at": 1702500739.6079428, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__connector", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__connector"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_94d58d63b4a7daa71a31a2dc5849ef62.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_name, destination_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__connector`\n    group by connector_name, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__connector", "attached_node": "model.fivetran_log.stg_fivetran_platform__connector"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["measured_month", "destination_id"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__credits_used')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id"], "alias": "dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68"}, "created_at": 1702500739.610601, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__credits_used", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__credits_used"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_2ac23f274f5f6f789e728f8b8eeb5f68.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        measured_month, destination_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__credits_used`\n    group by measured_month, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__credits_used", "attached_node": "model.fivetran_log.stg_fivetran_platform__credits_used"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["measured_month", "destination_id"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__usage_cost')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id"], "alias": "dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945"}, "created_at": 1702500739.613225, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__usage_cost", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__usage_cost"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_43f2593f9f395f170695be71ec85a945.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        measured_month, destination_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__usage_cost`\n    group by measured_month, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__usage_cost", "attached_node": "model.fivetran_log.stg_fivetran_platform__usage_cost"}, "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "destination_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__destination')) }}"}, "namespace": null}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "unique_stg_fivetran_platform__destination_destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "unique_stg_fivetran_platform__destination_destination_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed", "fqn": ["fivetran_log", "staging", "unique_stg_fivetran_platform__destination_destination_id"], "alias": "unique_stg_fivetran_platform__destination_destination_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702500739.6158369, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__destination", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__destination"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/unique_stg_fivetran_platform__destination_destination_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\nwith dbt_test__target as (\n\n  select destination_id as unique_field\n  from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__destination`\n  where destination_id is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "destination_id", "file_key_name": "models.stg_fivetran_platform__destination", "attached_node": "model.fivetran_log.stg_fivetran_platform__destination"}, "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "destination_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__destination')) }}"}, "namespace": null}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "not_null_stg_fivetran_platform__destination_destination_id", "resource_type": "test", "package_name": "fivetran_log", "path": "not_null_stg_fivetran_platform__destination_destination_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780", "fqn": ["fivetran_log", "staging", "not_null_stg_fivetran_platform__destination_destination_id"], "alias": "not_null_stg_fivetran_platform__destination_destination_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702500739.61698, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__destination", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__destination"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/not_null_stg_fivetran_platform__destination_destination_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect destination_id\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__destination`\nwhere destination_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "destination_id", "file_key_name": "models.stg_fivetran_platform__destination", "attached_node": "model.fivetran_log.stg_fivetran_platform__destination"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["log_id", "created_at"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__log')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at"], "alias": "dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5"}, "created_at": 1702500739.618138, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__log", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__log"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_1a861a4d0d704305d3253b69e28140b5.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        log_id, created_at\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log`\n    group by log_id, created_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__log", "attached_node": "model.fivetran_log.stg_fivetran_platform__log"}, "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "account_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__account')) }}"}, "namespace": null}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "unique_stg_fivetran_platform__account_account_id", "resource_type": "test", "package_name": "fivetran_log", "path": "unique_stg_fivetran_platform__account_account_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc", "fqn": ["fivetran_log", "staging", "unique_stg_fivetran_platform__account_account_id"], "alias": "unique_stg_fivetran_platform__account_account_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702500739.620766, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__account", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__account"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/unique_stg_fivetran_platform__account_account_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\nwith dbt_test__target as (\n\n  select account_id as unique_field\n  from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__account`\n  where account_id is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "account_id", "file_key_name": "models.stg_fivetran_platform__account", "attached_node": "model.fivetran_log.stg_fivetran_platform__account"}, "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "account_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__account')) }}"}, "namespace": null}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "not_null_stg_fivetran_platform__account_account_id", "resource_type": "test", "package_name": "fivetran_log", "path": "not_null_stg_fivetran_platform__account_account_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e", "fqn": ["fivetran_log", "staging", "not_null_stg_fivetran_platform__account_account_id"], "alias": "not_null_stg_fivetran_platform__account_account_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702500739.6218848, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__account", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__account"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/not_null_stg_fivetran_platform__account_account_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect account_id\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__account`\nwhere account_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "account_id", "file_key_name": "models.stg_fivetran_platform__account", "attached_node": "model.fivetran_log.stg_fivetran_platform__account"}, "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["destination_id", "user_id"], "model": "{{ get_where_subquery(ref('stg_fivetran_platform__destination_membership')) }}"}, "namespace": "dbt_utils"}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id", "resource_type": "test", "package_name": "fivetran_log", "path": "dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a", "fqn": ["fivetran_log", "staging", "dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id"], "alias": "dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede"}, "created_at": 1702500739.623017, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede\") }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__destination_membership", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__destination_membership"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/dbt_utils_unique_combination_o_612267daeddb2b0a8d254502817e3ede.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        destination_id, user_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__destination_membership`\n    group by destination_id, user_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.stg_fivetran_platform__destination_membership", "attached_node": "model.fivetran_log.stg_fivetran_platform__destination_membership"}, "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "user_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__user')) }}"}, "namespace": null}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "unique_stg_fivetran_platform__user_user_id", "resource_type": "test", "package_name": "fivetran_log", "path": "unique_stg_fivetran_platform__user_user_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9", "fqn": ["fivetran_log", "staging", "unique_stg_fivetran_platform__user_user_id"], "alias": "unique_stg_fivetran_platform__user_user_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702500739.6256618, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__user", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__user"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/unique_stg_fivetran_platform__user_user_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\nwith dbt_test__target as (\n\n  select user_id as unique_field\n  from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__user`\n  where user_id is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "user_id", "file_key_name": "models.stg_fivetran_platform__user", "attached_node": "model.fivetran_log.stg_fivetran_platform__user"}, "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "user_id", "model": "{{ get_where_subquery(ref('stg_fivetran_platform__user')) }}"}, "namespace": null}, "database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests_dbt_test__audit", "name": "not_null_stg_fivetran_platform__user_user_id", "resource_type": "test", "package_name": "fivetran_log", "path": "not_null_stg_fivetran_platform__user_user_id.sql", "original_file_path": "models/staging/stg_fivetran_platform.yml", "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0", "fqn": ["fivetran_log", "staging", "not_null_stg_fivetran_platform__user_user_id"], "alias": "not_null_stg_fivetran_platform__user_user_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1702500739.626782, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "stg_fivetran_platform__user", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.fivetran_log.stg_fivetran_platform__user"]}, "compiled_path": "target/compiled/fivetran_log/models/staging/stg_fivetran_platform.yml/not_null_stg_fivetran_platform__user_user_id.sql", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect user_id\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__user`\nwhere user_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "user_id", "file_key_name": "models.stg_fivetran_platform__user", "attached_node": "model.fivetran_log.stg_fivetran_platform__user"}}, "sources": {"source.fivetran_log.fivetran_platform.incremental_mar": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests", "name": "incremental_mar", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.incremental_mar", "fqn": ["fivetran_log", "staging", "fivetran_platform", "incremental_mar"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "incremental_mar", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 96, "period": "hour"}, "filter": null}, "external": null, "description": "Table of **monthly active row (MAR)** measurements made by table per date.  Each measurement is calculated cumulatively for the month and includes all types of mar (paid, free, etc.)\n", "columns": {"connector_id": {"name": "connector_id", "description": "The *name* of the connector being measured. Note - this is erroneously named and will be fixed soon by Fivetran.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` whose table is being measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "free_type": {"name": "free_type", "description": "If it is free MAR, the value indicates the type of free MAR. For paid MAR, the value is `PAID`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_date": {"name": "measured_date", "description": "Timestamp of when the MAR measurement was made.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "incremental_rows": {"name": "incremental_rows", "description": "The number of new distinct primary keys on the current day synced for the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_type": {"name": "sync_type", "description": "This defines whether the sync for which MAR calculated is HISTORICAL or INCREMENTAL. Currently, the available value is UNKNOWN.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "The name of the connector's schema that houses the measured table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "The name of the table whose MAR was measured.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Timestamp of when the record was last updated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests`.`incremental_mar`", "created_at": 1702500739.6284502}, "source.fivetran_log.fivetran_platform.connector": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests", "name": "connector", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.connector", "fqn": ["fivetran_log", "staging", "fivetran_platform", "connector"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "connector", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of all connectors loading data into warehouses. Note that deleted connectors  are not removed, but can be identified by having an older _fivetran_synced field relative  to other connectors.\n", "columns": {"connector_id": {"name": "connector_id", "description": "System generated unique ID of the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connecting_user_id": {"name": "connecting_user_id", "description": "Foreign key referencing the `user` who set up the connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_name": {"name": "connector_name", "description": "Individual name of the connector. Note that this could be different from the `incremental_mar.schema_name`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_type": {"name": "connector_type", "description": "The kind of connector (ie google sheets, webhooks).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the connector data is loaded into.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paused": {"name": "paused", "description": "Boolean that is true if the connector's sync is currently paused.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "signed_up": {"name": "signed_up", "description": "Timestamp of when the connection was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests`.`connector`", "created_at": 1702500739.628572}, "source.fivetran_log.fivetran_platform.credits_used": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests", "name": "credits_used", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.credits_used", "fqn": ["fivetran_log", "staging", "fivetran_platform", "credits_used"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "credits_used", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of the credits used by the customer per month within each destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the credits were used on", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm) in which the credits were consumed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "credits_consumed": {"name": "credits_consumed", "description": "The number of credits used by the destination for the given month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests`.`credits_used`", "created_at": 1702500739.628664}, "source.fivetran_log.fivetran_platform.usage_cost": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests", "name": "usage_cost", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.usage_cost", "fqn": ["fivetran_log", "staging", "fivetran_platform", "usage_cost"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "usage_cost", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of the credits used by the customer per month within each destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the `destination` warehouse that the credits were used on", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measured_month": {"name": "measured_month", "description": "The month (yyyy-mm) in which the credits were consumed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "amount": {"name": "amount", "description": "The dollar amount associated with the cost of your connector.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests`.`usage_cost`", "created_at": 1702500739.62875}, "source.fivetran_log.fivetran_platform.destination": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests", "name": "destination", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.destination", "fqn": ["fivetran_log", "staging", "fivetran_platform", "destination"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "destination", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of the destinations that have data loaded into them. For each declared source, there will be just one record.", "columns": {"id": {"name": "id", "description": "Unique ID of the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "account_id": {"name": "account_id", "description": "Foreign key referencing the fivetran `account` associated with the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the destination was set up.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "Name of the destination warehouse.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "region": {"name": "region", "description": "Geographical region of the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests`.`destination`", "created_at": 1702500739.6288378}, "source.fivetran_log.fivetran_platform.log": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests", "name": "log", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.log", "fqn": ["fivetran_log", "staging", "fivetran_platform", "log"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "log", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 96, "period": "hour"}, "filter": null}, "external": null, "description": "Table of logged events related to data syncs. More info on error logs [here](https://fivetran.com/docs/logs/fivetran-log#errorlogs).", "columns": {"id": {"name": "id", "description": "Contains either `connector_name` (for app/api logs), `transformation_id` (for transformation logs),  or the value `\"system\"` (for system generated logs).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "time_stamp": {"name": "time_stamp", "description": "Timestamp of when the event was logged.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "connector_id": {"name": "connector_id", "description": "The *name* of the connector being logged. Note - this is erroneously named and will be fixed soon by Fivetran.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event": {"name": "event", "description": "The umbrella event type. Events can be classified as a warning, an error, or just an information log.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_data": {"name": "message_data", "description": "The details of the event in JSON format.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "message_event": {"name": "message_event", "description": "The routine involved in the log, defined [here](https://fivetran.com/docs/logs#logevents).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "transformation_id": {"name": "transformation_id", "description": "Foreign key referencing the `transformation` if the event refers to a transformation run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sync_id": {"name": "sync_id", "description": "Identifies which sync the event is associated with.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests`.`log`", "created_at": 1702500739.6289349}, "source.fivetran_log.fivetran_platform.account": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests", "name": "account", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.account", "fqn": ["fivetran_log", "staging", "fivetran_platform", "account"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "account", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of information on this Fivetran account.", "columns": {"id": {"name": "id", "description": "Unique ID of the account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "country": {"name": "country", "description": "Country of the account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the account was created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "Name of the Fivetran account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of the Fivetran account (ie trial, frozen).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests`.`account`", "created_at": 1702500739.629023}, "source.fivetran_log.fivetran_platform.destination_membership": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests", "name": "destination_membership", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.destination_membership", "fqn": ["fivetran_log", "staging", "fivetran_platform", "destination_membership"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "destination_membership", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of the users given access to this destination.", "columns": {"destination_id": {"name": "destination_id", "description": "Foreign key referencing the ID of the `destination` that the user is a member of.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "Foreign key referencing the ID of the `user` who has access to the destination", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "activated_at": {"name": "activated_at", "description": "Timestamp of when the user was activated in the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "joined_at": {"name": "joined_at", "description": "Timestamp of when the user was added to the destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "role": {"name": "role", "description": "The user's permissions for this individual destination.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {"enabled": true}, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests`.`destination_membership`", "created_at": 1702500739.629121}, "source.fivetran_log.fivetran_platform.user": {"database": "dbt-package-testing", "schema": "fivetran_platform_integration_tests", "name": "user", "resource_type": "source", "package_name": "fivetran_log", "path": "models/staging/src_fivetran_platform.yml", "original_file_path": "models/staging/src_fivetran_platform.yml", "unique_id": "source.fivetran_log.fivetran_platform.user", "fqn": ["fivetran_log", "staging", "fivetran_platform", "user"], "source_name": "fivetran_platform", "source_description": "", "loader": "fivetran", "identifier": "user", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Table of users given access to this Fivetran account.", "columns": {"id": {"name": "id", "description": "Unique ID of the user's account.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Timestamp of when the user was created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "Email associated with the user.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "email_disabled": {"name": "email_disabled", "description": "Boolean of whether they have disabled all email notifications.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "family_name": {"name": "family_name", "description": "User's last name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "given_name": {"name": "given_name", "description": "User's first name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "phone": {"name": "phone", "description": "Phone number associated with user.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "verified": {"name": "verified", "description": "Boolean that indicates whether the user has verified their email address in the account creation process.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when the record was last synced.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {"enabled": true}, "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests`.`user`", "created_at": 1702500739.629222}}, "macros": {"macro.dbt_bigquery.date_sharded_table": {"name": "date_sharded_table", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/etc.sql", "original_file_path": "macros/etc.sql", "unique_id": "macro.dbt_bigquery.date_sharded_table", "macro_sql": "{% macro date_sharded_table(base_name) %}\n    {{ return(base_name ~ \"[DBT__PARTITION_DATE]\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.258037, "supported_languages": null}, "macro.dbt_bigquery.grant_access_to": {"name": "grant_access_to", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/etc.sql", "original_file_path": "macros/etc.sql", "unique_id": "macro.dbt_bigquery.grant_access_to", "macro_sql": "{% macro grant_access_to(entity, entity_type, role, grant_target_dict) -%}\n  {% do adapter.grant_access_to(entity, entity_type, role, grant_target_dict) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.258272, "supported_languages": null}, "macro.dbt_bigquery.get_partitions_metadata": {"name": "get_partitions_metadata", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/etc.sql", "original_file_path": "macros/etc.sql", "unique_id": "macro.dbt_bigquery.get_partitions_metadata", "macro_sql": "\n\n{%- macro get_partitions_metadata(table) -%}\n  {%- if execute -%}\n    {%- set res = adapter.get_partitions_metadata(table) -%}\n    {{- return(res) -}}\n  {%- endif -%}\n  {{- return(None) -}}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.258566, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_catalog": {"name": "bigquery__get_catalog", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_catalog", "macro_sql": "{% macro bigquery__get_catalog(information_schema, schemas) -%}\n\n  {%- if (schemas | length) == 0 -%}\n    {# Hopefully nothing cares about the columns we return when there are no rows #}\n    {%- set query  = \"select 1 as id limit 0\" -%}\n  {%- else -%}\n\n  {%- set query -%}\n    with materialized_views as (\n        select\n            table_catalog as project_id,\n            table_schema as dataset_id,\n            table_name as table_id\n        from {{ information_schema.replace(information_schema_view='MATERIALIZED_VIEWS') }}\n    ),\n    tables as (\n        select\n            tables.project_id as table_database,\n            tables.dataset_id as table_schema,\n            tables.table_id as original_table_name,\n\n            concat(tables.project_id, '.', tables.dataset_id, '.', tables.table_id) as relation_id,\n\n            tables.row_count,\n            tables.size_bytes as size_bytes,\n            case\n                when materialized_views.table_id is not null then 'materialized view'\n                when tables.type = 1 then 'table'\n                when tables.type = 2 then 'view'\n                else 'external'\n            end as table_type,\n\n            REGEXP_CONTAINS(tables.table_id, '^.+[0-9]{8}$') and coalesce(type, 0) = 1 as is_date_shard,\n            REGEXP_EXTRACT(tables.table_id, '^(.+)[0-9]{8}$') as shard_base_name,\n            REGEXP_EXTRACT(tables.table_id, '^.+([0-9]{8})$') as shard_name\n\n        from {{ information_schema.replace(information_schema_view='__TABLES__') }} tables\n        left join materialized_views\n            on materialized_views.project_id = tables.project_id\n            and materialized_views.dataset_id = tables.dataset_id\n            and materialized_views.table_id = tables.table_id\n        where (\n          {%- for schema in schemas -%}\n            upper(tables.dataset_id) = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n          {%- endfor -%}\n        )\n    ),\n\n    table_options as (\n        select\n            concat(table_catalog, '.', table_schema, '.', table_name) as relation_id,\n            JSON_VALUE(option_value) as table_comment\n\n        from {{ information_schema.replace(information_schema_view='TABLE_OPTIONS') }}\n        where option_name = 'description'\n    ),\n    extracted as (\n\n        select *,\n            case\n                when is_date_shard then shard_base_name\n                else original_table_name\n            end as table_name\n\n        from tables\n\n    ),\n\n    unsharded_tables as (\n\n        select\n            table_database,\n            table_schema,\n            table_name,\n            coalesce(table_type, 'external') as table_type,\n            is_date_shard,\n\n            struct(\n                min(shard_name) as shard_min,\n                max(shard_name) as shard_max,\n                count(*) as shard_count\n            ) as table_shards,\n\n            sum(size_bytes) as size_bytes,\n            sum(row_count) as row_count,\n\n            max(relation_id) as relation_id\n\n        from extracted\n        group by 1,2,3,4,5\n\n    ),\n\n    info_schema_columns as (\n\n        select\n            concat(table_catalog, '.', table_schema, '.', table_name) as relation_id,\n            table_catalog as table_database,\n            table_schema,\n            table_name,\n\n            -- use the \"real\" column name from the paths query below\n            column_name as base_column_name,\n            ordinal_position as column_index,\n\n            is_partitioning_column,\n            clustering_ordinal_position\n\n        from {{ information_schema.replace(information_schema_view='COLUMNS') }}\n        where ordinal_position is not null\n\n    ),\n\n    info_schema_column_paths as (\n\n        select\n            concat(table_catalog, '.', table_schema, '.', table_name) as relation_id,\n            field_path as column_name,\n            data_type as column_type,\n            column_name as base_column_name,\n            description as column_comment\n\n        from {{ information_schema.replace(information_schema_view='COLUMN_FIELD_PATHS') }}\n\n    ),\n\n    columns as (\n\n        select * except (base_column_name)\n        from info_schema_columns\n        join info_schema_column_paths using (relation_id, base_column_name)\n\n    ),\n\n    column_stats as (\n\n        select\n            table_database,\n            table_schema,\n            table_name,\n            max(relation_id) as relation_id,\n            max(case when is_partitioning_column = 'YES' then 1 else 0 end) = 1 as is_partitioned,\n            max(case when is_partitioning_column = 'YES' then column_name else null end) as partition_column,\n            max(case when clustering_ordinal_position is not null then 1 else 0 end) = 1 as is_clustered,\n            array_to_string(\n                array_agg(\n                    case\n                        when clustering_ordinal_position is not null then column_name\n                        else null\n                    end ignore nulls\n                    order by clustering_ordinal_position\n                ), ', '\n            ) as clustering_columns\n\n        from columns\n        group by 1,2,3\n\n    )\n\n    select\n        unsharded_tables.table_database,\n        unsharded_tables.table_schema,\n        case\n            when is_date_shard then concat(unsharded_tables.table_name, '*')\n            else unsharded_tables.table_name\n        end as table_name,\n        unsharded_tables.table_type,\n        table_options.table_comment,\n\n        -- coalesce name and type for External tables - these columns are not\n        -- present in the COLUMN_FIELD_PATHS resultset\n        coalesce(columns.column_name, '<unknown>') as column_name,\n        -- invent a row number to account for nested fields -- BQ does\n        -- not treat these nested properties as independent fields\n        row_number() over (\n            partition by relation_id\n            order by columns.column_index, columns.column_name\n        ) as column_index,\n        coalesce(columns.column_type, '<unknown>') as column_type,\n        columns.column_comment,\n\n        'Shard count' as `stats__date_shards__label`,\n        table_shards.shard_count as `stats__date_shards__value`,\n        'The number of date shards in this table' as `stats__date_shards__description`,\n        is_date_shard as `stats__date_shards__include`,\n\n        'Shard (min)' as `stats__date_shard_min__label`,\n        table_shards.shard_min as `stats__date_shard_min__value`,\n        'The first date shard in this table' as `stats__date_shard_min__description`,\n        is_date_shard as `stats__date_shard_min__include`,\n\n        'Shard (max)' as `stats__date_shard_max__label`,\n        table_shards.shard_max as `stats__date_shard_max__value`,\n        'The last date shard in this table' as `stats__date_shard_max__description`,\n        is_date_shard as `stats__date_shard_max__include`,\n\n        '# Rows' as `stats__num_rows__label`,\n        row_count as `stats__num_rows__value`,\n        'Approximate count of rows in this table' as `stats__num_rows__description`,\n        (unsharded_tables.table_type = 'table') as `stats__num_rows__include`,\n\n        'Approximate Size' as `stats__num_bytes__label`,\n        size_bytes as `stats__num_bytes__value`,\n        'Approximate size of table as reported by BigQuery' as `stats__num_bytes__description`,\n        (unsharded_tables.table_type = 'table') as `stats__num_bytes__include`,\n\n        'Partitioned By' as `stats__partitioning_type__label`,\n        partition_column as `stats__partitioning_type__value`,\n        'The partitioning column for this table' as `stats__partitioning_type__description`,\n        is_partitioned as `stats__partitioning_type__include`,\n\n        'Clustered By' as `stats__clustering_fields__label`,\n        clustering_columns as `stats__clustering_fields__value`,\n        'The clustering columns for this table' as `stats__clustering_fields__description`,\n        is_clustered as `stats__clustering_fields__include`\n\n    -- join using relation_id (an actual relation, not a shard prefix) to make\n    -- sure that column metadata is picked up through the join. This will only\n    -- return the column information for the \"max\" table in a date-sharded table set\n    from unsharded_tables\n    left join table_options using (relation_id)\n    left join columns using (relation_id)\n    left join column_stats using (relation_id)\n  {%- endset -%}\n\n  {%- endif -%}\n\n  {{ return(run_query(query)) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.263433, "supported_languages": null}, "macro.dbt_bigquery.bigquery__create_table_as": {"name": "bigquery__create_table_as", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__create_table_as", "macro_sql": "{% macro bigquery__create_table_as(temporary, relation, compiled_code, language='sql') -%}\n  {%- if language == 'sql' -%}\n    {%- set raw_partition_by = config.get('partition_by', none) -%}\n    {%- set raw_cluster_by = config.get('cluster_by', none) -%}\n    {%- set sql_header = config.get('sql_header', none) -%}\n\n    {%- set partition_config = adapter.parse_partition_by(raw_partition_by) -%}\n    {%- if partition_config.time_ingestion_partitioning -%}\n    {%- set columns = get_columns_with_types_in_query_sql(sql) -%}\n    {%- set table_dest_columns_csv = columns_without_partition_fields_csv(partition_config, columns) -%}\n    {%- set columns = '(' ~ table_dest_columns_csv ~ ')' -%}\n    {%- endif -%}\n\n    {{ sql_header if sql_header is not none }}\n\n    create or replace table {{ relation }}\n      {%- set contract_config = config.get('contract') -%}\n      {%- if contract_config.enforced -%}\n        {{ get_assert_columns_equivalent(compiled_code) }}\n        {{ get_table_columns_and_constraints() }}\n        {%- set compiled_code = get_select_subquery(compiled_code) %}\n      {% else %}\n        {#-- cannot do contracts at the same time as time ingestion partitioning -#}\n        {{ columns }}\n      {% endif %}\n    {{ partition_by(partition_config) }}\n    {{ cluster_by(raw_cluster_by) }}\n\n    {{ bigquery_table_options(config, model, temporary) }}\n\n    {#-- PARTITION BY cannot be used with the AS query_statement clause.\n         https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#partition_expression\n    -#}\n    {%- if not partition_config.time_ingestion_partitioning %}\n    as (\n      {{ compiled_code }}\n    );\n    {%- endif %}\n  {%- elif language == 'python' -%}\n    {#--\n    N.B. Python models _can_ write to temp views HOWEVER they use a different session\n    and have already expired by the time they need to be used (I.E. in merges for incremental models)\n\n    TODO: Deep dive into spark sessions to see if we can reuse a single session for an entire\n    dbt invocation.\n     --#}\n\n    {#-- when a user wants to change the schema of an existing relation, they must intentionally drop the table in the dataset --#}\n    {%- set old_relation = adapter.get_relation(database=relation.database, schema=relation.schema, identifier=relation.identifier) -%}\n    {%- if (old_relation.is_table and (should_full_refresh())) -%}\n      {% do adapter.drop_relation(relation) %}\n    {%- endif -%}\n    {{ py_write_table(compiled_code=compiled_code, target_relation=relation.quote(database=False, schema=False, identifier=False)) }}\n  {%- else -%}\n    {% do exceptions.raise_compiler_error(\"bigquery__create_table_as macro didn't get supported language, it got %s\" % language) %}\n  {%- endif -%}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_bigquery.get_columns_with_types_in_query_sql", "macro.dbt_bigquery.columns_without_partition_fields_csv", "macro.dbt.get_assert_columns_equivalent", "macro.dbt.get_table_columns_and_constraints", "macro.dbt.get_select_subquery", "macro.dbt_bigquery.partition_by", "macro.dbt_bigquery.cluster_by", "macro.dbt_bigquery.bigquery_table_options", "macro.dbt.should_full_refresh", "macro.dbt_bigquery.py_write_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.2679958, "supported_languages": null}, "macro.dbt_bigquery.bigquery__create_view_as": {"name": "bigquery__create_view_as", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__create_view_as", "macro_sql": "{% macro bigquery__create_view_as(relation, sql) -%}\n  {%- set sql_header = config.get('sql_header', none) -%}\n\n  {{ sql_header if sql_header is not none }}\n\n  create or replace view {{ relation }}\n  {{ bigquery_view_options(config, model) }}\n  {%- set contract_config = config.get('contract') -%}\n  {%- if contract_config.enforced -%}\n    {{ get_assert_columns_equivalent(sql) }}\n  {%- endif %}\n  as {{ sql }};\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery_view_options", "macro.dbt.get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.268517, "supported_languages": null}, "macro.dbt_bigquery.bigquery__drop_schema": {"name": "bigquery__drop_schema", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__drop_schema", "macro_sql": "{% macro bigquery__drop_schema(relation) -%}\n  {{ adapter.drop_schema(relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.268663, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_columns_in_relation": {"name": "bigquery__get_columns_in_relation", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_columns_in_relation", "macro_sql": "{% macro bigquery__get_columns_in_relation(relation) -%}\n  {{ return(adapter.get_columns_in_relation(relation)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.268817, "supported_languages": null}, "macro.dbt_bigquery.bigquery__list_relations_without_caching": {"name": "bigquery__list_relations_without_caching", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__list_relations_without_caching", "macro_sql": "{% macro bigquery__list_relations_without_caching(schema_relation) -%}\n  {{ return(adapter.list_relations_without_caching(schema_relation)) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.26897, "supported_languages": null}, "macro.dbt_bigquery.bigquery__list_schemas": {"name": "bigquery__list_schemas", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__list_schemas", "macro_sql": "{% macro bigquery__list_schemas(database) -%}\n  {{ return(adapter.list_schemas(database)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.269127, "supported_languages": null}, "macro.dbt_bigquery.bigquery__check_schema_exists": {"name": "bigquery__check_schema_exists", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__check_schema_exists", "macro_sql": "{% macro bigquery__check_schema_exists(information_schema, schema) %}\n  {{ return(adapter.check_schema_exists(information_schema.database, schema)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.269314, "supported_languages": null}, "macro.dbt_bigquery.bigquery__persist_docs": {"name": "bigquery__persist_docs", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__persist_docs", "macro_sql": "{% macro bigquery__persist_docs(relation, model, for_relation, for_columns) -%}\n  {% if for_columns and config.persist_column_docs() and model.columns %}\n    {% do alter_column_comment(relation, model.columns) %}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.269602, "supported_languages": null}, "macro.dbt_bigquery.bigquery__alter_column_comment": {"name": "bigquery__alter_column_comment", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__alter_column_comment", "macro_sql": "{% macro bigquery__alter_column_comment(relation, column_dict) -%}\n  {% do adapter.update_columns(relation, column_dict) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.2697642, "supported_languages": null}, "macro.dbt_bigquery.bigquery__alter_relation_add_columns": {"name": "bigquery__alter_relation_add_columns", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__alter_relation_add_columns", "macro_sql": "{% macro bigquery__alter_relation_add_columns(relation, add_columns) %}\n\n  {% set sql -%}\n\n     alter {{ relation.type }} {{ relation }}\n        {% for column in add_columns %}\n          add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n        {% endfor %}\n\n  {%- endset -%}\n\n  {{ return(run_query(sql)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.270175, "supported_languages": null}, "macro.dbt_bigquery.bigquery__alter_relation_drop_columns": {"name": "bigquery__alter_relation_drop_columns", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__alter_relation_drop_columns", "macro_sql": "{% macro bigquery__alter_relation_drop_columns(relation, drop_columns) %}\n\n  {% set sql -%}\n\n     alter {{ relation.type }} {{ relation }}\n\n        {% for column in drop_columns %}\n          drop column {{ column.name }}{{ ',' if not loop.last }}\n        {% endfor %}\n\n  {%- endset -%}\n\n  {{ return(run_query(sql)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.2705631, "supported_languages": null}, "macro.dbt_bigquery.bigquery__alter_column_type": {"name": "bigquery__alter_column_type", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__alter_column_type", "macro_sql": "{% macro bigquery__alter_column_type(relation, column_name, new_column_type) -%}\n  {#-- Changing a column's data type using a query requires you to scan the entire table.\n    The query charges can be significant if the table is very large.\n\n    https://cloud.google.com/bigquery/docs/manually-changing-schemas#changing_a_columns_data_type\n  #}\n  {% set relation_columns = get_columns_in_relation(relation) %}\n\n  {% set sql %}\n    select\n      {%- for col in relation_columns -%}\n        {% if col.column == column_name %}\n          CAST({{ col.quoted }} AS {{ new_column_type }}) AS {{ col.quoted }}\n        {%- else %}\n          {{ col.quoted }}\n        {%- endif %}\n        {%- if not loop.last %},{% endif -%}\n      {%- endfor %}\n    from {{ relation }}\n  {% endset %}\n\n  {% call statement('alter_column_type') %}\n    {{ create_table_as(False, relation, sql)}}\n  {%- endcall %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_columns_in_relation", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.2713249, "supported_languages": null}, "macro.dbt_bigquery.bigquery__test_unique": {"name": "bigquery__test_unique", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__test_unique", "macro_sql": "{% macro bigquery__test_unique(model, column_name) %}\n\nwith dbt_test__target as (\n\n  select {{ column_name }} as unique_field\n  from {{ model }}\n  where {{ column_name }} is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.271502, "supported_languages": null}, "macro.dbt_bigquery.bigquery__upload_file": {"name": "bigquery__upload_file", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_bigquery.bigquery__upload_file", "macro_sql": "{% macro bigquery__upload_file(local_file_path, database, table_schema, table_name) %}\n\n  {{ log(\"kwargs: \" ~ kwargs) }}\n\n  {% do adapter.upload_file(local_file_path, database, table_schema, table_name, kwargs=kwargs) %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.2717912, "supported_languages": null}, "macro.dbt_bigquery.bigquery__create_csv_table": {"name": "bigquery__create_csv_table", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "unique_id": "macro.dbt_bigquery.bigquery__create_csv_table", "macro_sql": "{% macro bigquery__create_csv_table(model, agate_table) %}\n    -- no-op\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.272179, "supported_languages": null}, "macro.dbt_bigquery.bigquery__reset_csv_table": {"name": "bigquery__reset_csv_table", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "unique_id": "macro.dbt_bigquery.bigquery__reset_csv_table", "macro_sql": "{% macro bigquery__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n    {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.272373, "supported_languages": null}, "macro.dbt_bigquery.bigquery__load_csv_rows": {"name": "bigquery__load_csv_rows", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "unique_id": "macro.dbt_bigquery.bigquery__load_csv_rows", "macro_sql": "{% macro bigquery__load_csv_rows(model, agate_table) %}\n\n  {%- set column_override = model['config'].get('column_types', {}) -%}\n  {{ adapter.load_dataframe(model['database'], model['schema'], model['alias'],\n  \t\t\t\t\t\t\tagate_table, column_override) }}\n\n  {% call statement() %}\n    alter table {{ this.render() }} set {{ bigquery_table_options(config, model) }}\n  {% endcall %}\n\n  {% if config.persist_relation_docs() and 'description' in model %}\n\n  \t{{ adapter.update_table_description(model['database'], model['schema'], model['alias'], model['description']) }}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_bigquery.bigquery_table_options"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.2731562, "supported_languages": null}, "macro.dbt_bigquery.bigquery__handle_existing_table": {"name": "bigquery__handle_existing_table", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "unique_id": "macro.dbt_bigquery.bigquery__handle_existing_table", "macro_sql": "{% macro bigquery__handle_existing_table(full_refresh, old_relation) %}\n    {%- if full_refresh -%}\n      {{ adapter.drop_relation(old_relation) }}\n    {%- else -%}\n      {{ exceptions.relation_wrong_type(old_relation, 'view') }}\n    {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.273741, "supported_languages": null}, "macro.dbt_bigquery.materialization_view_bigquery": {"name": "materialization_view_bigquery", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "unique_id": "macro.dbt_bigquery.materialization_view_bigquery", "macro_sql": "{% materialization view, adapter='bigquery' -%}\n    -- grab current tables grants config for comparision later on\n    {% set grant_config = config.get('grants') %}\n\n    {% set to_return = bigquery__create_or_replace_view() %}\n\n    {% set target_relation = this.incorporate(type='view') %}\n\n    {% do persist_docs(target_relation, model) %}\n\n    {% if config.get('grant_access_to') %}\n      {% for grant_target_dict in config.get('grant_access_to') %}\n        {% do adapter.grant_access_to(this, 'view', None, grant_target_dict) %}\n      {% endfor %}\n    {% endif %}\n\n    {% do return(to_return) %}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_or_replace_view", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.274435, "supported_languages": ["sql"]}, "macro.dbt_bigquery.materialization_table_bigquery": {"name": "materialization_table_bigquery", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_bigquery.materialization_table_bigquery", "macro_sql": "{% materialization table, adapter='bigquery', supported_languages=['sql', 'python']-%}\n\n  {%- set language = model['language'] -%}\n  {%- set identifier = model['alias'] -%}\n  {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n  {%- set exists_not_as_table = (old_relation is not none and not old_relation.is_table) -%}\n  {%- set target_relation = api.Relation.create(database=database, schema=schema, identifier=identifier, type='table') -%}\n\n  -- grab current tables grants config for comparision later on\n  {%- set grant_config = config.get('grants') -%}\n\n  {{ run_hooks(pre_hooks) }}\n\n  {#\n      We only need to drop this thing if it is not a table.\n      If it _is_ already a table, then we can overwrite it without downtime\n      Unlike table -> view, no need for `--full-refresh`: dropping a view is no big deal\n  #}\n  {%- if exists_not_as_table -%}\n      {{ adapter.drop_relation(old_relation) }}\n  {%- endif -%}\n\n  -- build model\n  {%- set raw_partition_by = config.get('partition_by', none) -%}\n  {%- set partition_by = adapter.parse_partition_by(raw_partition_by) -%}\n  {%- set cluster_by = config.get('cluster_by', none) -%}\n  {% if not adapter.is_replaceable(old_relation, partition_by, cluster_by) %}\n    {% do log(\"Hard refreshing \" ~ old_relation ~ \" because it is not replaceable\") %}\n    {% do adapter.drop_relation(old_relation) %}\n  {% endif %}\n\n  -- build model\n  {%- call statement('main', language=language) -%}\n    {{ create_table_as(False, target_relation, compiled_code, language) }}\n  {%- endcall -%}\n\n  {{ run_hooks(post_hooks) }}\n\n  {% set should_revoke = should_revoke(old_relation, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.278368, "supported_languages": ["sql", "python"]}, "macro.dbt_bigquery.py_write_table": {"name": "py_write_table", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_bigquery.py_write_table", "macro_sql": "{% macro py_write_table(compiled_code, target_relation) %}\nfrom pyspark.sql import SparkSession\n{%- set raw_partition_by = config.get('partition_by', none) -%}\n{%- set raw_cluster_by = config.get('cluster_by', none) -%}\n{%- set partition_config = adapter.parse_partition_by(raw_partition_by) %}\n\nspark = SparkSession.builder.appName('smallTest').getOrCreate()\n\nspark.conf.set(\"viewsEnabled\",\"true\")\nspark.conf.set(\"temporaryGcsBucket\",\"{{target.gcs_bucket}}\")\n\n{{ compiled_code }}\ndbt = dbtObj(spark.read.format(\"bigquery\").load)\ndf = model(dbt, spark)\n\n# COMMAND ----------\n# this is materialization code dbt generated, please do not modify\n\nimport pyspark\n# make sure pandas exists before using it\ntry:\n  import pandas\n  pandas_available = True\nexcept ImportError:\n  pandas_available = False\n\n# make sure pyspark.pandas exists before using it\ntry:\n  import pyspark.pandas\n  pyspark_pandas_api_available = True\nexcept ImportError:\n  pyspark_pandas_api_available = False\n\n# make sure databricks.koalas exists before using it\ntry:\n  import databricks.koalas\n  koalas_available = True\nexcept ImportError:\n  koalas_available = False\n\n# preferentially convert pandas DataFrames to pandas-on-Spark or Koalas DataFrames first\n# since they know how to convert pandas DataFrames better than `spark.createDataFrame(df)`\n# and converting from pandas-on-Spark to Spark DataFrame has no overhead\nif pyspark_pandas_api_available and pandas_available and isinstance(df, pandas.core.frame.DataFrame):\n  df = pyspark.pandas.frame.DataFrame(df)\nelif koalas_available and pandas_available and isinstance(df, pandas.core.frame.DataFrame):\n  df = databricks.koalas.frame.DataFrame(df)\n\n# convert to pyspark.sql.dataframe.DataFrame\nif isinstance(df, pyspark.sql.dataframe.DataFrame):\n  pass  # since it is already a Spark DataFrame\nelif pyspark_pandas_api_available and isinstance(df, pyspark.pandas.frame.DataFrame):\n  df = df.to_spark()\nelif koalas_available and isinstance(df, databricks.koalas.frame.DataFrame):\n  df = df.to_spark()\nelif pandas_available and isinstance(df, pandas.core.frame.DataFrame):\n  df = spark.createDataFrame(df)\nelse:\n  msg = f\"{type(df)} is not a supported type for dbt Python materialization\"\n  raise Exception(msg)\n\ndf.write \\\n  .mode(\"overwrite\") \\\n  .format(\"bigquery\") \\\n  .option(\"writeMethod\", \"indirect\").option(\"writeDisposition\", 'WRITE_TRUNCATE') \\\n  {%- if partition_config is not none %}\n  {%- if partition_config.data_type | lower in ('date','timestamp','datetime') %}\n  .option(\"partitionField\", \"{{- partition_config.field -}}\") \\\n  {%- if partition_config.granularity is not none %}\n  .option(\"partitionType\", \"{{- partition_config.granularity| upper -}}\") \\\n  {%- endif %}\n  {%- endif %}\n  {%- endif %}\n  {%- if raw_cluster_by is not none %}\n  .option(\"clusteredFields\", \"{{- raw_cluster_by | join(',') -}}\") \\\n  {%- endif %}\n  .save(\"{{target_relation}}\")\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.27941, "supported_languages": null}, "macro.dbt_bigquery.materialization_copy_bigquery": {"name": "materialization_copy_bigquery", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/copy.sql", "original_file_path": "macros/materializations/copy.sql", "unique_id": "macro.dbt_bigquery.materialization_copy_bigquery", "macro_sql": "{% materialization copy, adapter='bigquery' -%}\n\n  {# Setup #}\n  {{ run_hooks(pre_hooks) }}\n\n  {% set destination = this.incorporate(type='table') %}\n\n  {# there can be several ref() or source() according to BQ copy API docs #}\n  {# cycle over ref() and source() to create source tables array #}\n  {% set source_array = [] %}\n  {% for ref_table in model.refs %}\n    {{ source_array.append(ref(ref_table.get('package'), ref_table.name, version=ref_table.get('version'))) }}\n  {% endfor %}\n\n  {% for src_table in model.sources %}\n    {{ source_array.append(source(*src_table)) }}\n  {% endfor %}\n\n  {# Call adapter copy_table function #}\n  {%- set result_str = adapter.copy_table(\n      source_array,\n      destination,\n      config.get('copy_materialization', default = 'table')) -%}\n\n  {{ store_result('main', response=result_str) }}\n\n  {# Clean up #}\n  {{ run_hooks(post_hooks) }}\n  {%- do apply_grants(target_relation, grant_config) -%}\n  {{ adapter.commit() }}\n\n  {{ return({'relations': [destination]}) }}\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.280743, "supported_languages": ["sql"]}, "macro.dbt_bigquery.dbt_bigquery_validate_get_incremental_strategy": {"name": "dbt_bigquery_validate_get_incremental_strategy", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_bigquery.dbt_bigquery_validate_get_incremental_strategy", "macro_sql": "{% macro dbt_bigquery_validate_get_incremental_strategy(config) %}\n  {#-- Find and validate the incremental strategy #}\n  {%- set strategy = config.get(\"incremental_strategy\") or 'merge' -%}\n\n  {% set invalid_strategy_msg -%}\n    Invalid incremental strategy provided: {{ strategy }}\n    Expected one of: 'merge', 'insert_overwrite'\n  {%- endset %}\n  {% if strategy not in ['merge', 'insert_overwrite'] %}\n    {% do exceptions.raise_compiler_error(invalid_strategy_msg) %}\n  {% endif %}\n\n  {% do return(strategy) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.2829099, "supported_languages": null}, "macro.dbt_bigquery.source_sql_with_partition": {"name": "source_sql_with_partition", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_bigquery.source_sql_with_partition", "macro_sql": "{% macro source_sql_with_partition(partition_by, source_sql) %}\n\n  {%- if partition_by.time_ingestion_partitioning %}\n    {{ return(wrap_with_time_ingestion_partitioning_sql(partition_by, source_sql, False))  }}\n  {% else %}\n    {{ return(source_sql)  }}\n  {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.wrap_with_time_ingestion_partitioning_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.283208, "supported_languages": null}, "macro.dbt_bigquery.bq_create_table_as": {"name": "bq_create_table_as", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_bigquery.bq_create_table_as", "macro_sql": "{% macro bq_create_table_as(partition_by, temporary, relation, compiled_code, language='sql') %}\n  {%- set _dbt_max_partition = declare_dbt_max_partition(this, partition_by, compiled_code, language) -%}\n  {% if partition_by.time_ingestion_partitioning and language == 'python' %}\n    {% do exceptions.raise_compiler_error(\n      \"Python models do not support ingestion time partitioning\"\n    ) %}\n  {% elif partition_by.time_ingestion_partitioning and language == 'sql' %}\n    {#-- Create the table before inserting data as ingestion time partitioned tables can't be created with the transformed data --#}\n    {% do run_query(create_table_as(temporary, relation, compiled_code)) %}\n    {{ return(_dbt_max_partition + bq_insert_into_ingestion_time_partitioned_table_sql(relation, compiled_code)) }}\n  {% else %}\n    {{ return(_dbt_max_partition + create_table_as(temporary, relation, compiled_code, language)) }}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.declare_dbt_max_partition", "macro.dbt.run_query", "macro.dbt.create_table_as", "macro.dbt_bigquery.bq_insert_into_ingestion_time_partitioned_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.2839801, "supported_languages": null}, "macro.dbt_bigquery.bq_generate_incremental_build_sql": {"name": "bq_generate_incremental_build_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_bigquery.bq_generate_incremental_build_sql", "macro_sql": "{% macro bq_generate_incremental_build_sql(\n    strategy, tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists, copy_partitions, incremental_predicates\n) %}\n  {#-- if partitioned, use BQ scripting to get the range of partition values to be updated --#}\n  {% if strategy == 'insert_overwrite' %}\n\n    {% set build_sql = bq_generate_incremental_insert_overwrite_build_sql(\n        tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists, copy_partitions\n    ) %}\n\n  {% else %} {# strategy == 'merge' #}\n\n    {% set build_sql = bq_generate_incremental_merge_build_sql(\n        tmp_relation, target_relation, sql, unique_key, partition_by, dest_columns, tmp_relation_exists, incremental_predicates\n    ) %}\n\n  {% endif %}\n\n  {{ return(build_sql) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bq_generate_incremental_insert_overwrite_build_sql", "macro.dbt_bigquery.bq_generate_incremental_merge_build_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.284637, "supported_languages": null}, "macro.dbt_bigquery.materialization_incremental_bigquery": {"name": "materialization_incremental_bigquery", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_bigquery.materialization_incremental_bigquery", "macro_sql": "{% materialization incremental, adapter='bigquery', supported_languages=['sql', 'python'] -%}\n\n  {%- set unique_key = config.get('unique_key') -%}\n  {%- set full_refresh_mode = (should_full_refresh()) -%}\n  {%- set language = model['language'] %}\n\n  {%- set target_relation = this %}\n  {%- set existing_relation = load_relation(this) %}\n  {%- set tmp_relation = make_temp_relation(this) %}\n\n  {#-- Validate early so we don't run SQL if the strategy is invalid --#}\n  {% set strategy = dbt_bigquery_validate_get_incremental_strategy(config) -%}\n\n  {%- set raw_partition_by = config.get('partition_by', none) -%}\n  {%- set partition_by = adapter.parse_partition_by(raw_partition_by) -%}\n  {%- set partitions = config.get('partitions', none) -%}\n  {%- set cluster_by = config.get('cluster_by', none) -%}\n\n  {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %}\n  {% set incremental_predicates = config.get('predicates', default=none) or config.get('incremental_predicates', default=none) %}\n\n   -- grab current tables grants config for comparison later on\n  {% set grant_config = config.get('grants') %}\n\n  {{ run_hooks(pre_hooks) }}\n\n  {% if partition_by.copy_partitions is true and strategy != 'insert_overwrite' %} {#-- We can't copy partitions with merge strategy --#}\n        {% set wrong_strategy_msg -%}\n        The 'copy_partitions' option requires the 'incremental_strategy' option to be set to 'insert_overwrite'.\n        {%- endset %}\n        {% do exceptions.raise_compiler_error(wrong_strategy_msg) %}\n\n  {% elif existing_relation is none %}\n      {%- call statement('main', language=language) -%}\n        {{ bq_create_table_as(partition_by, False, target_relation, compiled_code, language) }}\n      {%- endcall -%}\n\n  {% elif existing_relation.is_view %}\n      {#-- There's no way to atomically replace a view with a table on BQ --#}\n      {{ adapter.drop_relation(existing_relation) }}\n      {%- call statement('main', language=language) -%}\n        {{ bq_create_table_as(partition_by, False, target_relation, compiled_code, language) }}\n      {%- endcall -%}\n\n  {% elif full_refresh_mode %}\n      {#-- If the partition/cluster config has changed, then we must drop and recreate --#}\n      {% if not adapter.is_replaceable(existing_relation, partition_by, cluster_by) %}\n          {% do log(\"Hard refreshing \" ~ existing_relation ~ \" because it is not replaceable\") %}\n          {{ adapter.drop_relation(existing_relation) }}\n      {% endif %}\n      {%- call statement('main', language=language) -%}\n        {{ bq_create_table_as(partition_by, False, target_relation, compiled_code, language) }}\n      {%- endcall -%}\n\n  {% else %}\n    {%- if language == 'python' and strategy == 'insert_overwrite' -%}\n      {#-- This lets us move forward assuming no python will be directly templated into a query --#}\n      {%- set python_unsupported_msg -%}\n        The 'insert_overwrite' strategy is not yet supported for python models.\n      {%- endset %}\n      {% do exceptions.raise_compiler_error(python_unsupported_msg) %}\n    {%- endif -%}\n\n    {% set tmp_relation_exists = false %}\n    {% if on_schema_change != 'ignore' or language == 'python' %}\n      {#-- Check first, since otherwise we may not build a temp table --#}\n      {#-- Python always needs to create a temp table --#}\n      {%- call statement('create_tmp_relation', language=language) -%}\n        {{ bq_create_table_as(partition_by, True, tmp_relation, compiled_code, language) }}\n      {%- endcall -%}\n      {% set tmp_relation_exists = true %}\n      {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n      {% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}\n    {% endif %}\n\n    {% if not dest_columns %}\n      {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n    {% endif %}\n    {#--  Add time ingestion pseudo column to destination column as not part of the 'schema' but still need it for actual data insertion --#}\n    {% if partition_by.time_ingestion_partitioning %}\n      {% set dest_columns = adapter.add_time_ingestion_partition_column(partition_by, dest_columns) %}\n    {% endif %}\n\n    {% set build_sql = bq_generate_incremental_build_sql(\n        strategy, tmp_relation, target_relation, compiled_code, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists, partition_by.copy_partitions, incremental_predicates\n    ) %}\n\n    {%- call statement('main') -%}\n      {{ build_sql }}\n    {% endcall %}\n\n    {%- if language == 'python' and tmp_relation -%}\n      {{ adapter.drop_relation(tmp_relation) }}\n    {%- endif -%}\n\n  {% endif %}\n\n  {{ run_hooks(post_hooks) }}\n\n  {% set target_relation = this.incorporate(type='table') %}\n\n  {% set should_revoke = should_revoke(existing_relation, full_refresh_mode) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.load_relation", "macro.dbt.make_temp_relation", "macro.dbt_bigquery.dbt_bigquery_validate_get_incremental_strategy", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt_bigquery.bq_create_table_as", "macro.dbt.process_schema_changes", "macro.dbt_bigquery.bq_generate_incremental_build_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.288665, "supported_languages": ["sql", "python"]}, "macro.dbt_bigquery.bigquery__snapshot_hash_arguments": {"name": "bigquery__snapshot_hash_arguments", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "unique_id": "macro.dbt_bigquery.bigquery__snapshot_hash_arguments", "macro_sql": "{% macro bigquery__snapshot_hash_arguments(args) -%}\n  to_hex(md5(concat({%- for arg in args -%}\n    coalesce(cast({{ arg }} as string), ''){% if not loop.last %}, '|',{% endif -%}\n  {%- endfor -%}\n  )))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.289085, "supported_languages": null}, "macro.dbt_bigquery.bigquery__create_columns": {"name": "bigquery__create_columns", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "unique_id": "macro.dbt_bigquery.bigquery__create_columns", "macro_sql": "{% macro bigquery__create_columns(relation, columns) %}\n  {{ adapter.alter_table_add_columns(relation, columns) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.289244, "supported_languages": null}, "macro.dbt_bigquery.bigquery__post_snapshot": {"name": "bigquery__post_snapshot", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "unique_id": "macro.dbt_bigquery.bigquery__post_snapshot", "macro_sql": "{% macro bigquery__post_snapshot(staging_relation) %}\n  -- Clean up the snapshot temp table\n  {% do drop_relation(staging_relation) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.289381, "supported_languages": null}, "macro.dbt_bigquery.bigquery__can_clone_table": {"name": "bigquery__can_clone_table", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/clone.sql", "original_file_path": "macros/materializations/clone.sql", "unique_id": "macro.dbt_bigquery.bigquery__can_clone_table", "macro_sql": "{% macro bigquery__can_clone_table() %}\n    {{ return(True) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.289577, "supported_languages": null}, "macro.dbt_bigquery.bigquery__create_or_replace_clone": {"name": "bigquery__create_or_replace_clone", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/clone.sql", "original_file_path": "macros/materializations/clone.sql", "unique_id": "macro.dbt_bigquery.bigquery__create_or_replace_clone", "macro_sql": "{% macro bigquery__create_or_replace_clone(this_relation, defer_relation) %}\n    create or replace\n      table {{ this_relation }}\n      clone {{ defer_relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.289713, "supported_languages": null}, "macro.dbt_bigquery.bq_generate_incremental_merge_build_sql": {"name": "bq_generate_incremental_merge_build_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/merge.sql", "original_file_path": "macros/materializations/incremental_strategy/merge.sql", "unique_id": "macro.dbt_bigquery.bq_generate_incremental_merge_build_sql", "macro_sql": "{% macro bq_generate_incremental_merge_build_sql(\n    tmp_relation, target_relation, sql, unique_key, partition_by, dest_columns, tmp_relation_exists, incremental_predicates\n) %}\n    {%- set source_sql -%}\n        {%- if tmp_relation_exists -%}\n        (\n        select\n        {% if partition_by.time_ingestion_partitioning -%}\n        {{ partition_by.insertable_time_partitioning_field() }},\n        {%- endif -%}\n        * from {{ tmp_relation }}\n        )\n        {%- else -%} {#-- wrap sql in parens to make it a subquery --#}\n        (\n            {%- if partition_by.time_ingestion_partitioning -%}\n            {{ wrap_with_time_ingestion_partitioning_sql(partition_by, sql, True) }}\n            {%- else -%}\n            {{sql}}\n            {%- endif %}\n        )\n        {%- endif -%}\n    {%- endset -%}\n\n    {% set build_sql = get_merge_sql(target_relation, source_sql, unique_key, dest_columns, incremental_predicates) %}\n\n    {{ return(build_sql) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.wrap_with_time_ingestion_partitioning_sql", "macro.dbt.get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.2906299, "supported_languages": null}, "macro.dbt_bigquery.declare_dbt_max_partition": {"name": "declare_dbt_max_partition", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/common.sql", "original_file_path": "macros/materializations/incremental_strategy/common.sql", "unique_id": "macro.dbt_bigquery.declare_dbt_max_partition", "macro_sql": "{% macro declare_dbt_max_partition(relation, partition_by, compiled_code, language='sql') %}\n\n  {#-- TODO: revisit partitioning with python models --#}\n  {%- if '_dbt_max_partition' in compiled_code and language == 'sql' -%}\n\n    declare _dbt_max_partition {{ partition_by.data_type_for_partition() }} default (\n      select max({{ partition_by.field }}) from {{ this }}\n      where {{ partition_by.field }} is not null\n    );\n\n  {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.2910762, "supported_languages": null}, "macro.dbt_bigquery.bq_generate_incremental_insert_overwrite_build_sql": {"name": "bq_generate_incremental_insert_overwrite_build_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "original_file_path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "unique_id": "macro.dbt_bigquery.bq_generate_incremental_insert_overwrite_build_sql", "macro_sql": "{% macro bq_generate_incremental_insert_overwrite_build_sql(\n    tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists, copy_partitions\n) %}\n    {% if partition_by is none %}\n      {% set missing_partition_msg -%}\n      The 'insert_overwrite' strategy requires the `partition_by` config.\n      {%- endset %}\n      {% do exceptions.raise_compiler_error(missing_partition_msg) %}\n    {% endif %}\n\n    {% set build_sql = bq_insert_overwrite_sql(\n        tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists, copy_partitions\n    ) %}\n\n    {{ return(build_sql) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bq_insert_overwrite_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.293974, "supported_languages": null}, "macro.dbt_bigquery.bq_copy_partitions": {"name": "bq_copy_partitions", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "original_file_path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "unique_id": "macro.dbt_bigquery.bq_copy_partitions", "macro_sql": "{% macro bq_copy_partitions(tmp_relation, target_relation, partitions, partition_by) %}\n\n  {% for partition in partitions %}\n    {% if partition_by.data_type == 'int64' %}\n      {% set partition = partition | as_text %}\n    {% elif partition_by.granularity == 'hour' %}\n      {% set partition = partition.strftime(\"%Y%m%d%H\") %}\n    {% elif partition_by.granularity == 'day' %}\n      {% set partition = partition.strftime(\"%Y%m%d\") %}\n    {% elif partition_by.granularity == 'month' %}\n      {% set partition = partition.strftime(\"%Y%m\") %}\n    {% elif partition_by.granularity == 'year' %}\n      {% set partition = partition.strftime(\"%Y\") %}\n    {% endif %}\n    {% set tmp_relation_partitioned = api.Relation.create(database=tmp_relation.database, schema=tmp_relation.schema, identifier=tmp_relation.table ~ '$' ~ partition, type=tmp_relation.type) %}\n    {% set target_relation_partitioned = api.Relation.create(database=target_relation.database, schema=target_relation.schema, identifier=target_relation.table ~ '$' ~ partition, type=target_relation.type) %}\n    {% do adapter.copy_table(tmp_relation_partitioned, target_relation_partitioned, \"table\") %}\n  {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.295309, "supported_languages": null}, "macro.dbt_bigquery.bq_insert_overwrite_sql": {"name": "bq_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "original_file_path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "unique_id": "macro.dbt_bigquery.bq_insert_overwrite_sql", "macro_sql": "{% macro bq_insert_overwrite_sql(\n    tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists, copy_partitions\n) %}\n  {% if partitions is not none and partitions != [] %} {# static #}\n      {{ bq_static_insert_overwrite_sql(tmp_relation, target_relation, sql, partition_by, partitions, dest_columns, tmp_relation_exists, copy_partitions) }}\n  {% else %} {# dynamic #}\n      {{ bq_dynamic_insert_overwrite_sql(tmp_relation, target_relation, sql, unique_key, partition_by, dest_columns, tmp_relation_exists, copy_partitions) }}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bq_static_insert_overwrite_sql", "macro.dbt_bigquery.bq_dynamic_insert_overwrite_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.295881, "supported_languages": null}, "macro.dbt_bigquery.bq_static_insert_overwrite_sql": {"name": "bq_static_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "original_file_path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "unique_id": "macro.dbt_bigquery.bq_static_insert_overwrite_sql", "macro_sql": "{% macro bq_static_insert_overwrite_sql(\n    tmp_relation, target_relation, sql, partition_by, partitions, dest_columns, tmp_relation_exists, copy_partitions\n) %}\n\n      {% set predicate -%}\n          {{ partition_by.render_wrapped(alias='DBT_INTERNAL_DEST') }} in (\n              {{ partitions | join (', ') }}\n          )\n      {%- endset %}\n\n      {%- set source_sql -%}\n        (\n          {% if partition_by.time_ingestion_partitioning and tmp_relation_exists -%}\n          select\n            {{ partition_by.insertable_time_partitioning_field() }},\n            * from {{ tmp_relation }}\n          {% elif tmp_relation_exists -%}\n            select\n            * from {{ tmp_relation }}\n          {%- elif partition_by.time_ingestion_partitioning -%}\n            {{ wrap_with_time_ingestion_partitioning_sql(partition_by, sql, True) }}\n          {%- else -%}\n            {{sql}}\n          {%- endif -%}\n\n        )\n      {%- endset -%}\n\n      {% if copy_partitions %}\n          {% do bq_copy_partitions(tmp_relation, target_relation, partitions, partition_by) %}\n      {% else %}\n\n      {#-- In case we're putting the model SQL _directly_ into the MERGE statement,\n         we need to prepend the MERGE statement with the user-configured sql_header,\n         which may be needed to resolve that model SQL (e.g. referencing a variable or UDF in the header)\n         in the \"temporary table exists\" case, we save the model SQL result as a temp table first, wherein the\n         sql_header is included by the create_table_as macro.\n      #}\n      -- 1. run the merge statement\n      {{ get_insert_overwrite_merge_sql(target_relation, source_sql, dest_columns, [predicate], include_sql_header = not tmp_relation_exists) }};\n\n      {%- if tmp_relation_exists -%}\n      -- 2. clean up the temp table\n      drop table if exists {{ tmp_relation }};\n      {%- endif -%}\n\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.wrap_with_time_ingestion_partitioning_sql", "macro.dbt_bigquery.bq_copy_partitions", "macro.dbt.get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.296902, "supported_languages": null}, "macro.dbt_bigquery.bq_dynamic_copy_partitions_insert_overwrite_sql": {"name": "bq_dynamic_copy_partitions_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "original_file_path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "unique_id": "macro.dbt_bigquery.bq_dynamic_copy_partitions_insert_overwrite_sql", "macro_sql": "{% macro bq_dynamic_copy_partitions_insert_overwrite_sql(\n  tmp_relation, target_relation, sql, unique_key, partition_by, dest_columns, tmp_relation_exists, copy_partitions\n  ) %}\n  {%- if tmp_relation_exists is false -%}\n  {# We run temp table creation in a separated script to move to partitions copy if it doesn't already exist #}\n    {%- call statement('create_tmp_relation_for_copy', language='sql') -%}\n      {{ bq_create_table_as(partition_by, True, tmp_relation, sql, 'sql')\n    }}\n    {%- endcall %}\n  {%- endif -%}\n  {%- set partitions_sql -%}\n    select distinct {{ partition_by.render_wrapped() }}\n    from {{ tmp_relation }}\n  {%- endset -%}\n  {%- set partitions = run_query(partitions_sql).columns[0].values() -%}\n  {# We copy the partitions #}\n  {%- do bq_copy_partitions(tmp_relation, target_relation, partitions, partition_by) -%}\n  -- Clean up the temp table\n  drop table if exists {{ tmp_relation }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_bigquery.bq_create_table_as", "macro.dbt.run_query", "macro.dbt_bigquery.bq_copy_partitions"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.29761, "supported_languages": null}, "macro.dbt_bigquery.bq_dynamic_insert_overwrite_sql": {"name": "bq_dynamic_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "original_file_path": "macros/materializations/incremental_strategy/insert_overwrite.sql", "unique_id": "macro.dbt_bigquery.bq_dynamic_insert_overwrite_sql", "macro_sql": "{% macro bq_dynamic_insert_overwrite_sql(tmp_relation, target_relation, sql, unique_key, partition_by, dest_columns, tmp_relation_exists, copy_partitions) %}\n  {%- if copy_partitions is true %}\n     {{ bq_dynamic_copy_partitions_insert_overwrite_sql(tmp_relation, target_relation, sql, unique_key, partition_by, dest_columns, tmp_relation_exists, copy_partitions) }}\n  {% else -%}\n      {% set predicate -%}\n          {{ partition_by.render_wrapped(alias='DBT_INTERNAL_DEST') }} in unnest(dbt_partitions_for_replacement)\n      {%- endset %}\n\n      {%- set source_sql -%}\n      (\n        select\n        {% if partition_by.time_ingestion_partitioning -%}\n        {{ partition_by.insertable_time_partitioning_field() }},\n        {%- endif -%}\n        * from {{ tmp_relation }}\n      )\n      {%- endset -%}\n\n      -- generated script to merge partitions into {{ target_relation }}\n      declare dbt_partitions_for_replacement array<{{ partition_by.data_type_for_partition() }}>;\n\n      {# have we already created the temp table to check for schema changes? #}\n      {% if not tmp_relation_exists %}\n       -- 1. create a temp table with model data\n        {{ bq_create_table_as(partition_by, True, tmp_relation, sql, 'sql') }}\n      {% else %}\n        -- 1. temp table already exists, we used it to check for schema changes\n      {% endif %}\n      {%- set partition_field = partition_by.time_partitioning_field() if partition_by.time_ingestion_partitioning else partition_by.render_wrapped() -%}\n\n      -- 2. define partitions to update\n      set (dbt_partitions_for_replacement) = (\n          select as struct\n              -- IGNORE NULLS: this needs to be aligned to _dbt_max_partition, which ignores null\n              array_agg(distinct {{ partition_field }} IGNORE NULLS)\n          from {{ tmp_relation }}\n      );\n\n      -- 3. run the merge statement\n      {{ get_insert_overwrite_merge_sql(target_relation, source_sql, dest_columns, [predicate]) }};\n\n      -- 4. clean up the temp table\n      drop table if exists {{ tmp_relation }}\n\n  {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bq_dynamic_copy_partitions_insert_overwrite_sql", "macro.dbt_bigquery.bq_create_table_as", "macro.dbt.get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.2987509, "supported_languages": null}, "macro.dbt_bigquery.wrap_with_time_ingestion_partitioning_sql": {"name": "wrap_with_time_ingestion_partitioning_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "original_file_path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "unique_id": "macro.dbt_bigquery.wrap_with_time_ingestion_partitioning_sql", "macro_sql": "{% macro wrap_with_time_ingestion_partitioning_sql(partition_by, sql, is_nested) %}\n\n  select TIMESTAMP({{ partition_by.field }}) as {{ partition_by.insertable_time_partitioning_field() }}, * EXCEPT({{ partition_by.field }}) from (\n    {{ sql }}\n  ){%- if not is_nested -%};{%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.300159, "supported_languages": null}, "macro.dbt_bigquery.get_quoted_with_types_csv": {"name": "get_quoted_with_types_csv", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "original_file_path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "unique_id": "macro.dbt_bigquery.get_quoted_with_types_csv", "macro_sql": "{% macro get_quoted_with_types_csv(columns) %}\n    {% set quoted = [] %}\n    {% for col in columns -%}\n        {%- do quoted.append(adapter.quote(col.name) ~ \" \" ~ col.data_type) -%}\n    {%- endfor %}\n    {%- set dest_cols_csv = quoted | join(', ') -%}\n    {{ return(dest_cols_csv) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3005812, "supported_languages": null}, "macro.dbt_bigquery.columns_without_partition_fields_csv": {"name": "columns_without_partition_fields_csv", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "original_file_path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "unique_id": "macro.dbt_bigquery.columns_without_partition_fields_csv", "macro_sql": "{% macro columns_without_partition_fields_csv(partition_config, columns) -%}\n  {%- set columns_no_partition = partition_config.reject_partition_field_column(columns) -%}\n  {% set columns_names = get_quoted_with_types_csv(columns_no_partition) %}\n  {{ return(columns_names) }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_bigquery.get_quoted_with_types_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.300837, "supported_languages": null}, "macro.dbt_bigquery.bq_insert_into_ingestion_time_partitioned_table_sql": {"name": "bq_insert_into_ingestion_time_partitioned_table_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "original_file_path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "unique_id": "macro.dbt_bigquery.bq_insert_into_ingestion_time_partitioned_table_sql", "macro_sql": "{% macro bq_insert_into_ingestion_time_partitioned_table_sql(target_relation, sql) -%}\n  {%- set sql_header = config.get('sql_header', none) -%}\n  {{ sql_header if sql_header is not none }}\n  {%- set raw_partition_by = config.get('partition_by', none) -%}\n  {%- set partition_by = adapter.parse_partition_by(raw_partition_by) -%}\n  {% set dest_columns = adapter.get_columns_in_relation(target_relation) %}\n  {%- set dest_columns_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n  insert into {{ target_relation }} ({{ partition_by.insertable_time_partitioning_field() }}, {{ dest_columns_csv }})\n    {{ wrap_with_time_ingestion_partitioning_sql(partition_by, sql, False) }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.get_quoted_csv", "macro.dbt_bigquery.wrap_with_time_ingestion_partitioning_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.301503, "supported_languages": null}, "macro.dbt_bigquery.get_columns_with_types_in_query_sql": {"name": "get_columns_with_types_in_query_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "original_file_path": "macros/materializations/incremental_strategy/time_ingestion_tables.sql", "unique_id": "macro.dbt_bigquery.get_columns_with_types_in_query_sql", "macro_sql": "{% macro get_columns_with_types_in_query_sql(select_sql) %}\n  {% set sql %}\n    {%- set sql_header = config.get('sql_header', none) -%}\n    {{ sql_header if sql_header is not none }}\n    select * from (\n      {{ select_sql }}\n    ) as __dbt_sbq\n    where false\n    limit 0\n  {% endset %}\n  {{ return(adapter.get_columns_in_select_sql(sql)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.301857, "supported_languages": null}, "macro.dbt_bigquery.bigquery__drop_relation": {"name": "bigquery__drop_relation", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt_bigquery.bigquery__drop_relation", "macro_sql": "{% macro bigquery__drop_relation(relation) -%}\n    {% do adapter.drop_relation(relation) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.302033, "supported_languages": null}, "macro.dbt_bigquery.bigquery_options": {"name": "bigquery_options", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/options.sql", "original_file_path": "macros/relations/options.sql", "unique_id": "macro.dbt_bigquery.bigquery_options", "macro_sql": "{% macro bigquery_options(opts) %}\n  {% set options -%}\n    OPTIONS({% for opt_key, opt_val in opts.items() %}\n      {{ opt_key }}={{ opt_val }}{{ \",\" if not loop.last }}\n    {% endfor %})\n  {%- endset %}\n  {%- do return(options) -%}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.302491, "supported_languages": null}, "macro.dbt_bigquery.cluster_by": {"name": "cluster_by", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/cluster.sql", "original_file_path": "macros/relations/cluster.sql", "unique_id": "macro.dbt_bigquery.cluster_by", "macro_sql": "{% macro cluster_by(raw_cluster_by) %}\n  {%- if raw_cluster_by is not none -%}\n  cluster by {% if raw_cluster_by is string -%}\n    {% set raw_cluster_by = [raw_cluster_by] %}\n  {%- endif -%}\n  {%- for cluster in raw_cluster_by -%}\n    {{ cluster }}\n    {%- if not loop.last -%}, {% endif -%}\n  {%- endfor -%}\n\n  {% endif %}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3029702, "supported_languages": null}, "macro.dbt_bigquery.bigquery__rename_relation": {"name": "bigquery__rename_relation", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt_bigquery.bigquery__rename_relation", "macro_sql": "{% macro bigquery__rename_relation(from_relation, to_relation) -%}\n  {% do adapter.rename_relation(from_relation, to_relation) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.303172, "supported_languages": null}, "macro.dbt_bigquery.partition_by": {"name": "partition_by", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/partition.sql", "original_file_path": "macros/relations/partition.sql", "unique_id": "macro.dbt_bigquery.partition_by", "macro_sql": "{% macro partition_by(partition_config) -%}\n    {%- if partition_config is none -%}\n      {% do return('') %}\n    {%- elif partition_config.time_ingestion_partitioning -%}\n        partition by {{ partition_config.render_wrapped() }}\n    {%- elif partition_config.data_type | lower in ('date','timestamp','datetime') -%}\n        partition by {{ partition_config.render() }}\n    {%- elif partition_config.data_type | lower in ('int64') -%}\n        {%- set range = partition_config.range -%}\n        partition by range_bucket(\n            {{ partition_config.field }},\n            generate_array({{ range.start}}, {{ range.end }}, {{ range.interval }})\n        )\n    {%- endif -%}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3040352, "supported_languages": null}, "macro.dbt_bigquery.bigquery__drop_materialized_view": {"name": "bigquery__drop_materialized_view", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/materialized_view/drop.sql", "original_file_path": "macros/relations/materialized_view/drop.sql", "unique_id": "macro.dbt_bigquery.bigquery__drop_materialized_view", "macro_sql": "{% macro bigquery__drop_materialized_view(relation) %}\n    drop materialized view if exists {{ relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.304186, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_replace_materialized_view_as_sql": {"name": "bigquery__get_replace_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/materialized_view/replace.sql", "original_file_path": "macros/relations/materialized_view/replace.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_replace_materialized_view_as_sql", "macro_sql": "{% macro bigquery__get_replace_materialized_view_as_sql(relation, sql) %}\n\n    {%- set materialized_view = adapter.Relation.materialized_view_from_model_node(config.model) -%}\n\n    create or replace materialized view if not exists {{ relation }}\n    {% if materialized_view.partition %}{{ partition_by(materialized_view.partition) }}{% endif %}\n    {% if materialized_view.cluster %}{{ cluster_by(materialized_view.cluster.fields) }}{% endif %}\n    {{ bigquery_options(materialized_view.options.as_ddl_dict()) }}\n    as {{ sql }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.partition_by", "macro.dbt_bigquery.cluster_by", "macro.dbt_bigquery.bigquery_options"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.304814, "supported_languages": null}, "macro.dbt_bigquery.bigquery__refresh_materialized_view": {"name": "bigquery__refresh_materialized_view", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/materialized_view/refresh.sql", "original_file_path": "macros/relations/materialized_view/refresh.sql", "unique_id": "macro.dbt_bigquery.bigquery__refresh_materialized_view", "macro_sql": "{% macro bigquery__refresh_materialized_view(relation) %}\n    call bq.refresh_materialized_view('{{ relation.database }}.{{ relation.schema }}.{{ relation.identifier }}')\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.305032, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_alter_materialized_view_as_sql": {"name": "bigquery__get_alter_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_alter_materialized_view_as_sql", "macro_sql": "{% macro bigquery__get_alter_materialized_view_as_sql(\n    relation,\n    configuration_changes,\n    sql,\n    existing_relation,\n    backup_relation,\n    intermediate_relation\n) %}\n\n    {% if configuration_changes.requires_full_refresh %}\n        {{ get_replace_sql(existing_relation, relation, sql) }}\n    {% else %}\n\n        alter materialized view {{ relation }}\n            set {{ bigquery_options(configuration_changes.options.context.as_ddl_dict()) }}\n\n    {%- endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_replace_sql", "macro.dbt_bigquery.bigquery_options"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.30562, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_materialized_view_configuration_changes": {"name": "bigquery__get_materialized_view_configuration_changes", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_materialized_view_configuration_changes", "macro_sql": "{% macro bigquery__get_materialized_view_configuration_changes(existing_relation, new_config) %}\n    {% set _existing_materialized_view = adapter.describe_relation(existing_relation) %}\n    {% set _configuration_changes = existing_relation.materialized_view_config_changeset(_existing_materialized_view, new_config) %}\n    {% do return(_configuration_changes) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.30593, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_create_materialized_view_as_sql": {"name": "bigquery__get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/materialized_view/create.sql", "original_file_path": "macros/relations/materialized_view/create.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_create_materialized_view_as_sql", "macro_sql": "{% macro bigquery__get_create_materialized_view_as_sql(relation, sql) %}\n\n    {%- set materialized_view = adapter.Relation.materialized_view_from_model_node(config.model) -%}\n\n    create materialized view if not exists {{ relation }}\n    {% if materialized_view.partition %}{{ partition_by(materialized_view.partition) }}{% endif %}\n    {% if materialized_view.cluster %}{{ cluster_by(materialized_view.cluster.fields) }}{% endif %}\n    {{ bigquery_options(materialized_view.options.as_ddl_dict()) }}\n    as {{ sql }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.partition_by", "macro.dbt_bigquery.cluster_by", "macro.dbt_bigquery.bigquery_options"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.306551, "supported_languages": null}, "macro.dbt_bigquery.bigquery__drop_table": {"name": "bigquery__drop_table", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt_bigquery.bigquery__drop_table", "macro_sql": "{% macro bigquery__drop_table(relation) %}\n    drop table if exists {{ relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3066921, "supported_languages": null}, "macro.dbt_bigquery.bigquery_table_options": {"name": "bigquery_table_options", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/table/options.sql", "original_file_path": "macros/relations/table/options.sql", "unique_id": "macro.dbt_bigquery.bigquery_table_options", "macro_sql": "{% macro bigquery_table_options(config, node, temporary) %}\n  {% set opts = adapter.get_table_options(config, node, temporary) %}\n  {%- do return(bigquery_options(opts)) -%}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery_options"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.306989, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_rename_table_sql": {"name": "bigquery__get_rename_table_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_rename_table_sql", "macro_sql": "{%- macro bigquery__get_rename_table_sql(relation, new_name) -%}\n    alter table {{ relation }} rename to {{ new_name }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3071811, "supported_languages": null}, "macro.dbt_bigquery.bigquery__drop_view": {"name": "bigquery__drop_view", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt_bigquery.bigquery__drop_view", "macro_sql": "{% macro bigquery__drop_view(relation) %}\n    drop view if exists {{ relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.30732, "supported_languages": null}, "macro.dbt_bigquery.bigquery__create_or_replace_view": {"name": "bigquery__create_or_replace_view", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt_bigquery.bigquery__create_or_replace_view", "macro_sql": "{% macro bigquery__create_or_replace_view() %}\n  {%- set identifier = model['alias'] -%}\n\n  {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n  {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n  {%- set target_relation = api.Relation.create(\n      identifier=identifier, schema=schema, database=database,\n      type='view') -%}\n  {% set grant_config = config.get('grants') %}\n\n  {{ run_hooks(pre_hooks) }}\n\n  -- If there's a table with the same name and we weren't told to full refresh,\n  -- that's an error. If we were told to full refresh, drop it. This behavior differs\n  -- for Snowflake and BigQuery, so multiple dispatch is used.\n  {%- if old_relation is not none and not old_relation.is_view -%}\n    {{ handle_existing_table(should_full_refresh(), old_relation) }}\n  {%- endif -%}\n\n  -- build model\n  {% call statement('main') -%}\n    {{ get_create_view_as_sql(target_relation, sql) }}\n  {%- endcall %}\n\n  {% set should_revoke = should_revoke(exists_as_view, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {{ run_hooks(post_hooks) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt_bigquery.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3091478, "supported_languages": null}, "macro.dbt_bigquery.handle_existing_table": {"name": "handle_existing_table", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt_bigquery.handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n    {{ adapter.dispatch('handle_existing_table', 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__handle_existing_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.309356, "supported_languages": null}, "macro.dbt_bigquery.default__handle_existing_table": {"name": "default__handle_existing_table", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt_bigquery.default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n    {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n    {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.30959, "supported_languages": null}, "macro.dbt_bigquery.bigquery_view_options": {"name": "bigquery_view_options", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/view/options.sql", "original_file_path": "macros/relations/view/options.sql", "unique_id": "macro.dbt_bigquery.bigquery_view_options", "macro_sql": "{% macro bigquery_view_options(config, node) %}\n  {% set opts = adapter.get_view_options(config, node) %}\n  {%- do return(bigquery_options(opts)) -%}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery_options"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.309881, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_rename_view_sql": {"name": "bigquery__get_rename_view_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_rename_view_sql", "macro_sql": "{%- macro bigquery__get_rename_view_sql(relation, new_name) -%}\n    alter view {{ relation }} rename to {{ new_name }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.310053, "supported_languages": null}, "macro.dbt_bigquery.bigquery__except": {"name": "bigquery__except", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/except.sql", "original_file_path": "macros/utils/except.sql", "unique_id": "macro.dbt_bigquery.bigquery__except", "macro_sql": "{% macro bigquery__except() %}\n\n    except distinct\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.310154, "supported_languages": null}, "macro.dbt_bigquery.bigquery__dateadd": {"name": "bigquery__dateadd", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/dateadd.sql", "original_file_path": "macros/utils/dateadd.sql", "unique_id": "macro.dbt_bigquery.bigquery__dateadd", "macro_sql": "{% macro bigquery__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n        datetime_add(\n            cast( {{ from_date_or_timestamp }} as datetime),\n        interval {{ interval }} {{ datepart }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.310377, "supported_languages": null}, "macro.dbt_bigquery.bigquery__current_timestamp": {"name": "bigquery__current_timestamp", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_bigquery.bigquery__current_timestamp", "macro_sql": "{% macro bigquery__current_timestamp() -%}\n  current_timestamp()\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.310546, "supported_languages": null}, "macro.dbt_bigquery.bigquery__snapshot_string_as_time": {"name": "bigquery__snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_bigquery.bigquery__snapshot_string_as_time", "macro_sql": "{% macro bigquery__snapshot_string_as_time(timestamp) -%}\n    {%- set result = 'TIMESTAMP(\"' ~ timestamp ~ '\")' -%}\n    {{ return(result) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.310727, "supported_languages": null}, "macro.dbt_bigquery.bigquery__current_timestamp_backcompat": {"name": "bigquery__current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_bigquery.bigquery__current_timestamp_backcompat", "macro_sql": "{% macro bigquery__current_timestamp_backcompat() -%}\n  current_timestamp\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.310803, "supported_languages": null}, "macro.dbt_bigquery.bigquery__intersect": {"name": "bigquery__intersect", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/intersect.sql", "original_file_path": "macros/utils/intersect.sql", "unique_id": "macro.dbt_bigquery.bigquery__intersect", "macro_sql": "{% macro bigquery__intersect() %}\n\n    intersect distinct\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.310904, "supported_languages": null}, "macro.dbt_bigquery.bigquery__escape_single_quotes": {"name": "bigquery__escape_single_quotes", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt_bigquery.bigquery__escape_single_quotes", "macro_sql": "{% macro bigquery__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\", \"\\\\'\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.311091, "supported_languages": null}, "macro.dbt_bigquery.bigquery__format_column": {"name": "bigquery__format_column", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/get_columns_spec_ddl.sql", "original_file_path": "macros/utils/get_columns_spec_ddl.sql", "unique_id": "macro.dbt_bigquery.bigquery__format_column", "macro_sql": "{% macro bigquery__format_column(column) -%}\n  {% set data_type = column.data_type %}\n  {% set formatted = column.column.lower() ~ \" \" ~ data_type %}\n  {{ return({'name': column.name, 'data_type': data_type, 'formatted': formatted}) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.311947, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_empty_schema_sql": {"name": "bigquery__get_empty_schema_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/get_columns_spec_ddl.sql", "original_file_path": "macros/utils/get_columns_spec_ddl.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_empty_schema_sql", "macro_sql": "{% macro bigquery__get_empty_schema_sql(columns) %}\n    {%- set col_err = [] -%}\n    {% for col in columns.values() %}\n      {%- if col['data_type'] is not defined -%}\n        {{ col_err.append(col['name']) }}\n      {%- endif -%}\n    {%- endfor -%}\n    {%- if (col_err | length) > 0 -%}\n      {{ exceptions.column_type_missing(column_names=col_err) }}\n    {%- endif -%}\n\n    {%- set columns = adapter.nest_column_data_types(columns) -%}\n    {{ return(dbt.default__get_empty_schema_sql(columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_empty_schema_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.312547, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_select_subquery": {"name": "bigquery__get_select_subquery", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/get_columns_spec_ddl.sql", "original_file_path": "macros/utils/get_columns_spec_ddl.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_select_subquery", "macro_sql": "{% macro bigquery__get_select_subquery(sql) %}\n    select {{ adapter.dispatch('get_column_names')() }}\n    from (\n        {{ sql }}\n    ) as model_subq\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_column_names"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.312721, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_column_names": {"name": "bigquery__get_column_names", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/get_columns_spec_ddl.sql", "original_file_path": "macros/utils/get_columns_spec_ddl.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_column_names", "macro_sql": "{% macro bigquery__get_column_names() %}\n  {#- loop through nested user_provided_columns to get column names -#}\n    {%- set user_provided_columns = adapter.nest_column_data_types(model['columns']) -%}\n    {%- for i in user_provided_columns %}\n      {%- set col = user_provided_columns[i] -%}\n      {%- set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] -%}\n      {{ col_name }}{{ \", \" if not loop.last }}\n    {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.31321, "supported_languages": null}, "macro.dbt_bigquery.bigquery__right": {"name": "bigquery__right", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt_bigquery.bigquery__right", "macro_sql": "{% macro bigquery__right(string_text, length_expression) %}\n\n    case when {{ length_expression }} = 0\n        then ''\n    else\n        substr(\n            {{ string_text }},\n            -1 * ({{ length_expression }})\n        )\n    end\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.313476, "supported_languages": null}, "macro.dbt_bigquery.bigquery__listagg": {"name": "bigquery__listagg", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/listagg.sql", "original_file_path": "macros/utils/listagg.sql", "unique_id": "macro.dbt_bigquery.bigquery__listagg", "macro_sql": "{% macro bigquery__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n    string_agg(\n        {{ measure }},\n        {{ delimiter_text }}\n        {% if order_by_clause -%}\n        {{ order_by_clause }}\n        {%- endif %}\n        {% if limit_num -%}\n        limit {{ limit_num }}\n        {%- endif %}\n        )\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.313876, "supported_languages": null}, "macro.dbt_bigquery.bigquery__datediff": {"name": "bigquery__datediff", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/datediff.sql", "original_file_path": "macros/utils/datediff.sql", "unique_id": "macro.dbt_bigquery.bigquery__datediff", "macro_sql": "{% macro bigquery__datediff(first_date, second_date, datepart) -%}\n\n  {% if dbt_version[0] == 1 and dbt_version[2] >= 2 %}\n    {{ return(dbt.datediff(first_date, second_date, datepart)) }}\n  {% else %}\n\n    datetime_diff(\n        cast({{second_date}} as datetime),\n        cast({{first_date}} as datetime),\n        {{datepart}}\n    )\n\n  {% endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.314396, "supported_languages": null}, "macro.dbt_bigquery.bigquery__safe_cast": {"name": "bigquery__safe_cast", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt_bigquery.bigquery__safe_cast", "macro_sql": "{% macro bigquery__safe_cast(field, type) %}\n    safe_cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.314563, "supported_languages": null}, "macro.dbt_bigquery.bigquery__hash": {"name": "bigquery__hash", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/hash.sql", "original_file_path": "macros/utils/hash.sql", "unique_id": "macro.dbt_bigquery.bigquery__hash", "macro_sql": "{% macro bigquery__hash(field) -%}\n    to_hex({{dbt.default__hash(field)}})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.314734, "supported_languages": null}, "macro.dbt_bigquery.bigquery__position": {"name": "bigquery__position", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/position.sql", "original_file_path": "macros/utils/position.sql", "unique_id": "macro.dbt_bigquery.bigquery__position", "macro_sql": "{% macro bigquery__position(substring_text, string_text) %}\n\n    strpos(\n        {{ string_text }},\n        {{ substring_text }}\n\n    )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.314977, "supported_languages": null}, "macro.dbt_bigquery.bigquery__array_concat": {"name": "bigquery__array_concat", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/array_concat.sql", "original_file_path": "macros/utils/array_concat.sql", "unique_id": "macro.dbt_bigquery.bigquery__array_concat", "macro_sql": "{% macro bigquery__array_concat(array_1, array_2) -%}\n    array_concat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.315147, "supported_languages": null}, "macro.dbt_bigquery.bigquery__bool_or": {"name": "bigquery__bool_or", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt_bigquery.bigquery__bool_or", "macro_sql": "{% macro bigquery__bool_or(expression) -%}\n\n    logical_or({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.31528, "supported_languages": null}, "macro.dbt_bigquery.bigquery__split_part": {"name": "bigquery__split_part", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt_bigquery.bigquery__split_part", "macro_sql": "{% macro bigquery__split_part(string_text, delimiter_text, part_number) %}\n\n  {% if part_number >= 0 %}\n    split(\n        {{ string_text }},\n        {{ delimiter_text }}\n        )[safe_offset({{ part_number - 1 }})]\n  {% else %}\n    split(\n        {{ string_text }},\n        {{ delimiter_text }}\n        )[safe_offset(\n          length({{ string_text }})\n          - length(\n              replace({{ string_text }},  {{ delimiter_text }}, '')\n          ) + 1 + {{ part_number }}\n        )]\n  {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3158982, "supported_languages": null}, "macro.dbt_bigquery.bigquery__date_trunc": {"name": "bigquery__date_trunc", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/date_trunc.sql", "original_file_path": "macros/utils/date_trunc.sql", "unique_id": "macro.dbt_bigquery.bigquery__date_trunc", "macro_sql": "{% macro bigquery__date_trunc(datepart, date) -%}\n    timestamp_trunc(\n        cast({{date}} as timestamp),\n        {{datepart}}\n    )\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.316077, "supported_languages": null}, "macro.dbt_bigquery.bigquery__array_construct": {"name": "bigquery__array_construct", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt_bigquery.bigquery__array_construct", "macro_sql": "{% macro bigquery__array_construct(inputs, data_type) -%}\n    {% if inputs|length > 0 %}\n    [ {{ inputs|join(' , ') }} ]\n    {% else %}\n    ARRAY<{{data_type}}>[]\n    {% endif %}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.316385, "supported_languages": null}, "macro.dbt_bigquery.bigquery__array_append": {"name": "bigquery__array_append", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/utils/array_append.sql", "original_file_path": "macros/utils/array_append.sql", "unique_id": "macro.dbt_bigquery.bigquery__array_append", "macro_sql": "{% macro bigquery__array_append(array, new_element) -%}\n    {{ array_concat(array, array_construct([new_element])) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.array_concat", "macro.dbt.array_construct"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.316591, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_show_grant_sql": {"name": "bigquery__get_show_grant_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_show_grant_sql", "macro_sql": "{% macro bigquery__get_show_grant_sql(relation) %}\n    {% set location = adapter.get_dataset_location(relation) %}\n    {% set relation = relation.incorporate(location=location) %}\n\n    select privilege_type, grantee\n    from {{ relation.information_schema(\"OBJECT_PRIVILEGES\") }}\n    where object_schema = \"{{ relation.dataset }}\"\n      and object_name = \"{{ relation.identifier }}\"\n      -- filter out current user\n      and split(grantee, ':')[offset(1)] != session_user()\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.317246, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_grant_sql": {"name": "bigquery__get_grant_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_grant_sql", "macro_sql": "\n\n\n{%- macro bigquery__get_grant_sql(relation, privilege, grantee) -%}\n    grant `{{ privilege }}` on {{ relation.type }} {{ relation }} to {{ '\\\"' + grantee|join('\\\", \\\"') + '\\\"' }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.317495, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_revoke_sql": {"name": "bigquery__get_revoke_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_revoke_sql", "macro_sql": "{%- macro bigquery__get_revoke_sql(relation, privilege, grantee) -%}\n    revoke `{{ privilege }}` on {{ relation.type }} {{ relation }} from {{ '\\\"' + grantee|join('\\\", \\\"') + '\\\"' }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.317743, "supported_languages": null}, "macro.dbt_bigquery.bigquery__get_empty_subquery_sql": {"name": "bigquery__get_empty_subquery_sql", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt_bigquery.bigquery__get_empty_subquery_sql", "macro_sql": "{% macro bigquery__get_empty_subquery_sql(select_sql, select_sql_header=none) %}\n    {%- if select_sql_header is not none -%}\n    {{ select_sql_header }}\n    {%- endif -%}\n    select * from (\n        {{ select_sql }}\n    ) as __dbt_sbq\n    where false and current_timestamp() = current_timestamp()\n    limit 0\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.318034, "supported_languages": null}, "macro.dbt_bigquery.bigquery__resolve_model_name": {"name": "bigquery__resolve_model_name", "resource_type": "macro", "package_name": "dbt_bigquery", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt_bigquery.bigquery__resolve_model_name", "macro_sql": "{% macro bigquery__resolve_model_name(input_model_name) -%}\n    {{ input_model_name | string | replace('`', '') | replace('\"', '\\\"') }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.31828, "supported_languages": null}, "macro.dbt.run_hooks": {"name": "run_hooks", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.run_hooks", "macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n  {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction)  %}\n    {% if not inside_transaction and loop.first %}\n      {% call statement(auto_begin=inside_transaction) %}\n        commit;\n      {% endcall %}\n    {% endif %}\n    {% set rendered = render(hook.get('sql')) | trim %}\n    {% if (rendered | length) > 0 %}\n      {% call statement(auto_begin=inside_transaction) %}\n        {{ rendered }}\n      {% endcall %}\n    {% endif %}\n  {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.319378, "supported_languages": null}, "macro.dbt.make_hook_config": {"name": "make_hook_config", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.make_hook_config", "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n    {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3195798, "supported_languages": null}, "macro.dbt.before_begin": {"name": "before_begin", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.before_begin", "macro_sql": "{% macro before_begin(sql) %}\n    {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.319734, "supported_languages": null}, "macro.dbt.in_transaction": {"name": "in_transaction", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.in_transaction", "macro_sql": "{% macro in_transaction(sql) %}\n    {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3198771, "supported_languages": null}, "macro.dbt.after_commit": {"name": "after_commit", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.after_commit", "macro_sql": "{% macro after_commit(sql) %}\n    {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.320023, "supported_languages": null}, "macro.dbt.set_sql_header": {"name": "set_sql_header", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.set_sql_header", "macro_sql": "{% macro set_sql_header(config) -%}\n  {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.320396, "supported_languages": null}, "macro.dbt.should_full_refresh": {"name": "should_full_refresh", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.should_full_refresh", "macro_sql": "{% macro should_full_refresh() %}\n  {% set config_full_refresh = config.get('full_refresh') %}\n  {% if config_full_refresh is none %}\n    {% set config_full_refresh = flags.FULL_REFRESH %}\n  {% endif %}\n  {% do return(config_full_refresh) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3207, "supported_languages": null}, "macro.dbt.should_store_failures": {"name": "should_store_failures", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.should_store_failures", "macro_sql": "{% macro should_store_failures() %}\n  {% set config_store_failures = config.get('store_failures') %}\n  {% if config_store_failures is none %}\n    {% set config_store_failures = flags.STORE_FAILURES %}\n  {% endif %}\n  {% do return(config_store_failures) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3210711, "supported_languages": null}, "macro.dbt.snapshot_merge_sql": {"name": "snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "unique_id": "macro.dbt.snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n  {{ adapter.dispatch('snapshot_merge_sql', 'dbt')(target, source, insert_cols) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__snapshot_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.321514, "supported_languages": null}, "macro.dbt.default__snapshot_merge_sql": {"name": "default__snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "unique_id": "macro.dbt.default__snapshot_merge_sql", "macro_sql": "{% macro default__snapshot_merge_sql(target, source, insert_cols) -%}\n    {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n    merge into {{ target }} as DBT_INTERNAL_DEST\n    using {{ source }} as DBT_INTERNAL_SOURCE\n    on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id\n\n    when matched\n     and DBT_INTERNAL_DEST.dbt_valid_to is null\n     and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n        then update\n        set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n\n    when not matched\n     and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'\n        then insert ({{ insert_cols_csv }})\n        values ({{ insert_cols_csv }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.321794, "supported_languages": null}, "macro.dbt.strategy_dispatch": {"name": "strategy_dispatch", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.strategy_dispatch", "macro_sql": "{% macro strategy_dispatch(name) -%}\n{% set original_name = name %}\n  {% if '.' in name %}\n    {% set package_name, name = name.split(\".\", 1) %}\n  {% else %}\n    {% set package_name = none %}\n  {% endif %}\n\n  {% if package_name is none %}\n    {% set package_context = context %}\n  {% elif package_name in context %}\n    {% set package_context = context[package_name] %}\n  {% else %}\n    {% set error_msg %}\n        Could not find package '{{package_name}}', called with '{{original_name}}'\n    {% endset %}\n    {{ exceptions.raise_compiler_error(error_msg | trim) }}\n  {% endif %}\n\n  {%- set search_name = 'snapshot_' ~ name ~ '_strategy' -%}\n\n  {% if search_name not in package_context %}\n    {% set error_msg %}\n        The specified strategy macro '{{name}}' was not found in package '{{ package_name }}'\n    {% endset %}\n    {{ exceptions.raise_compiler_error(error_msg | trim) }}\n  {% endif %}\n  {{ return(package_context[search_name]) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.325355, "supported_languages": null}, "macro.dbt.snapshot_hash_arguments": {"name": "snapshot_hash_arguments", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n  {{ adapter.dispatch('snapshot_hash_arguments', 'dbt')(args) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.325527, "supported_languages": null}, "macro.dbt.default__snapshot_hash_arguments": {"name": "default__snapshot_hash_arguments", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.default__snapshot_hash_arguments", "macro_sql": "{% macro default__snapshot_hash_arguments(args) -%}\n    md5({%- for arg in args -%}\n        coalesce(cast({{ arg }} as varchar ), '')\n        {% if not loop.last %} || '|' || {% endif %}\n    {%- endfor -%})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.325758, "supported_languages": null}, "macro.dbt.snapshot_timestamp_strategy": {"name": "snapshot_timestamp_strategy", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_timestamp_strategy", "macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n    {% set primary_key = config['unique_key'] %}\n    {% set updated_at = config['updated_at'] %}\n    {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n\n    {#/*\n        The snapshot relation might not have an {{ updated_at }} value if the\n        snapshot strategy is changed from `check` to `timestamp`. We\n        should use a dbt-created column for the comparison in the snapshot\n        table instead of assuming that the user-supplied {{ updated_at }}\n        will be present in the historical data.\n\n        See https://github.com/dbt-labs/dbt-core/issues/2350\n    */ #}\n    {% set row_changed_expr -%}\n        ({{ snapshotted_rel }}.dbt_valid_from < {{ current_rel }}.{{ updated_at }})\n    {%- endset %}\n\n    {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n    {% do return({\n        \"unique_key\": primary_key,\n        \"updated_at\": updated_at,\n        \"row_changed\": row_changed_expr,\n        \"scd_id\": scd_id_expr,\n        \"invalidate_hard_deletes\": invalidate_hard_deletes\n    }) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.326495, "supported_languages": null}, "macro.dbt.snapshot_string_as_time": {"name": "snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n    {{ adapter.dispatch('snapshot_string_as_time', 'dbt')(timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__snapshot_string_as_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.326668, "supported_languages": null}, "macro.dbt.default__snapshot_string_as_time": {"name": "default__snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.default__snapshot_string_as_time", "macro_sql": "{% macro default__snapshot_string_as_time(timestamp) %}\n    {% do exceptions.raise_not_implemented(\n        'snapshot_string_as_time macro not implemented for adapter '+adapter.type()\n    ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3268428, "supported_languages": null}, "macro.dbt.snapshot_check_all_get_existing_columns": {"name": "snapshot_check_all_get_existing_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists, check_cols_config) -%}\n    {%- if not target_exists -%}\n        {#-- no table yet -> return whatever the query does --#}\n        {{ return((false, query_columns)) }}\n    {%- endif -%}\n\n    {#-- handle any schema changes --#}\n    {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=node.alias) -%}\n\n    {% if check_cols_config == 'all' %}\n        {%- set query_columns = get_columns_in_query(node['compiled_code']) -%}\n\n    {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n        {#-- query for proper casing/quoting, to support comparison below --#}\n        {%- set select_check_cols_from_target -%}\n            {#-- N.B. The whitespace below is necessary to avoid edge case issue with comments --#}\n            {#-- See: https://github.com/dbt-labs/dbt-core/issues/6781 --#}\n            select {{ check_cols_config | join(', ') }} from (\n                {{ node['compiled_code'] }}\n            ) subq\n        {%- endset -%}\n        {% set query_columns = get_columns_in_query(select_check_cols_from_target) %}\n\n    {% else %}\n        {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n    {% endif %}\n\n    {%- set existing_cols = adapter.get_columns_in_relation(target_relation) | map(attribute = 'name') | list -%}\n    {%- set ns = namespace() -%} {#-- handle for-loop scoping with a namespace --#}\n    {%- set ns.column_added = false -%}\n\n    {%- set intersection = [] -%}\n    {%- for col in query_columns -%}\n        {%- if col in existing_cols -%}\n            {%- do intersection.append(adapter.quote(col)) -%}\n        {%- else -%}\n            {% set ns.column_added = true %}\n        {%- endif -%}\n    {%- endfor -%}\n    {{ return((ns.column_added, intersection)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3282838, "supported_languages": null}, "macro.dbt.snapshot_check_strategy": {"name": "snapshot_check_strategy", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_check_strategy", "macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n    {% set check_cols_config = config['check_cols'] %}\n    {% set primary_key = config['unique_key'] %}\n    {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n    {% set updated_at = config.get('updated_at', snapshot_get_time()) %}\n\n    {% set column_added = false %}\n\n    {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists, check_cols_config) %}\n\n    {%- set row_changed_expr -%}\n    (\n    {%- if column_added -%}\n        {{ get_true_sql() }}\n    {%- else -%}\n    {%- for col in check_cols -%}\n        {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }}\n        or\n        (\n            (({{ snapshotted_rel }}.{{ col }} is null) and not ({{ current_rel }}.{{ col }} is null))\n            or\n            ((not {{ snapshotted_rel }}.{{ col }} is null) and ({{ current_rel }}.{{ col }} is null))\n        )\n        {%- if not loop.last %} or {% endif -%}\n    {%- endfor -%}\n    {%- endif -%}\n    )\n    {%- endset %}\n\n    {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n    {% do return({\n        \"unique_key\": primary_key,\n        \"updated_at\": updated_at,\n        \"row_changed\": row_changed_expr,\n        \"scd_id\": scd_id_expr,\n        \"invalidate_hard_deletes\": invalidate_hard_deletes\n    }) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.snapshot_get_time", "macro.dbt.snapshot_check_all_get_existing_columns", "macro.dbt.get_true_sql", "macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.329677, "supported_languages": null}, "macro.dbt.create_columns": {"name": "create_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n  {{ adapter.dispatch('create_columns', 'dbt')(relation, columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3338099, "supported_languages": null}, "macro.dbt.default__create_columns": {"name": "default__create_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__create_columns", "macro_sql": "{% macro default__create_columns(relation, columns) %}\n  {% for column in columns %}\n    {% call statement() %}\n      alter table {{ relation }} add column \"{{ column.name }}\" {{ column.data_type }};\n    {% endcall %}\n  {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.334107, "supported_languages": null}, "macro.dbt.post_snapshot": {"name": "post_snapshot", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n  {{ adapter.dispatch('post_snapshot', 'dbt')(staging_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.334275, "supported_languages": null}, "macro.dbt.default__post_snapshot": {"name": "default__post_snapshot", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__post_snapshot", "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n    {# no-op #}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3343658, "supported_languages": null}, "macro.dbt.get_true_sql": {"name": "get_true_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.get_true_sql", "macro_sql": "{% macro get_true_sql() %}\n  {{ adapter.dispatch('get_true_sql', 'dbt')() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_true_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.334518, "supported_languages": null}, "macro.dbt.default__get_true_sql": {"name": "default__get_true_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__get_true_sql", "macro_sql": "{% macro default__get_true_sql() %}\n    {{ return('TRUE') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.334636, "supported_languages": null}, "macro.dbt.snapshot_staging_table": {"name": "snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.snapshot_staging_table", "macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n  {{ adapter.dispatch('snapshot_staging_table', 'dbt')(strategy, source_sql, target_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__snapshot_staging_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3348439, "supported_languages": null}, "macro.dbt.default__snapshot_staging_table": {"name": "default__snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__snapshot_staging_table", "macro_sql": "{% macro default__snapshot_staging_table(strategy, source_sql, target_relation) -%}\n\n    with snapshot_query as (\n\n        {{ source_sql }}\n\n    ),\n\n    snapshotted_data as (\n\n        select *,\n            {{ strategy.unique_key }} as dbt_unique_key\n\n        from {{ target_relation }}\n        where dbt_valid_to is null\n\n    ),\n\n    insertions_source_data as (\n\n        select\n            *,\n            {{ strategy.unique_key }} as dbt_unique_key,\n            {{ strategy.updated_at }} as dbt_updated_at,\n            {{ strategy.updated_at }} as dbt_valid_from,\n            nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,\n            {{ strategy.scd_id }} as dbt_scd_id\n\n        from snapshot_query\n    ),\n\n    updates_source_data as (\n\n        select\n            *,\n            {{ strategy.unique_key }} as dbt_unique_key,\n            {{ strategy.updated_at }} as dbt_updated_at,\n            {{ strategy.updated_at }} as dbt_valid_from,\n            {{ strategy.updated_at }} as dbt_valid_to\n\n        from snapshot_query\n    ),\n\n    {%- if strategy.invalidate_hard_deletes %}\n\n    deletes_source_data as (\n\n        select\n            *,\n            {{ strategy.unique_key }} as dbt_unique_key\n        from snapshot_query\n    ),\n    {% endif %}\n\n    insertions as (\n\n        select\n            'insert' as dbt_change_type,\n            source_data.*\n\n        from insertions_source_data as source_data\n        left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n        where snapshotted_data.dbt_unique_key is null\n           or (\n                snapshotted_data.dbt_unique_key is not null\n            and (\n                {{ strategy.row_changed }}\n            )\n        )\n\n    ),\n\n    updates as (\n\n        select\n            'update' as dbt_change_type,\n            source_data.*,\n            snapshotted_data.dbt_scd_id\n\n        from updates_source_data as source_data\n        join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n        where (\n            {{ strategy.row_changed }}\n        )\n    )\n\n    {%- if strategy.invalidate_hard_deletes -%}\n    ,\n\n    deletes as (\n\n        select\n            'delete' as dbt_change_type,\n            source_data.*,\n            {{ snapshot_get_time() }} as dbt_valid_from,\n            {{ snapshot_get_time() }} as dbt_updated_at,\n            {{ snapshot_get_time() }} as dbt_valid_to,\n            snapshotted_data.dbt_scd_id\n\n        from snapshotted_data\n        left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n        where source_data.dbt_unique_key is null\n    )\n    {%- endif %}\n\n    select * from insertions\n    union all\n    select * from updates\n    {%- if strategy.invalidate_hard_deletes %}\n    union all\n    select * from deletes\n    {%- endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3357491, "supported_languages": null}, "macro.dbt.build_snapshot_table": {"name": "build_snapshot_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.build_snapshot_table", "macro_sql": "{% macro build_snapshot_table(strategy, sql) -%}\n  {{ adapter.dispatch('build_snapshot_table', 'dbt')(strategy, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__build_snapshot_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.335943, "supported_languages": null}, "macro.dbt.default__build_snapshot_table": {"name": "default__build_snapshot_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__build_snapshot_table", "macro_sql": "{% macro default__build_snapshot_table(strategy, sql) %}\n\n    select *,\n        {{ strategy.scd_id }} as dbt_scd_id,\n        {{ strategy.updated_at }} as dbt_updated_at,\n        {{ strategy.updated_at }} as dbt_valid_from,\n        nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to\n    from (\n        {{ sql }}\n    ) sbq\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.336203, "supported_languages": null}, "macro.dbt.build_snapshot_staging_table": {"name": "build_snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n    {% set temp_relation = make_temp_relation(target_relation) %}\n\n    {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n    {% call statement('build_snapshot_staging_relation') %}\n        {{ create_table_as(True, temp_relation, select) }}\n    {% endcall %}\n\n    {% do return(temp_relation) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_temp_relation", "macro.dbt.snapshot_staging_table", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.336641, "supported_languages": null}, "macro.dbt.materialization_snapshot_default": {"name": "materialization_snapshot_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot.sql", "original_file_path": "macros/materializations/snapshots/snapshot.sql", "unique_id": "macro.dbt.materialization_snapshot_default", "macro_sql": "{% materialization snapshot, default %}\n  {%- set config = model['config'] -%}\n\n  {%- set target_table = model.get('alias', model.get('name')) -%}\n\n  {%- set strategy_name = config.get('strategy') -%}\n  {%- set unique_key = config.get('unique_key') %}\n  -- grab current tables grants config for comparision later on\n  {%- set grant_config = config.get('grants') -%}\n\n  {% set target_relation_exists, target_relation = get_or_create_relation(\n          database=model.database,\n          schema=model.schema,\n          identifier=target_table,\n          type='table') -%}\n\n  {%- if not target_relation.is_table -%}\n    {% do exceptions.relation_wrong_type(target_relation, 'table') %}\n  {%- endif -%}\n\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  {% set strategy_macro = strategy_dispatch(strategy_name) %}\n  {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", config, target_relation_exists) %}\n\n  {% if not target_relation_exists %}\n\n      {% set build_sql = build_snapshot_table(strategy, model['compiled_code']) %}\n      {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n  {% else %}\n\n      {{ adapter.valid_snapshot_target(target_relation) }}\n\n      {% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}\n\n      -- this may no-op if the database does not require column expansion\n      {% do adapter.expand_target_column_types(from_relation=staging_table,\n                                               to_relation=target_relation) %}\n\n      {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n                                   | rejectattr('name', 'equalto', 'dbt_change_type')\n                                   | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n                                   | rejectattr('name', 'equalto', 'dbt_unique_key')\n                                   | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n                                   | list %}\n\n      {% do create_columns(target_relation, missing_columns) %}\n\n      {% set source_columns = adapter.get_columns_in_relation(staging_table)\n                                   | rejectattr('name', 'equalto', 'dbt_change_type')\n                                   | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n                                   | rejectattr('name', 'equalto', 'dbt_unique_key')\n                                   | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n                                   | list %}\n\n      {% set quoted_source_columns = [] %}\n      {% for column in source_columns %}\n        {% do quoted_source_columns.append(adapter.quote(column.name)) %}\n      {% endfor %}\n\n      {% set final_sql = snapshot_merge_sql(\n            target = target_relation,\n            source = staging_table,\n            insert_cols = quoted_source_columns\n         )\n      %}\n\n  {% endif %}\n\n  {% call statement('main') %}\n      {{ final_sql }}\n  {% endcall %}\n\n  {% set should_revoke = should_revoke(target_relation_exists, full_refresh_mode=False) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {% if not target_relation_exists %}\n    {% do create_indexes(target_relation) %}\n  {% endif %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  {{ adapter.commit() }}\n\n  {% if staging_table is defined %}\n      {% do post_snapshot(staging_table) %}\n  {% endif %}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.get_or_create_relation", "macro.dbt.run_hooks", "macro.dbt.strategy_dispatch", "macro.dbt.build_snapshot_table", "macro.dbt.create_table_as", "macro.dbt.build_snapshot_staging_table", "macro.dbt.create_columns", "macro.dbt.snapshot_merge_sql", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes", "macro.dbt.post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3428328, "supported_languages": ["sql"]}, "macro.dbt.materialization_test_default": {"name": "materialization_test_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/test.sql", "original_file_path": "macros/materializations/tests/test.sql", "unique_id": "macro.dbt.materialization_test_default", "macro_sql": "{%- materialization test, default -%}\n\n  {% set relations = [] %}\n\n  {% if should_store_failures() %}\n\n    {% set identifier = model['alias'] %}\n    {% set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n    {% set store_failures_as = config.get('store_failures_as') %}\n    -- if `--store-failures` is invoked via command line and `store_failures_as` is not set,\n    -- config.get('store_failures_as', 'table') returns None, not 'table'\n    {% if store_failures_as == none %}{% set store_failures_as = 'table' %}{% endif %}\n    {% if store_failures_as not in ['table', 'view'] %}\n        {{ exceptions.raise_compiler_error(\n            \"'\" ~ store_failures_as ~ \"' is not a valid value for `store_failures_as`. \"\n            \"Accepted values are: ['ephemeral', 'table', 'view']\"\n        ) }}\n    {% endif %}\n\n    {% set target_relation = api.Relation.create(\n        identifier=identifier, schema=schema, database=database, type=store_failures_as) -%} %}\n\n    {% if old_relation %}\n        {% do adapter.drop_relation(old_relation) %}\n    {% endif %}\n\n    {% call statement(auto_begin=True) %}\n        {{ get_create_sql(target_relation, sql) }}\n    {% endcall %}\n\n    {% do relations.append(target_relation) %}\n\n    {% set main_sql %}\n        select *\n        from {{ target_relation }}\n    {% endset %}\n\n    {{ adapter.commit() }}\n\n  {% else %}\n\n      {% set main_sql = sql %}\n\n  {% endif %}\n\n  {% set limit = config.get('limit') %}\n  {% set fail_calc = config.get('fail_calc') %}\n  {% set warn_if = config.get('warn_if') %}\n  {% set error_if = config.get('error_if') %}\n\n  {% call statement('main', fetch_result=True) -%}\n\n    {{ get_test_sql(main_sql, fail_calc, warn_if, error_if, limit)}}\n\n  {%- endcall %}\n\n  {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.should_store_failures", "macro.dbt.statement", "macro.dbt.get_create_sql", "macro.dbt.get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.345597, "supported_languages": ["sql"]}, "macro.dbt.get_test_sql": {"name": "get_test_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "unique_id": "macro.dbt.get_test_sql", "macro_sql": "{% macro get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n  {{ adapter.dispatch('get_test_sql', 'dbt')(main_sql, fail_calc, warn_if, error_if, limit) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.346059, "supported_languages": null}, "macro.dbt.default__get_test_sql": {"name": "default__get_test_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "unique_id": "macro.dbt.default__get_test_sql", "macro_sql": "{% macro default__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n    select\n      {{ fail_calc }} as failures,\n      {{ fail_calc }} {{ warn_if }} as should_warn,\n      {{ fail_calc }} {{ error_if }} as should_error\n    from (\n      {{ main_sql }}\n      {{ \"limit \" ~ limit if limit != none }}\n    ) dbt_internal_test\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.34637, "supported_languages": null}, "macro.dbt.get_where_subquery": {"name": "get_where_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "unique_id": "macro.dbt.get_where_subquery", "macro_sql": "{% macro get_where_subquery(relation) -%}\n    {% do return(adapter.dispatch('get_where_subquery', 'dbt')(relation)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_where_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3467488, "supported_languages": null}, "macro.dbt.default__get_where_subquery": {"name": "default__get_where_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "unique_id": "macro.dbt.default__get_where_subquery", "macro_sql": "{% macro default__get_where_subquery(relation) -%}\n    {% set where = config.get('where', '') %}\n    {% if where %}\n        {%- set filtered -%}\n            (select * from {{ relation }} where {{ where }}) dbt_subquery\n        {%- endset -%}\n        {% do return(filtered) %}\n    {%- else -%}\n        {% do return(relation) %}\n    {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.347133, "supported_languages": null}, "macro.dbt.materialization_materialized_view_default": {"name": "materialization_materialized_view_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialization_materialized_view_default", "macro_sql": "{% materialization materialized_view, default %}\n    {% set existing_relation = load_cached_relation(this) %}\n    {% set target_relation = this.incorporate(type=this.MaterializedView) %}\n    {% set intermediate_relation = make_intermediate_relation(target_relation) %}\n    {% set backup_relation_type = target_relation.MaterializedView if existing_relation is none else existing_relation.type %}\n    {% set backup_relation = make_backup_relation(target_relation, backup_relation_type) %}\n\n    {{ materialized_view_setup(backup_relation, intermediate_relation, pre_hooks) }}\n\n        {% set build_sql = materialized_view_get_build_sql(existing_relation, target_relation, backup_relation, intermediate_relation) %}\n\n        {% if build_sql == '' %}\n            {{ materialized_view_execute_no_op(target_relation) }}\n        {% else %}\n            {{ materialized_view_execute_build_sql(build_sql, existing_relation, target_relation, post_hooks) }}\n        {% endif %}\n\n    {{ materialized_view_teardown(backup_relation, intermediate_relation, post_hooks) }}\n\n    {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.materialized_view_setup", "macro.dbt.materialized_view_get_build_sql", "macro.dbt.materialized_view_execute_no_op", "macro.dbt.materialized_view_execute_build_sql", "macro.dbt.materialized_view_teardown"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3520708, "supported_languages": ["sql"]}, "macro.dbt.materialized_view_setup": {"name": "materialized_view_setup", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_setup", "macro_sql": "{% macro materialized_view_setup(backup_relation, intermediate_relation, pre_hooks) %}\n\n    -- backup_relation and intermediate_relation should not already exist in the database\n    -- it's possible these exist because of a previous run that exited unexpectedly\n    {% set preexisting_backup_relation = load_cached_relation(backup_relation) %}\n    {% set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) %}\n\n    -- drop the temp relations if they exist already in the database\n    {{ drop_relation_if_exists(preexisting_backup_relation) }}\n    {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n\n    {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.352469, "supported_languages": null}, "macro.dbt.materialized_view_teardown": {"name": "materialized_view_teardown", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_teardown", "macro_sql": "{% macro materialized_view_teardown(backup_relation, intermediate_relation, post_hooks) %}\n\n    -- drop the temp relations if they exist to leave the database clean for the next run\n    {{ drop_relation_if_exists(backup_relation) }}\n    {{ drop_relation_if_exists(intermediate_relation) }}\n\n    {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.352723, "supported_languages": null}, "macro.dbt.materialized_view_get_build_sql": {"name": "materialized_view_get_build_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_get_build_sql", "macro_sql": "{% macro materialized_view_get_build_sql(existing_relation, target_relation, backup_relation, intermediate_relation) %}\n\n    {% set full_refresh_mode = should_full_refresh() %}\n\n    -- determine the scenario we're in: create, full_refresh, alter, refresh data\n    {% if existing_relation is none %}\n        {% set build_sql = get_create_materialized_view_as_sql(target_relation, sql) %}\n    {% elif full_refresh_mode or not existing_relation.is_materialized_view %}\n        {% set build_sql = get_replace_sql(existing_relation, target_relation, sql) %}\n    {% else %}\n\n        -- get config options\n        {% set on_configuration_change = config.get('on_configuration_change') %}\n        {% set configuration_changes = get_materialized_view_configuration_changes(existing_relation, config) %}\n\n        {% if configuration_changes is none %}\n            {% set build_sql = refresh_materialized_view(target_relation) %}\n\n        {% elif on_configuration_change == 'apply' %}\n            {% set build_sql = get_alter_materialized_view_as_sql(target_relation, configuration_changes, sql, existing_relation, backup_relation, intermediate_relation) %}\n        {% elif on_configuration_change == 'continue' %}\n            {% set build_sql = '' %}\n            {{ exceptions.warn(\"Configuration changes were identified and `on_configuration_change` was set to `continue` for `\" ~ target_relation ~ \"`\") }}\n        {% elif on_configuration_change == 'fail' %}\n            {{ exceptions.raise_fail_fast_error(\"Configuration changes were identified and `on_configuration_change` was set to `fail` for `\" ~ target_relation ~ \"`\") }}\n\n        {% else %}\n            -- this only happens if the user provides a value other than `apply`, 'skip', 'fail'\n            {{ exceptions.raise_compiler_error(\"Unexpected configuration scenario\") }}\n\n        {% endif %}\n\n    {% endif %}\n\n    {% do return(build_sql) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.get_create_materialized_view_as_sql", "macro.dbt.get_replace_sql", "macro.dbt.get_materialized_view_configuration_changes", "macro.dbt.refresh_materialized_view", "macro.dbt.get_alter_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3540301, "supported_languages": null}, "macro.dbt.materialized_view_execute_no_op": {"name": "materialized_view_execute_no_op", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_execute_no_op", "macro_sql": "{% macro materialized_view_execute_no_op(target_relation) %}\n    {% do store_raw_result(\n        name=\"main\",\n        message=\"skip \" ~ target_relation,\n        code=\"skip\",\n        rows_affected=\"-1\"\n    ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.354264, "supported_languages": null}, "macro.dbt.materialized_view_execute_build_sql": {"name": "materialized_view_execute_build_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_execute_build_sql", "macro_sql": "{% macro materialized_view_execute_build_sql(build_sql, existing_relation, target_relation, post_hooks) %}\n\n    -- `BEGIN` happens here:\n    {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n    {% set grant_config = config.get('grants') %}\n\n    {% call statement(name=\"main\") %}\n        {{ build_sql }}\n    {% endcall %}\n\n    {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n    {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n    {% do persist_docs(target_relation, model) %}\n\n    {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n    {{ adapter.commit() }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.354934, "supported_languages": null}, "macro.dbt.materialization_view_default": {"name": "materialization_view_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/view.sql", "original_file_path": "macros/materializations/models/view.sql", "unique_id": "macro.dbt.materialization_view_default", "macro_sql": "{%- materialization view, default -%}\n\n  {%- set existing_relation = load_cached_relation(this) -%}\n  {%- set target_relation = this.incorporate(type='view') -%}\n  {%- set intermediate_relation =  make_intermediate_relation(target_relation) -%}\n\n  -- the intermediate_relation should not already exist in the database; get_relation\n  -- will return None in that case. Otherwise, we get a relation that we can drop\n  -- later, before we try to use this name for the current operation\n  {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n  /*\n     This relation (probably) doesn't exist yet. If it does exist, it's a leftover from\n     a previous run, and we're going to try to drop it immediately. At the end of this\n     materialization, we're going to rename the \"existing_relation\" to this identifier,\n     and then we're going to drop it. In order to make sure we run the correct one of:\n       - drop view ...\n       - drop table ...\n\n     We need to set the type of this relation to be the type of the existing_relation, if it exists,\n     or else \"view\" as a sane default if it does not. Note that if the existing_relation does not\n     exist, then there is nothing to move out of the way and subsequentally drop. In that case,\n     this relation will be effectively unused.\n  */\n  {%- set backup_relation_type = 'view' if existing_relation is none else existing_relation.type -%}\n  {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n  -- as above, the backup_relation should not already exist\n  {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n  -- grab current tables grants config for comparision later on\n  {% set grant_config = config.get('grants') %}\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  -- drop the temp relations if they exist already in the database\n  {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n  {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n  -- `BEGIN` happens here:\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  -- build model\n  {% call statement('main') -%}\n    {{ get_create_view_as_sql(intermediate_relation, sql) }}\n  {%- endcall %}\n\n  -- cleanup\n  -- move the existing view out of the way\n  {% if existing_relation is not none %}\n     /* Do the equivalent of rename_if_exists. 'existing_relation' could have been dropped\n        since the variable was first set. */\n    {% set existing_relation = load_cached_relation(existing_relation) %}\n    {% if existing_relation is not none %}\n        {{ adapter.rename_relation(existing_relation, backup_relation) }}\n    {% endif %}\n  {% endif %}\n  {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n  {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  {{ adapter.commit() }}\n\n  {{ drop_relation_if_exists(backup_relation) }}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.357911, "supported_languages": ["sql"]}, "macro.dbt.materialization_table_default": {"name": "materialization_table_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/table.sql", "original_file_path": "macros/materializations/models/table.sql", "unique_id": "macro.dbt.materialization_table_default", "macro_sql": "{% materialization table, default %}\n\n  {%- set existing_relation = load_cached_relation(this) -%}\n  {%- set target_relation = this.incorporate(type='table') %}\n  {%- set intermediate_relation =  make_intermediate_relation(target_relation) -%}\n  -- the intermediate_relation should not already exist in the database; get_relation\n  -- will return None in that case. Otherwise, we get a relation that we can drop\n  -- later, before we try to use this name for the current operation\n  {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n  /*\n      See ../view/view.sql for more information about this relation.\n  */\n  {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n  {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n  -- as above, the backup_relation should not already exist\n  {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n  -- grab current tables grants config for comparision later on\n  {% set grant_config = config.get('grants') %}\n\n  -- drop the temp relations if they exist already in the database\n  {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n  {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  -- `BEGIN` happens here:\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  -- build model\n  {% call statement('main') -%}\n    {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n  {%- endcall %}\n\n  -- cleanup\n  {% if existing_relation is not none %}\n     /* Do the equivalent of rename_if_exists. 'existing_relation' could have been dropped\n        since the variable was first set. */\n    {% set existing_relation = load_cached_relation(existing_relation) %}\n    {% if existing_relation is not none %}\n        {{ adapter.rename_relation(existing_relation, backup_relation) }}\n    {% endif %}\n  {% endif %}\n\n  {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n  {% do create_indexes(target_relation) %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  -- `COMMIT` happens here\n  {{ adapter.commit() }}\n\n  -- finally, drop the existing/backup relation after the commit\n  {{ drop_relation_if_exists(backup_relation) }}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt.create_indexes", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.36081, "supported_languages": ["sql"]}, "macro.dbt.get_quoted_csv": {"name": "get_quoted_csv", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.get_quoted_csv", "macro_sql": "{% macro get_quoted_csv(column_names) %}\n\n    {% set quoted = [] %}\n    {% for col in column_names -%}\n        {%- do quoted.append(adapter.quote(col)) -%}\n    {%- endfor %}\n\n    {%- set dest_cols_csv = quoted | join(', ') -%}\n    {{ return(dest_cols_csv) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3624341, "supported_languages": null}, "macro.dbt.diff_columns": {"name": "diff_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.diff_columns", "macro_sql": "{% macro diff_columns(source_columns, target_columns) %}\n\n  {% set result = [] %}\n  {% set source_names = source_columns | map(attribute = 'column') | list %}\n  {% set target_names = target_columns | map(attribute = 'column') | list %}\n\n   {# --check whether the name attribute exists in the target - this does not perform a data type check #}\n   {% for sc in source_columns %}\n     {% if sc.name not in target_names %}\n        {{ result.append(sc) }}\n     {% endif %}\n   {% endfor %}\n\n  {{ return(result) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.362991, "supported_languages": null}, "macro.dbt.diff_column_data_types": {"name": "diff_column_data_types", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.diff_column_data_types", "macro_sql": "{% macro diff_column_data_types(source_columns, target_columns) %}\n\n  {% set result = [] %}\n  {% for sc in source_columns %}\n    {% set tc = target_columns | selectattr(\"name\", \"equalto\", sc.name) | list | first %}\n    {% if tc %}\n      {% if sc.data_type != tc.data_type and not sc.can_expand_to(other_column=tc) %}\n        {{ result.append( { 'column_name': tc.name, 'new_type': sc.data_type } ) }}\n      {% endif %}\n    {% endif %}\n  {% endfor %}\n\n  {{ return(result) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.36367, "supported_languages": null}, "macro.dbt.get_merge_update_columns": {"name": "get_merge_update_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.get_merge_update_columns", "macro_sql": "{% macro get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) %}\n  {{ return(adapter.dispatch('get_merge_update_columns', 'dbt')(merge_update_columns, merge_exclude_columns, dest_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_merge_update_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3639119, "supported_languages": null}, "macro.dbt.default__get_merge_update_columns": {"name": "default__get_merge_update_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.default__get_merge_update_columns", "macro_sql": "{% macro default__get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) %}\n  {%- set default_cols = dest_columns | map(attribute=\"quoted\") | list -%}\n\n  {%- if merge_update_columns and merge_exclude_columns -%}\n    {{ exceptions.raise_compiler_error(\n        'Model cannot specify merge_update_columns and merge_exclude_columns. Please update model to use only one config'\n    )}}\n  {%- elif merge_update_columns -%}\n    {%- set update_columns = merge_update_columns -%}\n  {%- elif merge_exclude_columns -%}\n    {%- set update_columns = [] -%}\n    {%- for column in dest_columns -%}\n      {% if column.column | lower not in merge_exclude_columns | map(\"lower\") | list %}\n        {%- do update_columns.append(column.quoted) -%}\n      {% endif %}\n    {%- endfor -%}\n  {%- else -%}\n    {%- set update_columns = default_cols -%}\n  {%- endif -%}\n\n  {{ return(update_columns) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3646379, "supported_languages": null}, "macro.dbt.get_merge_sql": {"name": "get_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_merge_sql", "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, incremental_predicates=none) -%}\n   -- back compat for old kwarg name\n  {% set incremental_predicates = kwargs.get('predicates', incremental_predicates) %}\n  {{ adapter.dispatch('get_merge_sql', 'dbt')(target, source, unique_key, dest_columns, incremental_predicates) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.371027, "supported_languages": null}, "macro.dbt.default__get_merge_sql": {"name": "default__get_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_merge_sql", "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, incremental_predicates=none) -%}\n    {%- set predicates = [] if incremental_predicates is none else [] + incremental_predicates -%}\n    {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n    {%- set merge_update_columns = config.get('merge_update_columns') -%}\n    {%- set merge_exclude_columns = config.get('merge_exclude_columns') -%}\n    {%- set update_columns = get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) -%}\n    {%- set sql_header = config.get('sql_header', none) -%}\n\n    {% if unique_key %}\n        {% if unique_key is sequence and unique_key is not mapping and unique_key is not string %}\n            {% for key in unique_key %}\n                {% set this_key_match %}\n                    DBT_INTERNAL_SOURCE.{{ key }} = DBT_INTERNAL_DEST.{{ key }}\n                {% endset %}\n                {% do predicates.append(this_key_match) %}\n            {% endfor %}\n        {% else %}\n            {% set unique_key_match %}\n                DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }}\n            {% endset %}\n            {% do predicates.append(unique_key_match) %}\n        {% endif %}\n    {% else %}\n        {% do predicates.append('FALSE') %}\n    {% endif %}\n\n    {{ sql_header if sql_header is not none }}\n\n    merge into {{ target }} as DBT_INTERNAL_DEST\n        using {{ source }} as DBT_INTERNAL_SOURCE\n        on {{\"(\" ~ predicates | join(\") and (\") ~ \")\"}}\n\n    {% if unique_key %}\n    when matched then update set\n        {% for column_name in update_columns -%}\n            {{ column_name }} = DBT_INTERNAL_SOURCE.{{ column_name }}\n            {%- if not loop.last %}, {%- endif %}\n        {%- endfor %}\n    {% endif %}\n\n    when not matched then insert\n        ({{ dest_cols_csv }})\n    values\n        ({{ dest_cols_csv }})\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv", "macro.dbt.get_merge_update_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.372648, "supported_languages": null}, "macro.dbt.get_delete_insert_merge_sql": {"name": "get_delete_insert_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_delete_insert_merge_sql", "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) -%}\n  {{ adapter.dispatch('get_delete_insert_merge_sql', 'dbt')(target, source, unique_key, dest_columns, incremental_predicates) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.372942, "supported_languages": null}, "macro.dbt.default__get_delete_insert_merge_sql": {"name": "default__get_delete_insert_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_delete_insert_merge_sql", "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) -%}\n\n    {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n    {% if unique_key %}\n        {% if unique_key is sequence and unique_key is not string %}\n            delete from {{target }}\n            using {{ source }}\n            where (\n                {% for key in unique_key %}\n                    {{ source }}.{{ key }} = {{ target }}.{{ key }}\n                    {{ \"and \" if not loop.last}}\n                {% endfor %}\n                {% if incremental_predicates %}\n                    {% for predicate in incremental_predicates %}\n                        and {{ predicate }}\n                    {% endfor %}\n                {% endif %}\n            );\n        {% else %}\n            delete from {{ target }}\n            where (\n                {{ unique_key }}) in (\n                select ({{ unique_key }})\n                from {{ source }}\n            )\n            {%- if incremental_predicates %}\n                {% for predicate in incremental_predicates %}\n                    and {{ predicate }}\n                {% endfor %}\n            {%- endif -%};\n\n        {% endif %}\n    {% endif %}\n\n    insert into {{ target }} ({{ dest_cols_csv }})\n    (\n        select {{ dest_cols_csv }}\n        from {{ source }}\n    )\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3739579, "supported_languages": null}, "macro.dbt.get_insert_overwrite_merge_sql": {"name": "get_insert_overwrite_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_insert_overwrite_merge_sql", "macro_sql": "{% macro get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header=false) -%}\n  {{ adapter.dispatch('get_insert_overwrite_merge_sql', 'dbt')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.374238, "supported_languages": null}, "macro.dbt.default__get_insert_overwrite_merge_sql": {"name": "default__get_insert_overwrite_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n    {#-- The only time include_sql_header is True: --#}\n    {#-- BigQuery + insert_overwrite strategy + \"static\" partitions config --#}\n    {#-- We should consider including the sql header at the materialization level instead --#}\n\n    {%- set predicates = [] if predicates is none else [] + predicates -%}\n    {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n    {%- set sql_header = config.get('sql_header', none) -%}\n\n    {{ sql_header if sql_header is not none and include_sql_header }}\n\n    merge into {{ target }} as DBT_INTERNAL_DEST\n        using {{ source }} as DBT_INTERNAL_SOURCE\n        on FALSE\n\n    when not matched by source\n        {% if predicates %} and {{ predicates | join(' and ') }} {% endif %}\n        then delete\n\n    when not matched then insert\n        ({{ dest_cols_csv }})\n    values\n        ({{ dest_cols_csv }})\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.374901, "supported_languages": null}, "macro.dbt.is_incremental": {"name": "is_incremental", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/is_incremental.sql", "original_file_path": "macros/materializations/models/incremental/is_incremental.sql", "unique_id": "macro.dbt.is_incremental", "macro_sql": "{% macro is_incremental() %}\n    {#-- do not run introspective queries in parsing #}\n    {% if not execute %}\n        {{ return(False) }}\n    {% else %}\n        {% set relation = adapter.get_relation(this.database, this.schema, this.table) %}\n        {{ return(relation is not none\n                  and relation.type == 'table'\n                  and model.config.materialized == 'incremental'\n                  and not should_full_refresh()) }}\n    {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3755388, "supported_languages": null}, "macro.dbt.get_incremental_append_sql": {"name": "get_incremental_append_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_append_sql", "macro_sql": "{% macro get_incremental_append_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_append_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_append_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3764238, "supported_languages": null}, "macro.dbt.default__get_incremental_append_sql": {"name": "default__get_incremental_append_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_append_sql", "macro_sql": "{% macro default__get_incremental_append_sql(arg_dict) %}\n\n  {% do return(get_insert_into_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"dest_columns\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_insert_into_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.376669, "supported_languages": null}, "macro.dbt.get_incremental_delete_insert_sql": {"name": "get_incremental_delete_insert_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_delete_insert_sql", "macro_sql": "{% macro get_incremental_delete_insert_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_delete_insert_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_delete_insert_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.376864, "supported_languages": null}, "macro.dbt.default__get_incremental_delete_insert_sql": {"name": "default__get_incremental_delete_insert_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_delete_insert_sql", "macro_sql": "{% macro default__get_incremental_delete_insert_sql(arg_dict) %}\n\n  {% do return(get_delete_insert_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"unique_key\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.377169, "supported_languages": null}, "macro.dbt.get_incremental_merge_sql": {"name": "get_incremental_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_merge_sql", "macro_sql": "{% macro get_incremental_merge_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_merge_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.377425, "supported_languages": null}, "macro.dbt.default__get_incremental_merge_sql": {"name": "default__get_incremental_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_merge_sql", "macro_sql": "{% macro default__get_incremental_merge_sql(arg_dict) %}\n\n  {% do return(get_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"unique_key\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3777258, "supported_languages": null}, "macro.dbt.get_incremental_insert_overwrite_sql": {"name": "get_incremental_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_insert_overwrite_sql", "macro_sql": "{% macro get_incremental_insert_overwrite_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_insert_overwrite_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_insert_overwrite_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3779142, "supported_languages": null}, "macro.dbt.default__get_incremental_insert_overwrite_sql": {"name": "default__get_incremental_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_insert_overwrite_sql", "macro_sql": "{% macro default__get_incremental_insert_overwrite_sql(arg_dict) %}\n\n  {% do return(get_insert_overwrite_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.378182, "supported_languages": null}, "macro.dbt.get_incremental_default_sql": {"name": "get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_default_sql", "macro_sql": "{% macro get_incremental_default_sql(arg_dict) %}\n\n  {{ return(adapter.dispatch('get_incremental_default_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_default_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3783731, "supported_languages": null}, "macro.dbt.default__get_incremental_default_sql": {"name": "default__get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_default_sql", "macro_sql": "{% macro default__get_incremental_default_sql(arg_dict) %}\n\n  {% do return(get_incremental_append_sql(arg_dict)) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_incremental_append_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.378525, "supported_languages": null}, "macro.dbt.get_insert_into_sql": {"name": "get_insert_into_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_insert_into_sql", "macro_sql": "{% macro get_insert_into_sql(target_relation, temp_relation, dest_columns) %}\n\n    {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n    insert into {{ target_relation }} ({{ dest_cols_csv }})\n    (\n        select {{ dest_cols_csv }}\n        from {{ temp_relation }}\n    )\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.378809, "supported_languages": null}, "macro.dbt.materialization_incremental_default": {"name": "materialization_incremental_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/incremental.sql", "original_file_path": "macros/materializations/models/incremental/incremental.sql", "unique_id": "macro.dbt.materialization_incremental_default", "macro_sql": "{% materialization incremental, default -%}\n\n  -- relations\n  {%- set existing_relation = load_cached_relation(this) -%}\n  {%- set target_relation = this.incorporate(type='table') -%}\n  {%- set temp_relation = make_temp_relation(target_relation)-%}\n  {%- set intermediate_relation = make_intermediate_relation(target_relation)-%}\n  {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n  {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n\n  -- configs\n  {%- set unique_key = config.get('unique_key') -%}\n  {%- set full_refresh_mode = (should_full_refresh()  or existing_relation.is_view) -%}\n  {%- set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') -%}\n\n  -- the temp_ and backup_ relations should not already exist in the database; get_relation\n  -- will return None in that case. Otherwise, we get a relation that we can drop\n  -- later, before we try to use this name for the current operation. This has to happen before\n  -- BEGIN, in a separate transaction\n  {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation)-%}\n  {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n   -- grab current tables grants config for comparision later on\n  {% set grant_config = config.get('grants') %}\n  {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n  {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  -- `BEGIN` happens here:\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  {% set to_drop = [] %}\n\n  {% if existing_relation is none %}\n      {% set build_sql = get_create_table_as_sql(False, target_relation, sql) %}\n  {% elif full_refresh_mode %}\n      {% set build_sql = get_create_table_as_sql(False, intermediate_relation, sql) %}\n      {% set need_swap = true %}\n  {% else %}\n    {% do run_query(get_create_table_as_sql(True, temp_relation, sql)) %}\n    {% do adapter.expand_target_column_types(\n             from_relation=temp_relation,\n             to_relation=target_relation) %}\n    {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n    {% set dest_columns = process_schema_changes(on_schema_change, temp_relation, existing_relation) %}\n    {% if not dest_columns %}\n      {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n    {% endif %}\n\n    {#-- Get the incremental_strategy, the macro to use for the strategy, and build the sql --#}\n    {% set incremental_strategy = config.get('incremental_strategy') or 'default' %}\n    {% set incremental_predicates = config.get('predicates', none) or config.get('incremental_predicates', none) %}\n    {% set strategy_sql_macro_func = adapter.get_incremental_strategy_macro(context, incremental_strategy) %}\n    {% set strategy_arg_dict = ({'target_relation': target_relation, 'temp_relation': temp_relation, 'unique_key': unique_key, 'dest_columns': dest_columns, 'incremental_predicates': incremental_predicates }) %}\n    {% set build_sql = strategy_sql_macro_func(strategy_arg_dict) %}\n\n  {% endif %}\n\n  {% call statement(\"main\") %}\n      {{ build_sql }}\n  {% endcall %}\n\n  {% if need_swap %}\n      {% do adapter.rename_relation(target_relation, backup_relation) %}\n      {% do adapter.rename_relation(intermediate_relation, target_relation) %}\n      {% do to_drop.append(backup_relation) %}\n  {% endif %}\n\n  {% set should_revoke = should_revoke(existing_relation, full_refresh_mode) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {% if existing_relation is none or existing_relation.is_view or should_full_refresh() %}\n    {% do create_indexes(target_relation) %}\n  {% endif %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  -- `COMMIT` happens here\n  {% do adapter.commit() %}\n\n  {% for rel in to_drop %}\n      {% do adapter.drop_relation(rel) %}\n  {% endfor %}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_temp_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.should_full_refresh", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.get_create_table_as_sql", "macro.dbt.run_query", "macro.dbt.process_schema_changes", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.383958, "supported_languages": ["sql"]}, "macro.dbt.incremental_validate_on_schema_change": {"name": "incremental_validate_on_schema_change", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.incremental_validate_on_schema_change", "macro_sql": "{% macro incremental_validate_on_schema_change(on_schema_change, default='ignore') %}\n\n   {% if on_schema_change not in ['sync_all_columns', 'append_new_columns', 'fail', 'ignore'] %}\n\n     {% set log_message = 'Invalid value for on_schema_change (%s) specified. Setting default value of %s.' % (on_schema_change, default) %}\n     {% do log(log_message) %}\n\n     {{ return(default) }}\n\n   {% else %}\n\n     {{ return(on_schema_change) }}\n\n   {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.389555, "supported_languages": null}, "macro.dbt.check_for_schema_changes": {"name": "check_for_schema_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.check_for_schema_changes", "macro_sql": "{% macro check_for_schema_changes(source_relation, target_relation) %}\n\n  {% set schema_changed = False %}\n\n  {%- set source_columns = adapter.get_columns_in_relation(source_relation) -%}\n  {%- set target_columns = adapter.get_columns_in_relation(target_relation) -%}\n  {%- set source_not_in_target = diff_columns(source_columns, target_columns) -%}\n  {%- set target_not_in_source = diff_columns(target_columns, source_columns) -%}\n\n  {% set new_target_types = diff_column_data_types(source_columns, target_columns) %}\n\n  {% if source_not_in_target != [] %}\n    {% set schema_changed = True %}\n  {% elif target_not_in_source != [] or new_target_types != [] %}\n    {% set schema_changed = True %}\n  {% elif new_target_types != [] %}\n    {% set schema_changed = True %}\n  {% endif %}\n\n  {% set changes_dict = {\n    'schema_changed': schema_changed,\n    'source_not_in_target': source_not_in_target,\n    'target_not_in_source': target_not_in_source,\n    'source_columns': source_columns,\n    'target_columns': target_columns,\n    'new_target_types': new_target_types\n  } %}\n\n  {% set msg %}\n    In {{ target_relation }}:\n        Schema changed: {{ schema_changed }}\n        Source columns not in target: {{ source_not_in_target }}\n        Target columns not in source: {{ target_not_in_source }}\n        New column types: {{ new_target_types }}\n  {% endset %}\n\n  {% do log(msg) %}\n\n  {{ return(changes_dict) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.diff_columns", "macro.dbt.diff_column_data_types"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.390792, "supported_languages": null}, "macro.dbt.sync_column_schemas": {"name": "sync_column_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.sync_column_schemas", "macro_sql": "{% macro sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n\n  {%- set add_to_target_arr = schema_changes_dict['source_not_in_target'] -%}\n\n  {%- if on_schema_change == 'append_new_columns'-%}\n     {%- if add_to_target_arr | length > 0 -%}\n       {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, none) -%}\n     {%- endif -%}\n\n  {% elif on_schema_change == 'sync_all_columns' %}\n     {%- set remove_from_target_arr = schema_changes_dict['target_not_in_source'] -%}\n     {%- set new_target_types = schema_changes_dict['new_target_types'] -%}\n\n     {% if add_to_target_arr | length > 0 or remove_from_target_arr | length > 0 %}\n       {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, remove_from_target_arr) -%}\n     {% endif %}\n\n     {% if new_target_types != [] %}\n       {% for ntt in new_target_types %}\n         {% set column_name = ntt['column_name'] %}\n         {% set new_type = ntt['new_type'] %}\n         {% do alter_column_type(target_relation, column_name, new_type) %}\n       {% endfor %}\n     {% endif %}\n\n  {% endif %}\n\n  {% set schema_change_message %}\n    In {{ target_relation }}:\n        Schema change approach: {{ on_schema_change }}\n        Columns added: {{ add_to_target_arr }}\n        Columns removed: {{ remove_from_target_arr }}\n        Data types changed: {{ new_target_types }}\n  {% endset %}\n\n  {% do log(schema_change_message) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.alter_relation_add_remove_columns", "macro.dbt.alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3919969, "supported_languages": null}, "macro.dbt.process_schema_changes": {"name": "process_schema_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.process_schema_changes", "macro_sql": "{% macro process_schema_changes(on_schema_change, source_relation, target_relation) %}\n\n    {% if on_schema_change == 'ignore' %}\n\n     {{ return({}) }}\n\n    {% else %}\n\n      {% set schema_changes_dict = check_for_schema_changes(source_relation, target_relation) %}\n\n      {% if schema_changes_dict['schema_changed'] %}\n\n        {% if on_schema_change == 'fail' %}\n\n          {% set fail_msg %}\n              The source and target schemas on this incremental model are out of sync!\n              They can be reconciled in several ways:\n                - set the `on_schema_change` config to either append_new_columns or sync_all_columns, depending on your situation.\n                - Re-run the incremental model with `full_refresh: True` to update the target schema.\n                - update the schema manually and re-run the process.\n\n              Additional troubleshooting context:\n                 Source columns not in target: {{ schema_changes_dict['source_not_in_target'] }}\n                 Target columns not in source: {{ schema_changes_dict['target_not_in_source'] }}\n                 New column types: {{ schema_changes_dict['new_target_types'] }}\n          {% endset %}\n\n          {% do exceptions.raise_compiler_error(fail_msg) %}\n\n        {# -- unless we ignore, run the sync operation per the config #}\n        {% else %}\n\n          {% do sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n\n        {% endif %}\n\n      {% endif %}\n\n      {{ return(schema_changes_dict['source_columns']) }}\n\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.check_for_schema_changes", "macro.dbt.sync_column_schemas"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.39287, "supported_languages": null}, "macro.dbt.can_clone_table": {"name": "can_clone_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/can_clone_table.sql", "original_file_path": "macros/materializations/models/clone/can_clone_table.sql", "unique_id": "macro.dbt.can_clone_table", "macro_sql": "{% macro can_clone_table() %}\n    {{ return(adapter.dispatch('can_clone_table', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__can_clone_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3931131, "supported_languages": null}, "macro.dbt.default__can_clone_table": {"name": "default__can_clone_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/can_clone_table.sql", "original_file_path": "macros/materializations/models/clone/can_clone_table.sql", "unique_id": "macro.dbt.default__can_clone_table", "macro_sql": "{% macro default__can_clone_table() %}\n    {{ return(False) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.393234, "supported_languages": null}, "macro.dbt.create_or_replace_clone": {"name": "create_or_replace_clone", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/create_or_replace_clone.sql", "original_file_path": "macros/materializations/models/clone/create_or_replace_clone.sql", "unique_id": "macro.dbt.create_or_replace_clone", "macro_sql": "{% macro create_or_replace_clone(this_relation, defer_relation) %}\n    {{ return(adapter.dispatch('create_or_replace_clone', 'dbt')(this_relation, defer_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_or_replace_clone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3935292, "supported_languages": null}, "macro.dbt.default__create_or_replace_clone": {"name": "default__create_or_replace_clone", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/create_or_replace_clone.sql", "original_file_path": "macros/materializations/models/clone/create_or_replace_clone.sql", "unique_id": "macro.dbt.default__create_or_replace_clone", "macro_sql": "{% macro default__create_or_replace_clone(this_relation, defer_relation) %}\n    create or replace table {{ this_relation }} clone {{ defer_relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.393664, "supported_languages": null}, "macro.dbt.materialization_clone_default": {"name": "materialization_clone_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/clone.sql", "original_file_path": "macros/materializations/models/clone/clone.sql", "unique_id": "macro.dbt.materialization_clone_default", "macro_sql": "{%- materialization clone, default -%}\n\n  {%- set relations = {'relations': []} -%}\n\n  {%- if not defer_relation -%}\n      -- nothing to do\n      {{ log(\"No relation found in state manifest for \" ~ model.unique_id, info=True) }}\n      {{ return(relations) }}\n  {%- endif -%}\n\n  {%- set existing_relation = load_cached_relation(this) -%}\n\n  {%- if existing_relation and not flags.FULL_REFRESH -%}\n      -- noop!\n      {{ log(\"Relation \" ~ existing_relation ~ \" already exists\", info=True) }}\n      {{ return(relations) }}\n  {%- endif -%}\n\n  {%- set other_existing_relation = load_cached_relation(defer_relation) -%}\n\n  -- If this is a database that can do zero-copy cloning of tables, and the other relation is a table, then this will be a table\n  -- Otherwise, this will be a view\n\n  {% set can_clone_table = can_clone_table() %}\n\n  {%- if other_existing_relation and other_existing_relation.type == 'table' and can_clone_table -%}\n\n      {%- set target_relation = this.incorporate(type='table') -%}\n      {% if existing_relation is not none and not existing_relation.is_table %}\n        {{ log(\"Dropping relation \" ~ existing_relation ~ \" because it is of type \" ~ existing_relation.type) }}\n        {{ drop_relation_if_exists(existing_relation) }}\n      {% endif %}\n\n      -- as a general rule, data platforms that can clone tables can also do atomic 'create or replace'\n      {% call statement('main') %}\n          {% if target_relation and defer_relation and target_relation == defer_relation %}\n              {{ log(\"Target relation and defer relation are the same, skipping clone for relation: \" ~ target_relation) }}\n          {% else %}\n              {{ create_or_replace_clone(target_relation, defer_relation) }}\n          {% endif %}\n\n      {% endcall %}\n\n      {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n      {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n      {% do persist_docs(target_relation, model) %}\n\n      {{ return({'relations': [target_relation]}) }}\n\n  {%- else -%}\n\n      {%- set target_relation = this.incorporate(type='view') -%}\n\n      -- reuse the view materialization\n      -- TODO: support actual dispatch for materialization macros\n      -- Tracking ticket: https://github.com/dbt-labs/dbt-core/issues/7799\n      {% set search_name = \"materialization_view_\" ~ adapter.type() %}\n      {% if not search_name in context %}\n          {% set search_name = \"materialization_view_default\" %}\n      {% endif %}\n      {% set materialization_macro = context[search_name] %}\n      {% set relations = materialization_macro() %}\n      {{ return(relations) }}\n\n  {%- endif -%}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.can_clone_table", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_or_replace_clone", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.3973608, "supported_languages": ["sql"]}, "macro.dbt.materialization_seed_default": {"name": "materialization_seed_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/seed.sql", "original_file_path": "macros/materializations/seeds/seed.sql", "unique_id": "macro.dbt.materialization_seed_default", "macro_sql": "{% materialization seed, default %}\n\n  {%- set identifier = model['alias'] -%}\n  {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n  {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n  {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n  {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n  {%- set grant_config = config.get('grants') -%}\n  {%- set agate_table = load_agate_table() -%}\n  -- grab current tables grants config for comparison later on\n\n  {%- do store_result('agate_table', response='OK', agate_table=agate_table) -%}\n\n  {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n  -- `BEGIN` happens here:\n  {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n  -- build model\n  {% set create_table_sql = \"\" %}\n  {% if exists_as_view %}\n    {{ exceptions.raise_compiler_error(\"Cannot seed to '{}', it is a view\".format(old_relation)) }}\n  {% elif exists_as_table %}\n    {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %}\n  {% else %}\n    {% set create_table_sql = create_csv_table(model, agate_table) %}\n  {% endif %}\n\n  {% set code = 'CREATE' if full_refresh_mode else 'INSERT' %}\n  {% set rows_affected = (agate_table.rows | length) %}\n  {% set sql = load_csv_rows(model, agate_table) %}\n\n  {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %}\n    {{ get_csv_sql(create_table_sql, sql) }};\n  {% endcall %}\n\n  {% set target_relation = this.incorporate(type='table') %}\n\n  {% set should_revoke = should_revoke(old_relation, full_refresh_mode) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {% do persist_docs(target_relation, model) %}\n\n  {% if full_refresh_mode or not exists_as_table %}\n    {% do create_indexes(target_relation) %}\n  {% endif %}\n\n  {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n  -- `COMMIT` happens here\n  {{ adapter.commit() }}\n\n  {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.run_hooks", "macro.dbt.reset_csv_table", "macro.dbt.create_csv_table", "macro.dbt.load_csv_rows", "macro.dbt.noop_statement", "macro.dbt.get_csv_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.400613, "supported_languages": ["sql"]}, "macro.dbt.create_csv_table": {"name": "create_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n  {{ adapter.dispatch('create_csv_table', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4056692, "supported_languages": null}, "macro.dbt.default__create_csv_table": {"name": "default__create_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__create_csv_table", "macro_sql": "{% macro default__create_csv_table(model, agate_table) %}\n  {%- set column_override = model['config'].get('column_types', {}) -%}\n  {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n\n  {% set sql %}\n    create table {{ this.render() }} (\n        {%- for col_name in agate_table.column_names -%}\n            {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}\n            {%- set type = column_override.get(col_name, inferred_type) -%}\n            {%- set column_name = (col_name | string) -%}\n            {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%}\n        {%- endfor -%}\n    )\n  {% endset %}\n\n  {% call statement('_') -%}\n    {{ sql }}\n  {%- endcall %}\n\n  {{ return(sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4065752, "supported_languages": null}, "macro.dbt.reset_csv_table": {"name": "reset_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n  {{ adapter.dispatch('reset_csv_table', 'dbt')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__reset_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4068139, "supported_languages": null}, "macro.dbt.default__reset_csv_table": {"name": "default__reset_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__reset_csv_table", "macro_sql": "{% macro default__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n    {% set sql = \"\" %}\n    {% if full_refresh %}\n        {{ adapter.drop_relation(old_relation) }}\n        {% set sql = create_csv_table(model, agate_table) %}\n    {% else %}\n        {{ adapter.truncate_relation(old_relation) }}\n        {% set sql = \"truncate table \" ~ old_relation %}\n    {% endif %}\n\n    {{ return(sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.407299, "supported_languages": null}, "macro.dbt.get_csv_sql": {"name": "get_csv_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_csv_sql", "macro_sql": "{% macro get_csv_sql(create_or_truncate_sql, insert_sql) %}\n    {{ adapter.dispatch('get_csv_sql', 'dbt')(create_or_truncate_sql, insert_sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_csv_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.407493, "supported_languages": null}, "macro.dbt.default__get_csv_sql": {"name": "default__get_csv_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_csv_sql", "macro_sql": "{% macro default__get_csv_sql(create_or_truncate_sql, insert_sql) %}\n    {{ create_or_truncate_sql }};\n    -- dbt seed --\n    {{ insert_sql }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.407629, "supported_languages": null}, "macro.dbt.get_binding_char": {"name": "get_binding_char", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_binding_char", "macro_sql": "{% macro get_binding_char() -%}\n  {{ adapter.dispatch('get_binding_char', 'dbt')() }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4077692, "supported_languages": null}, "macro.dbt.default__get_binding_char": {"name": "default__get_binding_char", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_binding_char", "macro_sql": "{% macro default__get_binding_char() %}\n  {{ return('%s') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.407886, "supported_languages": null}, "macro.dbt.get_batch_size": {"name": "get_batch_size", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_batch_size", "macro_sql": "{% macro get_batch_size() -%}\n  {{ return(adapter.dispatch('get_batch_size', 'dbt')()) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_batch_size"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4080482, "supported_languages": null}, "macro.dbt.default__get_batch_size": {"name": "default__get_batch_size", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_batch_size", "macro_sql": "{% macro default__get_batch_size() %}\n  {{ return(10000) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4081652, "supported_languages": null}, "macro.dbt.get_seed_column_quoted_csv": {"name": "get_seed_column_quoted_csv", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_seed_column_quoted_csv", "macro_sql": "{% macro get_seed_column_quoted_csv(model, column_names) %}\n  {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n    {% set quoted = [] %}\n    {% for col in column_names -%}\n        {%- do quoted.append(adapter.quote_seed_column(col, quote_seed_column)) -%}\n    {%- endfor %}\n\n    {%- set dest_cols_csv = quoted | join(', ') -%}\n    {{ return(dest_cols_csv) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4086468, "supported_languages": null}, "macro.dbt.load_csv_rows": {"name": "load_csv_rows", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n  {{ adapter.dispatch('load_csv_rows', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.408831, "supported_languages": null}, "macro.dbt.default__load_csv_rows": {"name": "default__load_csv_rows", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__load_csv_rows", "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n\n  {% set batch_size = get_batch_size() %}\n\n  {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n  {% set bindings = [] %}\n\n  {% set statements = [] %}\n\n  {% for chunk in agate_table.rows | batch(batch_size) %}\n      {% set bindings = [] %}\n\n      {% for row in chunk %}\n          {% do bindings.extend(row) %}\n      {% endfor %}\n\n      {% set sql %}\n          insert into {{ this.render() }} ({{ cols_sql }}) values\n          {% for row in chunk -%}\n              ({%- for column in agate_table.column_names -%}\n                  {{ get_binding_char() }}\n                  {%- if not loop.last%},{%- endif %}\n              {%- endfor -%})\n              {%- if not loop.last%},{%- endif %}\n          {%- endfor %}\n      {% endset %}\n\n      {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n\n      {% if loop.index0 == 0 %}\n          {% do statements.append(sql) %}\n      {% endif %}\n  {% endfor %}\n\n  {# Return SQL so we can render it out into the compiled files #}\n  {{ return(statements[0]) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv", "macro.dbt.get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.410136, "supported_languages": null}, "macro.dbt.generate_alias_name": {"name": "generate_alias_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "unique_id": "macro.dbt.generate_alias_name", "macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n    {% do return(adapter.dispatch('generate_alias_name', 'dbt')(custom_alias_name, node)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_alias_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.410573, "supported_languages": null}, "macro.dbt.default__generate_alias_name": {"name": "default__generate_alias_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "unique_id": "macro.dbt.default__generate_alias_name", "macro_sql": "{% macro default__generate_alias_name(custom_alias_name=none, node=none) -%}\n\n    {%- if custom_alias_name -%}\n\n        {{ custom_alias_name | trim }}\n\n    {%- elif node.version -%}\n\n        {{ return(node.name ~ \"_v\" ~ (node.version | replace(\".\", \"_\"))) }}\n\n    {%- else -%}\n\n        {{ node.name }}\n\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.410958, "supported_languages": null}, "macro.dbt.generate_schema_name": {"name": "generate_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name=none, node=none) -%}\n    {{ return(adapter.dispatch('generate_schema_name', 'dbt')(custom_schema_name, node)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.411478, "supported_languages": null}, "macro.dbt.default__generate_schema_name": {"name": "default__generate_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.default__generate_schema_name", "macro_sql": "{% macro default__generate_schema_name(custom_schema_name, node) -%}\n\n    {%- set default_schema = target.schema -%}\n    {%- if custom_schema_name is none -%}\n\n        {{ default_schema }}\n\n    {%- else -%}\n\n        {{ default_schema }}_{{ custom_schema_name | trim }}\n\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4117398, "supported_languages": null}, "macro.dbt.generate_schema_name_for_env": {"name": "generate_schema_name_for_env", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.generate_schema_name_for_env", "macro_sql": "{% macro generate_schema_name_for_env(custom_schema_name, node) -%}\n\n    {%- set default_schema = target.schema -%}\n    {%- if target.name == 'prod' and custom_schema_name is not none -%}\n\n        {{ custom_schema_name | trim }}\n\n    {%- else -%}\n\n        {{ default_schema }}\n\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.412024, "supported_languages": null}, "macro.dbt.generate_database_name": {"name": "generate_database_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "unique_id": "macro.dbt.generate_database_name", "macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n    {% do return(adapter.dispatch('generate_database_name', 'dbt')(custom_database_name, node)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.41243, "supported_languages": null}, "macro.dbt.default__generate_database_name": {"name": "default__generate_database_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "unique_id": "macro.dbt.default__generate_database_name", "macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n    {%- set default_database = target.database -%}\n    {%- if custom_database_name is none -%}\n\n        {{ default_database }}\n\n    {%- else -%}\n\n        {{ custom_database_name }}\n\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.412687, "supported_languages": null}, "macro.dbt.get_drop_sql": {"name": "get_drop_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.get_drop_sql", "macro_sql": "{%- macro get_drop_sql(relation) -%}\n    {{- log('Applying DROP to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_drop_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.413396, "supported_languages": null}, "macro.dbt.default__get_drop_sql": {"name": "default__get_drop_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.default__get_drop_sql", "macro_sql": "{%- macro default__get_drop_sql(relation) -%}\n\n    {%- if relation.is_view -%}\n        {{ drop_view(relation) }}\n\n    {%- elif relation.is_table -%}\n        {{ drop_table(relation) }}\n\n    {%- elif relation.is_materialized_view -%}\n        {{ drop_materialized_view(relation) }}\n\n    {%- else -%}\n        drop {{ relation.type }} if exists {{ relation }} cascade\n\n    {%- endif -%}\n\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.drop_view", "macro.dbt.drop_table", "macro.dbt.drop_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.413764, "supported_languages": null}, "macro.dbt.drop_relation": {"name": "drop_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n    {{ return(adapter.dispatch('drop_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.413953, "supported_languages": null}, "macro.dbt.default__drop_relation": {"name": "default__drop_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.default__drop_relation", "macro_sql": "{% macro default__drop_relation(relation) -%}\n    {% call statement('drop_relation', auto_begin=False) -%}\n        {{ get_drop_sql(relation) }}\n    {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.414161, "supported_languages": null}, "macro.dbt.drop_relation_if_exists": {"name": "drop_relation_if_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.drop_relation_if_exists", "macro_sql": "{% macro drop_relation_if_exists(relation) %}\n  {% if relation is not none %}\n    {{ adapter.drop_relation(relation) }}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.414359, "supported_languages": null}, "macro.dbt.get_replace_sql": {"name": "get_replace_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/replace.sql", "original_file_path": "macros/relations/replace.sql", "unique_id": "macro.dbt.get_replace_sql", "macro_sql": "{% macro get_replace_sql(existing_relation, target_relation, sql) %}\n    {{- log('Applying REPLACE to: ' ~ existing_relation) -}}\n    {{- adapter.dispatch('get_replace_sql', 'dbt')(existing_relation, target_relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_replace_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.415138, "supported_languages": null}, "macro.dbt.default__get_replace_sql": {"name": "default__get_replace_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/replace.sql", "original_file_path": "macros/relations/replace.sql", "unique_id": "macro.dbt.default__get_replace_sql", "macro_sql": "{% macro default__get_replace_sql(existing_relation, target_relation, sql) %}\n\n    {# /* use a create or replace statement if possible */ #}\n\n    {% set is_replaceable = existing_relation.type == target_relation_type and existing_relation.can_be_replaced %}\n\n    {% if is_replaceable and existing_relation.is_view %}\n        {{ get_replace_view_sql(target_relation, sql) }}\n\n    {% elif is_replaceable and existing_relation.is_table %}\n        {{ get_replace_table_sql(target_relation, sql) }}\n\n    {% elif is_replaceable and existing_relation.is_materialized_view %}\n        {{ get_replace_materialized_view_sql(target_relation, sql) }}\n\n    {# /* a create or replace statement is not possible, so try to stage and/or backup to be safe */ #}\n\n    {# /* create target_relation as an intermediate relation, then swap it out with the existing one using a backup */ #}\n    {%- elif target_relation.can_be_renamed and existing_relation.can_be_renamed -%}\n        {{ get_create_intermediate_sql(target_relation, sql) }};\n        {{ get_create_backup_sql(existing_relation) }};\n        {{ get_rename_intermediate_sql(target_relation) }};\n        {{ get_drop_backup_sql(existing_relation) }}\n\n    {# /* create target_relation as an intermediate relation, then swap it out with the existing one without using a backup */ #}\n    {%- elif target_relation.can_be_renamed -%}\n        {{ get_create_intermediate_sql(target_relation, sql) }};\n        {{ get_drop_sql(existing_relation) }};\n        {{ get_rename_intermediate_sql(target_relation) }}\n\n    {# /* create target_relation in place by first backing up the existing relation */ #}\n    {%- elif existing_relation.can_be_renamed -%}\n        {{ get_create_backup_sql(existing_relation) }};\n        {{ get_create_sql(target_relation, sql) }};\n        {{ get_drop_backup_sql(existing_relation) }}\n\n    {# /* no renaming is allowed, so just drop and create */ #}\n    {%- else -%}\n        {{ get_drop_sql(existing_relation) }};\n        {{ get_create_sql(target_relation, sql) }}\n\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_replace_view_sql", "macro.dbt.get_replace_table_sql", "macro.dbt.get_replace_materialized_view_sql", "macro.dbt.get_create_intermediate_sql", "macro.dbt.get_create_backup_sql", "macro.dbt.get_rename_intermediate_sql", "macro.dbt.get_drop_backup_sql", "macro.dbt.get_drop_sql", "macro.dbt.get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.41643, "supported_languages": null}, "macro.dbt.get_create_intermediate_sql": {"name": "get_create_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_intermediate.sql", "original_file_path": "macros/relations/create_intermediate.sql", "unique_id": "macro.dbt.get_create_intermediate_sql", "macro_sql": "{%- macro get_create_intermediate_sql(relation, sql) -%}\n    {{- log('Applying CREATE INTERMEDIATE to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_create_intermediate_sql', 'dbt')(relation, sql) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_create_intermediate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.416814, "supported_languages": null}, "macro.dbt.default__get_create_intermediate_sql": {"name": "default__get_create_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_intermediate.sql", "original_file_path": "macros/relations/create_intermediate.sql", "unique_id": "macro.dbt.default__get_create_intermediate_sql", "macro_sql": "{%- macro default__get_create_intermediate_sql(relation, sql) -%}\n\n    -- get the standard intermediate name\n    {% set intermediate_relation = make_intermediate_relation(relation) %}\n\n    -- drop any pre-existing intermediate\n    {{ get_drop_sql(intermediate_relation) }};\n\n    {{ get_create_sql(intermediate_relation, sql) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_intermediate_relation", "macro.dbt.get_drop_sql", "macro.dbt.get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.417069, "supported_languages": null}, "macro.dbt.get_drop_backup_sql": {"name": "get_drop_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop_backup.sql", "original_file_path": "macros/relations/drop_backup.sql", "unique_id": "macro.dbt.get_drop_backup_sql", "macro_sql": "{%- macro get_drop_backup_sql(relation) -%}\n    {{- log('Applying DROP BACKUP to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_drop_backup_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_drop_backup_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4173892, "supported_languages": null}, "macro.dbt.default__get_drop_backup_sql": {"name": "default__get_drop_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop_backup.sql", "original_file_path": "macros/relations/drop_backup.sql", "unique_id": "macro.dbt.default__get_drop_backup_sql", "macro_sql": "{%- macro default__get_drop_backup_sql(relation) -%}\n\n    -- get the standard backup name\n    {% set backup_relation = make_backup_relation(relation, relation.type) %}\n\n    {{ get_drop_sql(backup_relation) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_backup_relation", "macro.dbt.get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.417598, "supported_languages": null}, "macro.dbt.get_rename_sql": {"name": "get_rename_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.get_rename_sql", "macro_sql": "{%- macro get_rename_sql(relation, new_name) -%}\n    {{- log('Applying RENAME to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_rename_sql', 'dbt')(relation, new_name) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.418307, "supported_languages": null}, "macro.dbt.default__get_rename_sql": {"name": "default__get_rename_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.default__get_rename_sql", "macro_sql": "{%- macro default__get_rename_sql(relation, new_name) -%}\n\n    {%- if relation.is_view -%}\n        {{ get_rename_view_sql(relation, new_name) }}\n\n    {%- elif relation.is_table -%}\n        {{ get_rename_table_sql(relation, new_name) }}\n\n    {%- elif relation.is_materialized_view -%}\n        {{ get_rename_materialized_view_sql(relation, new_name) }}\n\n    {%- else -%}\n        {{- exceptions.raise_compiler_error(\"`get_rename_sql` has not been implemented for: \" ~ relation.type ) -}}\n\n    {%- endif -%}\n\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.get_rename_view_sql", "macro.dbt.get_rename_table_sql", "macro.dbt.get_rename_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.418746, "supported_languages": null}, "macro.dbt.rename_relation": {"name": "rename_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n  {{ return(adapter.dispatch('rename_relation', 'dbt')(from_relation, to_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__rename_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.418957, "supported_languages": null}, "macro.dbt.default__rename_relation": {"name": "default__rename_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.default__rename_relation", "macro_sql": "{% macro default__rename_relation(from_relation, to_relation) -%}\n  {% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}\n  {% call statement('rename_relation') -%}\n    alter table {{ from_relation }} rename to {{ target_name }}\n  {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.419244, "supported_languages": null}, "macro.dbt.get_create_backup_sql": {"name": "get_create_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_backup.sql", "original_file_path": "macros/relations/create_backup.sql", "unique_id": "macro.dbt.get_create_backup_sql", "macro_sql": "{%- macro get_create_backup_sql(relation) -%}\n    {{- log('Applying CREATE BACKUP to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_create_backup_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_create_backup_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4195929, "supported_languages": null}, "macro.dbt.default__get_create_backup_sql": {"name": "default__get_create_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_backup.sql", "original_file_path": "macros/relations/create_backup.sql", "unique_id": "macro.dbt.default__get_create_backup_sql", "macro_sql": "{%- macro default__get_create_backup_sql(relation) -%}\n\n    -- get the standard backup name\n    {% set backup_relation = make_backup_relation(relation, relation.type) %}\n\n    -- drop any pre-existing backup\n    {{ get_drop_sql(backup_relation) }};\n\n    {{ get_rename_sql(relation, backup_relation.identifier) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_backup_relation", "macro.dbt.get_drop_sql", "macro.dbt.get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4198651, "supported_languages": null}, "macro.dbt.get_create_sql": {"name": "get_create_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create.sql", "original_file_path": "macros/relations/create.sql", "unique_id": "macro.dbt.get_create_sql", "macro_sql": "{%- macro get_create_sql(relation, sql) -%}\n    {{- log('Applying CREATE to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_create_sql', 'dbt')(relation, sql) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.420342, "supported_languages": null}, "macro.dbt.default__get_create_sql": {"name": "default__get_create_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create.sql", "original_file_path": "macros/relations/create.sql", "unique_id": "macro.dbt.default__get_create_sql", "macro_sql": "{%- macro default__get_create_sql(relation, sql) -%}\n\n    {%- if relation.is_view -%}\n        {{ get_create_view_as_sql(relation, sql) }}\n\n    {%- elif relation.is_table -%}\n        {{ get_create_table_as_sql(False, relation, sql) }}\n\n    {%- elif relation.is_materialized_view -%}\n        {{ get_create_materialized_view_as_sql(relation, sql) }}\n\n    {%- else -%}\n        {{- exceptions.raise_compiler_error(\"`get_create_sql` has not been implemented for: \" ~ relation.type ) -}}\n\n    {%- endif -%}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.get_create_view_as_sql", "macro.dbt.get_create_table_as_sql", "macro.dbt.get_create_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.42079, "supported_languages": null}, "macro.dbt.get_rename_intermediate_sql": {"name": "get_rename_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename_intermediate.sql", "original_file_path": "macros/relations/rename_intermediate.sql", "unique_id": "macro.dbt.get_rename_intermediate_sql", "macro_sql": "{%- macro get_rename_intermediate_sql(relation) -%}\n    {{- log('Applying RENAME INTERMEDIATE to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_rename_intermediate_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_rename_intermediate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4211168, "supported_languages": null}, "macro.dbt.default__get_rename_intermediate_sql": {"name": "default__get_rename_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename_intermediate.sql", "original_file_path": "macros/relations/rename_intermediate.sql", "unique_id": "macro.dbt.default__get_rename_intermediate_sql", "macro_sql": "{%- macro default__get_rename_intermediate_sql(relation) -%}\n\n    -- get the standard intermediate name\n    {% set intermediate_relation = make_intermediate_relation(relation) %}\n\n    {{ get_rename_sql(intermediate_relation, relation.identifier) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_intermediate_relation", "macro.dbt.get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4213262, "supported_languages": null}, "macro.dbt.drop_materialized_view": {"name": "drop_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/drop.sql", "original_file_path": "macros/relations/materialized_view/drop.sql", "unique_id": "macro.dbt.drop_materialized_view", "macro_sql": "{% macro drop_materialized_view(relation) -%}\n    {{ return(adapter.dispatch('drop_materialized_view', 'dbt')(relation)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__drop_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.421603, "supported_languages": null}, "macro.dbt.default__drop_materialized_view": {"name": "default__drop_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/drop.sql", "original_file_path": "macros/relations/materialized_view/drop.sql", "unique_id": "macro.dbt.default__drop_materialized_view", "macro_sql": "{% macro default__drop_materialized_view(relation) -%}\n    drop materialized view if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4217112, "supported_languages": null}, "macro.dbt.get_replace_materialized_view_sql": {"name": "get_replace_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/replace.sql", "original_file_path": "macros/relations/materialized_view/replace.sql", "unique_id": "macro.dbt.get_replace_materialized_view_sql", "macro_sql": "{% macro get_replace_materialized_view_sql(relation, sql) %}\n    {{- adapter.dispatch('get_replace_materialized_view_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_replace_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.421985, "supported_languages": null}, "macro.dbt.default__get_replace_materialized_view_sql": {"name": "default__get_replace_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/replace.sql", "original_file_path": "macros/relations/materialized_view/replace.sql", "unique_id": "macro.dbt.default__get_replace_materialized_view_sql", "macro_sql": "{% macro default__get_replace_materialized_view_sql(relation, sql) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_replace_materialized_view_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.422137, "supported_languages": null}, "macro.dbt.refresh_materialized_view": {"name": "refresh_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/refresh.sql", "original_file_path": "macros/relations/materialized_view/refresh.sql", "unique_id": "macro.dbt.refresh_materialized_view", "macro_sql": "{% macro refresh_materialized_view(relation) %}\n    {{- log('Applying REFRESH to: ' ~ relation) -}}\n    {{- adapter.dispatch('refresh_materialized_view', 'dbt')(relation) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__refresh_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4224489, "supported_languages": null}, "macro.dbt.default__refresh_materialized_view": {"name": "default__refresh_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/refresh.sql", "original_file_path": "macros/relations/materialized_view/refresh.sql", "unique_id": "macro.dbt.default__refresh_materialized_view", "macro_sql": "{% macro default__refresh_materialized_view(relation) %}\n    {{ exceptions.raise_compiler_error(\"`refresh_materialized_view` has not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.42265, "supported_languages": null}, "macro.dbt.get_rename_materialized_view_sql": {"name": "get_rename_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/rename.sql", "original_file_path": "macros/relations/materialized_view/rename.sql", "unique_id": "macro.dbt.get_rename_materialized_view_sql", "macro_sql": "{% macro get_rename_materialized_view_sql(relation, new_name) %}\n    {{- adapter.dispatch('get_rename_materialized_view_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_rename_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.422923, "supported_languages": null}, "macro.dbt.default__get_rename_materialized_view_sql": {"name": "default__get_rename_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/rename.sql", "original_file_path": "macros/relations/materialized_view/rename.sql", "unique_id": "macro.dbt.default__get_rename_materialized_view_sql", "macro_sql": "{% macro default__get_rename_materialized_view_sql(relation, new_name) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_rename_materialized_view_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.423073, "supported_languages": null}, "macro.dbt.get_alter_materialized_view_as_sql": {"name": "get_alter_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.get_alter_materialized_view_as_sql", "macro_sql": "{% macro get_alter_materialized_view_as_sql(\n    relation,\n    configuration_changes,\n    sql,\n    existing_relation,\n    backup_relation,\n    intermediate_relation\n) %}\n    {{- log('Applying ALTER to: ' ~ relation) -}}\n    {{- adapter.dispatch('get_alter_materialized_view_as_sql', 'dbt')(\n        relation,\n        configuration_changes,\n        sql,\n        existing_relation,\n        backup_relation,\n        intermediate_relation\n    ) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_alter_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.423689, "supported_languages": null}, "macro.dbt.default__get_alter_materialized_view_as_sql": {"name": "default__get_alter_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.default__get_alter_materialized_view_as_sql", "macro_sql": "{% macro default__get_alter_materialized_view_as_sql(\n    relation,\n    configuration_changes,\n    sql,\n    existing_relation,\n    backup_relation,\n    intermediate_relation\n) %}\n    {{ exceptions.raise_compiler_error(\"Materialized views have not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4238799, "supported_languages": null}, "macro.dbt.get_materialized_view_configuration_changes": {"name": "get_materialized_view_configuration_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.get_materialized_view_configuration_changes", "macro_sql": "{% macro get_materialized_view_configuration_changes(existing_relation, new_config) %}\n    /* {#\n    It's recommended that configuration changes be formatted as follows:\n    {\"<change_category>\": [{\"action\": \"<name>\", \"context\": ...}]}\n\n    For example:\n    {\n        \"indexes\": [\n            {\"action\": \"drop\", \"context\": \"index_abc\"},\n            {\"action\": \"create\", \"context\": {\"columns\": [\"column_1\", \"column_2\"], \"type\": \"hash\", \"unique\": True}},\n        ],\n    }\n\n    Either way, `get_materialized_view_configuration_changes` needs to align with `get_alter_materialized_view_as_sql`.\n    #} */\n    {{- log('Determining configuration changes on: ' ~ existing_relation) -}}\n    {%- do return(adapter.dispatch('get_materialized_view_configuration_changes', 'dbt')(existing_relation, new_config)) -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_materialized_view_configuration_changes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.424198, "supported_languages": null}, "macro.dbt.default__get_materialized_view_configuration_changes": {"name": "default__get_materialized_view_configuration_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.default__get_materialized_view_configuration_changes", "macro_sql": "{% macro default__get_materialized_view_configuration_changes(existing_relation, new_config) %}\n    {{ exceptions.raise_compiler_error(\"Materialized views have not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4243479, "supported_languages": null}, "macro.dbt.get_create_materialized_view_as_sql": {"name": "get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/create.sql", "original_file_path": "macros/relations/materialized_view/create.sql", "unique_id": "macro.dbt.get_create_materialized_view_as_sql", "macro_sql": "{% macro get_create_materialized_view_as_sql(relation, sql) -%}\n    {{- adapter.dispatch('get_create_materialized_view_as_sql', 'dbt')(relation, sql) -}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_create_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4246268, "supported_languages": null}, "macro.dbt.default__get_create_materialized_view_as_sql": {"name": "default__get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/create.sql", "original_file_path": "macros/relations/materialized_view/create.sql", "unique_id": "macro.dbt.default__get_create_materialized_view_as_sql", "macro_sql": "{% macro default__get_create_materialized_view_as_sql(relation, sql) -%}\n    {{ exceptions.raise_compiler_error(\n        \"`get_create_materialized_view_as_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.42477, "supported_languages": null}, "macro.dbt.get_table_columns_and_constraints": {"name": "get_table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.get_table_columns_and_constraints", "macro_sql": "{%- macro get_table_columns_and_constraints() -%}\n  {{ adapter.dispatch('get_table_columns_and_constraints', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__get_table_columns_and_constraints"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.425772, "supported_languages": null}, "macro.dbt.default__get_table_columns_and_constraints": {"name": "default__get_table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__get_table_columns_and_constraints", "macro_sql": "{% macro default__get_table_columns_and_constraints() -%}\n  {{ return(table_columns_and_constraints()) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.table_columns_and_constraints"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.425895, "supported_languages": null}, "macro.dbt.table_columns_and_constraints": {"name": "table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.table_columns_and_constraints", "macro_sql": "{% macro table_columns_and_constraints() %}\n  {# loop through user_provided_columns to create DDL with data types and constraints #}\n    {%- set raw_column_constraints = adapter.render_raw_columns_constraints(raw_columns=model['columns']) -%}\n    {%- set raw_model_constraints = adapter.render_raw_model_constraints(raw_constraints=model['constraints']) -%}\n    (\n    {% for c in raw_column_constraints -%}\n      {{ c }}{{ \",\" if not loop.last or raw_model_constraints }}\n    {% endfor %}\n    {% for c in raw_model_constraints -%}\n        {{ c }}{{ \",\" if not loop.last }}\n    {% endfor -%}\n    )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4264388, "supported_languages": null}, "macro.dbt.get_assert_columns_equivalent": {"name": "get_assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.get_assert_columns_equivalent", "macro_sql": "\n\n{%- macro get_assert_columns_equivalent(sql) -%}\n  {{ adapter.dispatch('get_assert_columns_equivalent', 'dbt')(sql) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.426614, "supported_languages": null}, "macro.dbt.default__get_assert_columns_equivalent": {"name": "default__get_assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__get_assert_columns_equivalent", "macro_sql": "{% macro default__get_assert_columns_equivalent(sql) -%}\n  {{ return(assert_columns_equivalent(sql)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.426751, "supported_languages": null}, "macro.dbt.assert_columns_equivalent": {"name": "assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.assert_columns_equivalent", "macro_sql": "{% macro assert_columns_equivalent(sql) %}\n\n  {#-- First ensure the user has defined 'columns' in yaml specification --#}\n  {%- set user_defined_columns = model['columns'] -%}\n  {%- if not user_defined_columns -%}\n      {{ exceptions.raise_contract_error([], []) }}\n  {%- endif -%}\n\n  {#-- Obtain the column schema provided by sql file. #}\n  {%- set sql_file_provided_columns = get_column_schema_from_query(sql, config.get('sql_header', none)) -%}\n  {#--Obtain the column schema provided by the schema file by generating an 'empty schema' query from the model's columns. #}\n  {%- set schema_file_provided_columns = get_column_schema_from_query(get_empty_schema_sql(user_defined_columns)) -%}\n\n  {#-- create dictionaries with name and formatted data type and strings for exception #}\n  {%- set sql_columns = format_columns(sql_file_provided_columns) -%}\n  {%- set yaml_columns = format_columns(schema_file_provided_columns)  -%}\n\n  {%- if sql_columns|length != yaml_columns|length -%}\n    {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n  {%- endif -%}\n\n  {%- for sql_col in sql_columns -%}\n    {%- set yaml_col = [] -%}\n    {%- for this_col in yaml_columns -%}\n      {%- if this_col['name'] == sql_col['name'] -%}\n        {%- do yaml_col.append(this_col) -%}\n        {%- break -%}\n      {%- endif -%}\n    {%- endfor -%}\n    {%- if not yaml_col -%}\n      {#-- Column with name not found in yaml #}\n      {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n    {%- endif -%}\n    {%- if sql_col['formatted'] != yaml_col[0]['formatted'] -%}\n      {#-- Column data types don't match #}\n      {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n    {%- endif -%}\n  {%- endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_column_schema_from_query", "macro.dbt.get_empty_schema_sql", "macro.dbt.format_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.428108, "supported_languages": null}, "macro.dbt.format_columns": {"name": "format_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.format_columns", "macro_sql": "{% macro format_columns(columns) %}\n  {% set formatted_columns = [] %}\n  {% for column in columns %}\n    {%- set formatted_column = adapter.dispatch('format_column', 'dbt')(column) -%}\n    {%- do formatted_columns.append(formatted_column) -%}\n  {% endfor %}\n  {{ return(formatted_columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__format_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.428511, "supported_languages": null}, "macro.dbt.default__format_column": {"name": "default__format_column", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__format_column", "macro_sql": "{% macro default__format_column(column) -%}\n  {% set data_type = column.dtype %}\n  {% set formatted = column.column.lower() ~ \" \" ~ data_type %}\n  {{ return({'name': column.name, 'data_type': data_type, 'formatted': formatted}) }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.428858, "supported_languages": null}, "macro.dbt.drop_table": {"name": "drop_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt.drop_table", "macro_sql": "{% macro drop_table(relation) -%}\n    {{ return(adapter.dispatch('drop_table', 'dbt')(relation)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__drop_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4291258, "supported_languages": null}, "macro.dbt.default__drop_table": {"name": "default__drop_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt.default__drop_table", "macro_sql": "{% macro default__drop_table(relation) -%}\n    drop table if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.42923, "supported_languages": null}, "macro.dbt.get_replace_table_sql": {"name": "get_replace_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt.get_replace_table_sql", "macro_sql": "{% macro get_replace_table_sql(relation, sql) %}\n    {{- adapter.dispatch('get_replace_table_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_replace_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4295008, "supported_languages": null}, "macro.dbt.default__get_replace_table_sql": {"name": "default__get_replace_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt.default__get_replace_table_sql", "macro_sql": "{% macro default__get_replace_table_sql(relation, sql) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_replace_table_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4296489, "supported_languages": null}, "macro.dbt.get_rename_table_sql": {"name": "get_rename_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt.get_rename_table_sql", "macro_sql": "{% macro get_rename_table_sql(relation, new_name) %}\n    {{- adapter.dispatch('get_rename_table_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_rename_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.42992, "supported_languages": null}, "macro.dbt.default__get_rename_table_sql": {"name": "default__get_rename_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt.default__get_rename_table_sql", "macro_sql": "{% macro default__get_rename_table_sql(relation, new_name) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_rename_table_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.430071, "supported_languages": null}, "macro.dbt.get_create_table_as_sql": {"name": "get_create_table_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.get_create_table_as_sql", "macro_sql": "{% macro get_create_table_as_sql(temporary, relation, sql) -%}\n  {{ adapter.dispatch('get_create_table_as_sql', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_table_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.430926, "supported_languages": null}, "macro.dbt.default__get_create_table_as_sql": {"name": "default__get_create_table_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_create_table_as_sql", "macro_sql": "{% macro default__get_create_table_as_sql(temporary, relation, sql) -%}\n  {{ return(create_table_as(temporary, relation, sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4311109, "supported_languages": null}, "macro.dbt.create_table_as": {"name": "create_table_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, compiled_code, language='sql') -%}\n  {# backward compatibility for create_table_as that does not support language #}\n  {% if language == \"sql\" %}\n    {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, compiled_code)}}\n  {% else %}\n    {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, compiled_code, language) }}\n  {% endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4315488, "supported_languages": null}, "macro.dbt.default__create_table_as": {"name": "default__create_table_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__create_table_as", "macro_sql": "{% macro default__create_table_as(temporary, relation, sql) -%}\n  {%- set sql_header = config.get('sql_header', none) -%}\n\n  {{ sql_header if sql_header is not none }}\n\n  create {% if temporary: -%}temporary{%- endif %} table\n    {{ relation.include(database=(not temporary), schema=(not temporary)) }}\n  {% set contract_config = config.get('contract') %}\n  {% if contract_config.enforced and (not temporary) %}\n    {{ get_assert_columns_equivalent(sql) }}\n    {{ get_table_columns_and_constraints() }}\n    {%- set sql = get_select_subquery(sql) %}\n  {% endif %}\n  as (\n    {{ sql }}\n  );\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent", "macro.dbt.get_table_columns_and_constraints", "macro.dbt.get_select_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.432266, "supported_languages": null}, "macro.dbt.default__get_column_names": {"name": "default__get_column_names", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_column_names", "macro_sql": "{% macro default__get_column_names() %}\n  {#- loop through user_provided_columns to get column names -#}\n    {%- set user_provided_columns = model['columns'] -%}\n    {%- for i in user_provided_columns %}\n      {%- set col = user_provided_columns[i] -%}\n      {%- set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] -%}\n      {{ col_name }}{{ \", \" if not loop.last }}\n    {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.432737, "supported_languages": null}, "macro.dbt.get_select_subquery": {"name": "get_select_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.get_select_subquery", "macro_sql": "{% macro get_select_subquery(sql) %}\n  {{ return(adapter.dispatch('get_select_subquery', 'dbt')(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_select_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.432926, "supported_languages": null}, "macro.dbt.default__get_select_subquery": {"name": "default__get_select_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_select_subquery", "macro_sql": "{% macro default__get_select_subquery(sql) %}\n    select {{ adapter.dispatch('get_column_names', 'dbt')() }}\n    from (\n        {{ sql }}\n    ) as model_subq\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_column_names"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4331079, "supported_languages": null}, "macro.dbt.drop_view": {"name": "drop_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt.drop_view", "macro_sql": "{% macro drop_view(relation) -%}\n    {{ return(adapter.dispatch('drop_view', 'dbt')(relation)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__drop_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.433374, "supported_languages": null}, "macro.dbt.default__drop_view": {"name": "default__drop_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt.default__drop_view", "macro_sql": "{% macro default__drop_view(relation) -%}\n    drop view if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.433481, "supported_languages": null}, "macro.dbt.get_replace_view_sql": {"name": "get_replace_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.get_replace_view_sql", "macro_sql": "{% macro get_replace_view_sql(relation, sql) %}\n    {{- adapter.dispatch('get_replace_view_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_replace_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.434345, "supported_languages": null}, "macro.dbt.default__get_replace_view_sql": {"name": "default__get_replace_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.default__get_replace_view_sql", "macro_sql": "{% macro default__get_replace_view_sql(relation, sql) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_replace_view_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.434494, "supported_languages": null}, "macro.dbt.create_or_replace_view": {"name": "create_or_replace_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.create_or_replace_view", "macro_sql": "{% macro create_or_replace_view() %}\n  {%- set identifier = model['alias'] -%}\n\n  {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n  {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n  {%- set target_relation = api.Relation.create(\n      identifier=identifier, schema=schema, database=database,\n      type='view') -%}\n  {% set grant_config = config.get('grants') %}\n\n  {{ run_hooks(pre_hooks) }}\n\n  -- If there's a table with the same name and we weren't told to full refresh,\n  -- that's an error. If we were told to full refresh, drop it. This behavior differs\n  -- for Snowflake and BigQuery, so multiple dispatch is used.\n  {%- if old_relation is not none and old_relation.is_table -%}\n    {{ handle_existing_table(should_full_refresh(), old_relation) }}\n  {%- endif -%}\n\n  -- build model\n  {% call statement('main') -%}\n    {{ get_create_view_as_sql(target_relation, sql) }}\n  {%- endcall %}\n\n  {% set should_revoke = should_revoke(exists_as_view, full_refresh_mode=True) %}\n  {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n  {{ run_hooks(post_hooks) }}\n\n  {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4357052, "supported_languages": null}, "macro.dbt.handle_existing_table": {"name": "handle_existing_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n    {{ adapter.dispatch('handle_existing_table', 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__handle_existing_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.43591, "supported_languages": null}, "macro.dbt.default__handle_existing_table": {"name": "default__handle_existing_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n    {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n    {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.436136, "supported_languages": null}, "macro.dbt.get_rename_view_sql": {"name": "get_rename_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt.get_rename_view_sql", "macro_sql": "{% macro get_rename_view_sql(relation, new_name) %}\n    {{- adapter.dispatch('get_rename_view_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_rename_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.436414, "supported_languages": null}, "macro.dbt.default__get_rename_view_sql": {"name": "default__get_rename_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt.default__get_rename_view_sql", "macro_sql": "{% macro default__get_rename_view_sql(relation, new_name) %}\n    {{ exceptions.raise_compiler_error(\n        \"`get_rename_view_sql` has not been implemented for this adapter.\"\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.436563, "supported_languages": null}, "macro.dbt.get_create_view_as_sql": {"name": "get_create_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.get_create_view_as_sql", "macro_sql": "{% macro get_create_view_as_sql(relation, sql) -%}\n  {{ adapter.dispatch('get_create_view_as_sql', 'dbt')(relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4369762, "supported_languages": null}, "macro.dbt.default__get_create_view_as_sql": {"name": "default__get_create_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.default__get_create_view_as_sql", "macro_sql": "{% macro default__get_create_view_as_sql(relation, sql) -%}\n  {{ return(create_view_as(relation, sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.437151, "supported_languages": null}, "macro.dbt.create_view_as": {"name": "create_view_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n  {{ adapter.dispatch('create_view_as', 'dbt')(relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.437333, "supported_languages": null}, "macro.dbt.default__create_view_as": {"name": "default__create_view_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.default__create_view_as", "macro_sql": "{% macro default__create_view_as(relation, sql) -%}\n  {%- set sql_header = config.get('sql_header', none) -%}\n\n  {{ sql_header if sql_header is not none }}\n  create view {{ relation }}\n    {% set contract_config = config.get('contract') %}\n    {% if contract_config.enforced %}\n      {{ get_assert_columns_equivalent(sql) }}\n    {%- endif %}\n  as (\n    {{ sql }}\n  );\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.437758, "supported_languages": null}, "macro.dbt.default__test_relationships": {"name": "default__test_relationships", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/relationships.sql", "original_file_path": "macros/generic_test_sql/relationships.sql", "unique_id": "macro.dbt.default__test_relationships", "macro_sql": "{% macro default__test_relationships(model, column_name, to, field) %}\n\nwith child as (\n    select {{ column_name }} as from_field\n    from {{ model }}\n    where {{ column_name }} is not null\n),\n\nparent as (\n    select {{ field }} as to_field\n    from {{ to }}\n)\n\nselect\n    from_field\n\nfrom child\nleft join parent\n    on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.438116, "supported_languages": null}, "macro.dbt.default__test_not_null": {"name": "default__test_not_null", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/not_null.sql", "original_file_path": "macros/generic_test_sql/not_null.sql", "unique_id": "macro.dbt.default__test_not_null", "macro_sql": "{% macro default__test_not_null(model, column_name) %}\n\n{% set column_list = '*' if should_store_failures() else column_name %}\n\nselect {{ column_list }}\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_store_failures"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4384131, "supported_languages": null}, "macro.dbt.default__test_unique": {"name": "default__test_unique", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/unique.sql", "original_file_path": "macros/generic_test_sql/unique.sql", "unique_id": "macro.dbt.default__test_unique", "macro_sql": "{% macro default__test_unique(model, column_name) %}\n\nselect\n    {{ column_name }} as unique_field,\n    count(*) as n_records\n\nfrom {{ model }}\nwhere {{ column_name }} is not null\ngroup by {{ column_name }}\nhaving count(*) > 1\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4386592, "supported_languages": null}, "macro.dbt.default__test_accepted_values": {"name": "default__test_accepted_values", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/accepted_values.sql", "original_file_path": "macros/generic_test_sql/accepted_values.sql", "unique_id": "macro.dbt.default__test_accepted_values", "macro_sql": "{% macro default__test_accepted_values(model, column_name, values, quote=True) %}\n\nwith all_values as (\n\n    select\n        {{ column_name }} as value_field,\n        count(*) as n_records\n\n    from {{ model }}\n    group by {{ column_name }}\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n    {% for value in values -%}\n        {% if quote -%}\n        '{{ value }}'\n        {%- else -%}\n        {{ value }}\n        {%- endif -%}\n        {%- if not loop.last -%},{%- endif %}\n    {%- endfor %}\n)\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4392269, "supported_languages": null}, "macro.dbt.statement": {"name": "statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.statement", "macro_sql": "\n{%- macro statement(name=None, fetch_result=False, auto_begin=True, language='sql') -%}\n  {%- if execute: -%}\n    {%- set compiled_code = caller() -%}\n\n    {%- if name == 'main' -%}\n      {{ log('Writing runtime {} for node \"{}\"'.format(language, model['unique_id'])) }}\n      {{ write(compiled_code) }}\n    {%- endif -%}\n    {%- if language == 'sql'-%}\n      {%- set res, table = adapter.execute(compiled_code, auto_begin=auto_begin, fetch=fetch_result) -%}\n    {%- elif language == 'python' -%}\n      {%- set res = submit_python_job(model, compiled_code) -%}\n      {#-- TODO: What should table be for python models? --#}\n      {%- set table = None -%}\n    {%- else -%}\n      {% do exceptions.raise_compiler_error(\"statement macro didn't get supported language\") %}\n    {%- endif -%}\n\n    {%- if name is not none -%}\n      {{ store_result(name, response=res, agate_table=table) }}\n    {%- endif -%}\n\n  {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.440716, "supported_languages": null}, "macro.dbt.noop_statement": {"name": "noop_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.noop_statement", "macro_sql": "{% macro noop_statement(name=None, message=None, code=None, rows_affected=None, res=None) -%}\n  {%- set sql = caller() -%}\n\n  {%- if name == 'main' -%}\n    {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n    {{ write(sql) }}\n  {%- endif -%}\n\n  {%- if name is not none -%}\n    {{ store_raw_result(name, message=message, code=code, rows_affected=rows_affected, agate_table=res) }}\n  {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4413152, "supported_languages": null}, "macro.dbt.run_query": {"name": "run_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.run_query", "macro_sql": "{% macro run_query(sql) %}\n  {% call statement(\"run_query_statement\", fetch_result=true, auto_begin=false) %}\n    {{ sql }}\n  {% endcall %}\n\n  {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.441612, "supported_languages": null}, "macro.dbt.convert_datetime": {"name": "convert_datetime", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.convert_datetime", "macro_sql": "{% macro convert_datetime(date_str, date_fmt) %}\n\n  {% set error_msg -%}\n      The provided partition date '{{ date_str }}' does not match the expected format '{{ date_fmt }}'\n  {%- endset %}\n\n  {% set res = try_or_compiler_error(error_msg, modules.datetime.datetime.strptime, date_str.strip(), date_fmt) %}\n  {{ return(res) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4434502, "supported_languages": null}, "macro.dbt.dates_in_range": {"name": "dates_in_range", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.dates_in_range", "macro_sql": "{% macro dates_in_range(start_date_str, end_date_str=none, in_fmt=\"%Y%m%d\", out_fmt=\"%Y%m%d\") %}\n    {% set end_date_str = start_date_str if end_date_str is none else end_date_str %}\n\n    {% set start_date = convert_datetime(start_date_str, in_fmt) %}\n    {% set end_date = convert_datetime(end_date_str, in_fmt) %}\n\n    {% set day_count = (end_date - start_date).days %}\n    {% if day_count < 0 %}\n        {% set msg -%}\n            Partition start date is after the end date ({{ start_date }}, {{ end_date }})\n        {%- endset %}\n\n        {{ exceptions.raise_compiler_error(msg, model) }}\n    {% endif %}\n\n    {% set date_list = [] %}\n    {% for i in range(0, day_count + 1) %}\n        {% set the_date = (modules.datetime.timedelta(days=i) + start_date) %}\n        {% if not out_fmt %}\n            {% set _ = date_list.append(the_date) %}\n        {% else %}\n            {% set _ = date_list.append(the_date.strftime(out_fmt)) %}\n        {% endif %}\n    {% endfor %}\n\n    {{ return(date_list) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.convert_datetime"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.444715, "supported_languages": null}, "macro.dbt.partition_range": {"name": "partition_range", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.partition_range", "macro_sql": "{% macro partition_range(raw_partition_date, date_fmt='%Y%m%d') %}\n    {% set partition_range = (raw_partition_date | string).split(\",\") %}\n\n    {% if (partition_range | length) == 1 %}\n      {% set start_date = partition_range[0] %}\n      {% set end_date = none %}\n    {% elif (partition_range | length) == 2 %}\n      {% set start_date = partition_range[0] %}\n      {% set end_date = partition_range[1] %}\n    {% else %}\n      {{ exceptions.raise_compiler_error(\"Invalid partition time. Expected format: {Start Date}[,{End Date}]. Got: \" ~ raw_partition_date) }}\n    {% endif %}\n\n    {{ return(dates_in_range(start_date, end_date, in_fmt=date_fmt)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dates_in_range"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.445468, "supported_languages": null}, "macro.dbt.py_current_timestring": {"name": "py_current_timestring", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.py_current_timestring", "macro_sql": "{% macro py_current_timestring() %}\n    {% set dt = modules.datetime.datetime.now() %}\n    {% do return(dt.strftime(\"%Y%m%d%H%M%S%f\")) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.445709, "supported_languages": null}, "macro.dbt.except": {"name": "except", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/except.sql", "original_file_path": "macros/utils/except.sql", "unique_id": "macro.dbt.except", "macro_sql": "{% macro except() %}\n  {{ return(adapter.dispatch('except', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.445941, "supported_languages": null}, "macro.dbt.default__except": {"name": "default__except", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/except.sql", "original_file_path": "macros/utils/except.sql", "unique_id": "macro.dbt.default__except", "macro_sql": "{% macro default__except() %}\n\n    except\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4460192, "supported_languages": null}, "macro.dbt.get_intervals_between": {"name": "get_intervals_between", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n    {{ return(adapter.dispatch('get_intervals_between', 'dbt')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4467719, "supported_languages": null}, "macro.dbt.default__get_intervals_between": {"name": "default__get_intervals_between", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n    {%- call statement('get_intervals_between', fetch_result=True) %}\n\n        select {{ dbt.datediff(start_date, end_date, datepart) }}\n\n    {%- endcall -%}\n\n    {%- set value_list = load_result('get_intervals_between') -%}\n\n    {%- if value_list and value_list['data'] -%}\n        {%- set values = value_list['data'] | map(attribute=0) | list %}\n        {{ return(values[0]) }}\n    {%- else -%}\n        {{ return(1) }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.447368, "supported_languages": null}, "macro.dbt.date_spine": {"name": "date_spine", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n    {{ return(adapter.dispatch('date_spine', 'dbt')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.447605, "supported_languages": null}, "macro.dbt.default__date_spine": {"name": "default__date_spine", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n    {# call as follows:\n\n    date_spine(\n        \"day\",\n        \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n        \"dbt.dateadd(week, 1, current_date)\"\n    ) #}\n\n\n    with rawdata as (\n\n        {{dbt.generate_series(\n            dbt.get_intervals_between(start_date, end_date, datepart)\n        )}}\n\n    ),\n\n    all_periods as (\n\n        select (\n            {{\n                dbt.dateadd(\n                    datepart,\n                    \"row_number() over (order by 1) - 1\",\n                    start_date\n                )\n            }}\n        ) as date_{{datepart}}\n        from rawdata\n\n    ),\n\n    filtered as (\n\n        select *\n        from all_periods\n        where date_{{datepart}} <= {{ end_date }}\n\n    )\n\n    select * from filtered\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.generate_series", "macro.dbt.get_intervals_between", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.447977, "supported_languages": null}, "macro.dbt.replace": {"name": "replace", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/replace.sql", "original_file_path": "macros/utils/replace.sql", "unique_id": "macro.dbt.replace", "macro_sql": "{% macro replace(field, old_chars, new_chars) -%}\n    {{ return(adapter.dispatch('replace', 'dbt') (field, old_chars, new_chars)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__replace"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.448309, "supported_languages": null}, "macro.dbt.default__replace": {"name": "default__replace", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/replace.sql", "original_file_path": "macros/utils/replace.sql", "unique_id": "macro.dbt.default__replace", "macro_sql": "{% macro default__replace(field, old_chars, new_chars) %}\n\n    replace(\n        {{ field }},\n        {{ old_chars }},\n        {{ new_chars }}\n    )\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.448472, "supported_languages": null}, "macro.dbt.concat": {"name": "concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/concat.sql", "original_file_path": "macros/utils/concat.sql", "unique_id": "macro.dbt.concat", "macro_sql": "{% macro concat(fields) -%}\n  {{ return(adapter.dispatch('concat', 'dbt')(fields)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.448717, "supported_languages": null}, "macro.dbt.default__concat": {"name": "default__concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/concat.sql", "original_file_path": "macros/utils/concat.sql", "unique_id": "macro.dbt.default__concat", "macro_sql": "{% macro default__concat(fields) -%}\n    {{ fields|join(' || ') }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4488409, "supported_languages": null}, "macro.dbt.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n    {{ return(adapter.dispatch('get_powers_of_two', 'dbt')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4496808, "supported_languages": null}, "macro.dbt.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n    {% if upper_bound <= 0 %}\n    {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n    {% endif %}\n\n    {% for _ in range(1, 100) %}\n       {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n    {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.450098, "supported_languages": null}, "macro.dbt.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n    {{ return(adapter.dispatch('generate_series', 'dbt')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4502919, "supported_languages": null}, "macro.dbt.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n    {% set n = dbt.get_powers_of_two(upper_bound) %}\n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    {% for i in range(n) %}\n    p{{i}}.generated_number * power(2, {{i}})\n    {% if not loop.last %} + {% endif %}\n    {% endfor %}\n    + 1\n    as generated_number\n\n    from\n\n    {% for i in range(n) %}\n    p as p{{i}}\n    {% if not loop.last %} cross join {% endif %}\n    {% endfor %}\n\n    )\n\n    select *\n    from unioned\n    where generated_number <= {{upper_bound}}\n    order by generated_number\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4508128, "supported_languages": null}, "macro.dbt.length": {"name": "length", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/length.sql", "original_file_path": "macros/utils/length.sql", "unique_id": "macro.dbt.length", "macro_sql": "{% macro length(expression) -%}\n    {{ return(adapter.dispatch('length', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__length"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.451071, "supported_languages": null}, "macro.dbt.default__length": {"name": "default__length", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/length.sql", "original_file_path": "macros/utils/length.sql", "unique_id": "macro.dbt.default__length", "macro_sql": "{% macro default__length(expression) %}\n\n    length(\n        {{ expression }}\n    )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.45118, "supported_languages": null}, "macro.dbt.dateadd": {"name": "dateadd", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/dateadd.sql", "original_file_path": "macros/utils/dateadd.sql", "unique_id": "macro.dbt.dateadd", "macro_sql": "{% macro dateadd(datepart, interval, from_date_or_timestamp) %}\n  {{ return(adapter.dispatch('dateadd', 'dbt')(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.451523, "supported_languages": null}, "macro.dbt.default__dateadd": {"name": "default__dateadd", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/dateadd.sql", "original_file_path": "macros/utils/dateadd.sql", "unique_id": "macro.dbt.default__dateadd", "macro_sql": "{% macro default__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n    dateadd(\n        {{ datepart }},\n        {{ interval }},\n        {{ from_date_or_timestamp }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4516952, "supported_languages": null}, "macro.dbt.intersect": {"name": "intersect", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/intersect.sql", "original_file_path": "macros/utils/intersect.sql", "unique_id": "macro.dbt.intersect", "macro_sql": "{% macro intersect() %}\n  {{ return(adapter.dispatch('intersect', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__intersect"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4519198, "supported_languages": null}, "macro.dbt.default__intersect": {"name": "default__intersect", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/intersect.sql", "original_file_path": "macros/utils/intersect.sql", "unique_id": "macro.dbt.default__intersect", "macro_sql": "{% macro default__intersect() %}\n\n    intersect\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.452066, "supported_languages": null}, "macro.dbt.escape_single_quotes": {"name": "escape_single_quotes", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt.escape_single_quotes", "macro_sql": "{% macro escape_single_quotes(expression) %}\n      {{ return(adapter.dispatch('escape_single_quotes', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__escape_single_quotes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.452329, "supported_languages": null}, "macro.dbt.default__escape_single_quotes": {"name": "default__escape_single_quotes", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt.default__escape_single_quotes", "macro_sql": "{% macro default__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\",\"''\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.452469, "supported_languages": null}, "macro.dbt.right": {"name": "right", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt.right", "macro_sql": "{% macro right(string_text, length_expression) -%}\n    {{ return(adapter.dispatch('right', 'dbt') (string_text, length_expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__right"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.452765, "supported_languages": null}, "macro.dbt.default__right": {"name": "default__right", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt.default__right", "macro_sql": "{% macro default__right(string_text, length_expression) %}\n\n    right(\n        {{ string_text }},\n        {{ length_expression }}\n    )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4529002, "supported_languages": null}, "macro.dbt.listagg": {"name": "listagg", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/listagg.sql", "original_file_path": "macros/utils/listagg.sql", "unique_id": "macro.dbt.listagg", "macro_sql": "{% macro listagg(measure, delimiter_text=\"','\", order_by_clause=none, limit_num=none) -%}\n    {{ return(adapter.dispatch('listagg', 'dbt') (measure, delimiter_text, order_by_clause, limit_num)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__listagg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.453535, "supported_languages": null}, "macro.dbt.default__listagg": {"name": "default__listagg", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/listagg.sql", "original_file_path": "macros/utils/listagg.sql", "unique_id": "macro.dbt.default__listagg", "macro_sql": "{% macro default__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n    {% if limit_num -%}\n    array_to_string(\n        array_slice(\n            array_agg(\n                {{ measure }}\n            ){% if order_by_clause -%}\n            within group ({{ order_by_clause }})\n            {%- endif %}\n            ,0\n            ,{{ limit_num }}\n        ),\n        {{ delimiter_text }}\n        )\n    {%- else %}\n    listagg(\n        {{ measure }},\n        {{ delimiter_text }}\n        )\n        {% if order_by_clause -%}\n        within group ({{ order_by_clause }})\n        {%- endif %}\n    {%- endif %}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.453944, "supported_languages": null}, "macro.dbt.datediff": {"name": "datediff", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/datediff.sql", "original_file_path": "macros/utils/datediff.sql", "unique_id": "macro.dbt.datediff", "macro_sql": "{% macro datediff(first_date, second_date, datepart) %}\n  {{ return(adapter.dispatch('datediff', 'dbt')(first_date, second_date, datepart)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.454282, "supported_languages": null}, "macro.dbt.default__datediff": {"name": "default__datediff", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/datediff.sql", "original_file_path": "macros/utils/datediff.sql", "unique_id": "macro.dbt.default__datediff", "macro_sql": "{% macro default__datediff(first_date, second_date, datepart) -%}\n\n    datediff(\n        {{ datepart }},\n        {{ first_date }},\n        {{ second_date }}\n        )\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.454447, "supported_languages": null}, "macro.dbt.safe_cast": {"name": "safe_cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt.safe_cast", "macro_sql": "{% macro safe_cast(field, type) %}\n  {{ return(adapter.dispatch('safe_cast', 'dbt') (field, type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.454734, "supported_languages": null}, "macro.dbt.default__safe_cast": {"name": "default__safe_cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt.default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n    {# most databases don't support this function yet\n    so we just need to use cast #}\n    cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.454877, "supported_languages": null}, "macro.dbt.hash": {"name": "hash", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/hash.sql", "original_file_path": "macros/utils/hash.sql", "unique_id": "macro.dbt.hash", "macro_sql": "{% macro hash(field) -%}\n  {{ return(adapter.dispatch('hash', 'dbt') (field)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__hash"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.455134, "supported_languages": null}, "macro.dbt.default__hash": {"name": "default__hash", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/hash.sql", "original_file_path": "macros/utils/hash.sql", "unique_id": "macro.dbt.default__hash", "macro_sql": "{% macro default__hash(field) -%}\n    md5(cast({{ field }} as {{ api.Column.translate_type('string') }}))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4553, "supported_languages": null}, "macro.dbt.cast_bool_to_text": {"name": "cast_bool_to_text", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast_bool_to_text.sql", "original_file_path": "macros/utils/cast_bool_to_text.sql", "unique_id": "macro.dbt.cast_bool_to_text", "macro_sql": "{% macro cast_bool_to_text(field) %}\n  {{ adapter.dispatch('cast_bool_to_text', 'dbt') (field) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4555452, "supported_languages": null}, "macro.dbt.default__cast_bool_to_text": {"name": "default__cast_bool_to_text", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast_bool_to_text.sql", "original_file_path": "macros/utils/cast_bool_to_text.sql", "unique_id": "macro.dbt.default__cast_bool_to_text", "macro_sql": "{% macro default__cast_bool_to_text(field) %}\n    cast({{ field }} as {{ api.Column.translate_type('string') }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4557078, "supported_languages": null}, "macro.dbt.any_value": {"name": "any_value", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/any_value.sql", "original_file_path": "macros/utils/any_value.sql", "unique_id": "macro.dbt.any_value", "macro_sql": "{% macro any_value(expression) -%}\n    {{ return(adapter.dispatch('any_value', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__any_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.455955, "supported_languages": null}, "macro.dbt.default__any_value": {"name": "default__any_value", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/any_value.sql", "original_file_path": "macros/utils/any_value.sql", "unique_id": "macro.dbt.default__any_value", "macro_sql": "{% macro default__any_value(expression) -%}\n\n    any_value({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.456059, "supported_languages": null}, "macro.dbt.position": {"name": "position", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/position.sql", "original_file_path": "macros/utils/position.sql", "unique_id": "macro.dbt.position", "macro_sql": "{% macro position(substring_text, string_text) -%}\n    {{ return(adapter.dispatch('position', 'dbt') (substring_text, string_text)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__position"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4563498, "supported_languages": null}, "macro.dbt.default__position": {"name": "default__position", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/position.sql", "original_file_path": "macros/utils/position.sql", "unique_id": "macro.dbt.default__position", "macro_sql": "{% macro default__position(substring_text, string_text) %}\n\n    position(\n        {{ substring_text }} in {{ string_text }}\n    )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.45649, "supported_languages": null}, "macro.dbt.string_literal": {"name": "string_literal", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/literal.sql", "original_file_path": "macros/utils/literal.sql", "unique_id": "macro.dbt.string_literal", "macro_sql": "{%- macro string_literal(value) -%}\n  {{ return(adapter.dispatch('string_literal', 'dbt') (value)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__string_literal"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4567308, "supported_languages": null}, "macro.dbt.default__string_literal": {"name": "default__string_literal", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/literal.sql", "original_file_path": "macros/utils/literal.sql", "unique_id": "macro.dbt.default__string_literal", "macro_sql": "{% macro default__string_literal(value) -%}\n    '{{ value }}'\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.456896, "supported_languages": null}, "macro.dbt.type_string": {"name": "type_string", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_string", "macro_sql": "\n\n{%- macro type_string() -%}\n  {{ return(adapter.dispatch('type_string', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4578428, "supported_languages": null}, "macro.dbt.default__type_string": {"name": "default__type_string", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_string", "macro_sql": "{% macro default__type_string() %}\n    {{ return(api.Column.translate_type(\"string\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4580019, "supported_languages": null}, "macro.dbt.type_timestamp": {"name": "type_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_timestamp", "macro_sql": "\n\n{%- macro type_timestamp() -%}\n  {{ return(adapter.dispatch('type_timestamp', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4581661, "supported_languages": null}, "macro.dbt.default__type_timestamp": {"name": "default__type_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_timestamp", "macro_sql": "{% macro default__type_timestamp() %}\n    {{ return(api.Column.translate_type(\"timestamp\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.45832, "supported_languages": null}, "macro.dbt.type_float": {"name": "type_float", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_float", "macro_sql": "\n\n{%- macro type_float() -%}\n  {{ return(adapter.dispatch('type_float', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_float"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.458485, "supported_languages": null}, "macro.dbt.default__type_float": {"name": "default__type_float", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_float", "macro_sql": "{% macro default__type_float() %}\n    {{ return(api.Column.translate_type(\"float\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.458636, "supported_languages": null}, "macro.dbt.type_numeric": {"name": "type_numeric", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_numeric", "macro_sql": "\n\n{%- macro type_numeric() -%}\n  {{ return(adapter.dispatch('type_numeric', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4588008, "supported_languages": null}, "macro.dbt.default__type_numeric": {"name": "default__type_numeric", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_numeric", "macro_sql": "{% macro default__type_numeric() %}\n    {{ return(api.Column.numeric_type(\"numeric\", 28, 6)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.458982, "supported_languages": null}, "macro.dbt.type_bigint": {"name": "type_bigint", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_bigint", "macro_sql": "\n\n{%- macro type_bigint() -%}\n  {{ return(adapter.dispatch('type_bigint', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.459147, "supported_languages": null}, "macro.dbt.default__type_bigint": {"name": "default__type_bigint", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_bigint", "macro_sql": "{% macro default__type_bigint() %}\n    {{ return(api.Column.translate_type(\"bigint\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4593012, "supported_languages": null}, "macro.dbt.type_int": {"name": "type_int", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_int", "macro_sql": "\n\n{%- macro type_int() -%}\n  {{ return(adapter.dispatch('type_int', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4594638, "supported_languages": null}, "macro.dbt.default__type_int": {"name": "default__type_int", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_int", "macro_sql": "{%- macro default__type_int() -%}\n  {{ return(api.Column.translate_type(\"integer\")) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.459616, "supported_languages": null}, "macro.dbt.type_boolean": {"name": "type_boolean", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_boolean", "macro_sql": "\n\n{%- macro type_boolean() -%}\n  {{ return(adapter.dispatch('type_boolean', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_boolean"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.459776, "supported_languages": null}, "macro.dbt.default__type_boolean": {"name": "default__type_boolean", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_boolean", "macro_sql": "{%- macro default__type_boolean() -%}\n  {{ return(api.Column.translate_type(\"boolean\")) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.459924, "supported_languages": null}, "macro.dbt.array_concat": {"name": "array_concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_concat.sql", "original_file_path": "macros/utils/array_concat.sql", "unique_id": "macro.dbt.array_concat", "macro_sql": "{% macro array_concat(array_1, array_2) -%}\n  {{ return(adapter.dispatch('array_concat', 'dbt')(array_1, array_2)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__array_concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.460202, "supported_languages": null}, "macro.dbt.default__array_concat": {"name": "default__array_concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_concat.sql", "original_file_path": "macros/utils/array_concat.sql", "unique_id": "macro.dbt.default__array_concat", "macro_sql": "{% macro default__array_concat(array_1, array_2) -%}\n    array_cat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.460334, "supported_languages": null}, "macro.dbt.bool_or": {"name": "bool_or", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt.bool_or", "macro_sql": "{% macro bool_or(expression) -%}\n    {{ return(adapter.dispatch('bool_or', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__bool_or"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4605818, "supported_languages": null}, "macro.dbt.default__bool_or": {"name": "default__bool_or", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt.default__bool_or", "macro_sql": "{% macro default__bool_or(expression) -%}\n\n    bool_or({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4606888, "supported_languages": null}, "macro.dbt.last_day": {"name": "last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.last_day", "macro_sql": "{% macro last_day(date, datepart) %}\n  {{ return(adapter.dispatch('last_day', 'dbt') (date, datepart)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.46104, "supported_languages": null}, "macro.dbt.default_last_day": {"name": "default_last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.default_last_day", "macro_sql": "\n\n{%- macro default_last_day(date, datepart) -%}\n    cast(\n        {{dbt.dateadd('day', '-1',\n        dbt.dateadd(datepart, '1', dbt.date_trunc(datepart, date))\n        )}}\n        as date)\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.461369, "supported_languages": null}, "macro.dbt.default__last_day": {"name": "default__last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.default__last_day", "macro_sql": "{% macro default__last_day(date, datepart) -%}\n    {{dbt.default_last_day(date, datepart)}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.46152, "supported_languages": null}, "macro.dbt.split_part": {"name": "split_part", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt.split_part", "macro_sql": "{% macro split_part(string_text, delimiter_text, part_number) %}\n  {{ return(adapter.dispatch('split_part', 'dbt') (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__split_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.462055, "supported_languages": null}, "macro.dbt.default__split_part": {"name": "default__split_part", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt.default__split_part", "macro_sql": "{% macro default__split_part(string_text, delimiter_text, part_number) %}\n\n    split_part(\n        {{ string_text }},\n        {{ delimiter_text }},\n        {{ part_number }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4622211, "supported_languages": null}, "macro.dbt._split_part_negative": {"name": "_split_part_negative", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt._split_part_negative", "macro_sql": "{% macro _split_part_negative(string_text, delimiter_text, part_number) %}\n\n    split_part(\n        {{ string_text }},\n        {{ delimiter_text }},\n          length({{ string_text }})\n          - length(\n              replace({{ string_text }},  {{ delimiter_text }}, '')\n          ) + 2 + {{ part_number }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4624472, "supported_languages": null}, "macro.dbt.date_trunc": {"name": "date_trunc", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_trunc.sql", "original_file_path": "macros/utils/date_trunc.sql", "unique_id": "macro.dbt.date_trunc", "macro_sql": "{% macro date_trunc(datepart, date) -%}\n  {{ return(adapter.dispatch('date_trunc', 'dbt') (datepart, date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4627259, "supported_languages": null}, "macro.dbt.default__date_trunc": {"name": "default__date_trunc", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_trunc.sql", "original_file_path": "macros/utils/date_trunc.sql", "unique_id": "macro.dbt.default__date_trunc", "macro_sql": "{% macro default__date_trunc(datepart, date) -%}\n    date_trunc('{{datepart}}', {{date}})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4628549, "supported_languages": null}, "macro.dbt.array_construct": {"name": "array_construct", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt.array_construct", "macro_sql": "{% macro array_construct(inputs=[], data_type=api.Column.translate_type('integer')) -%}\n  {{ return(adapter.dispatch('array_construct', 'dbt')(inputs, data_type)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__array_construct"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.463229, "supported_languages": null}, "macro.dbt.default__array_construct": {"name": "default__array_construct", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt.default__array_construct", "macro_sql": "{% macro default__array_construct(inputs, data_type) -%}\n    {% if inputs|length > 0 %}\n    array[ {{ inputs|join(' , ') }} ]\n    {% else %}\n    array[]::{{data_type}}[]\n    {% endif %}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4634728, "supported_languages": null}, "macro.dbt.array_append": {"name": "array_append", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_append.sql", "original_file_path": "macros/utils/array_append.sql", "unique_id": "macro.dbt.array_append", "macro_sql": "{% macro array_append(array, new_element) -%}\n  {{ return(adapter.dispatch('array_append', 'dbt')(array, new_element)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__array_append"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4637592, "supported_languages": null}, "macro.dbt.default__array_append": {"name": "default__array_append", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_append.sql", "original_file_path": "macros/utils/array_append.sql", "unique_id": "macro.dbt.default__array_append", "macro_sql": "{% macro default__array_append(array, new_element) -%}\n    array_append({{ array }}, {{ new_element }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.463892, "supported_languages": null}, "macro.dbt.create_schema": {"name": "create_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n  {{ adapter.dispatch('create_schema', 'dbt')(relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4642692, "supported_languages": null}, "macro.dbt.default__create_schema": {"name": "default__create_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.default__create_schema", "macro_sql": "{% macro default__create_schema(relation) -%}\n  {%- call statement('create_schema') -%}\n    create schema if not exists {{ relation.without_identifier() }}\n  {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.464454, "supported_languages": null}, "macro.dbt.drop_schema": {"name": "drop_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n  {{ adapter.dispatch('drop_schema', 'dbt')(relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__drop_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.464618, "supported_languages": null}, "macro.dbt.default__drop_schema": {"name": "default__drop_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.default__drop_schema", "macro_sql": "{% macro default__drop_schema(relation) -%}\n  {%- call statement('drop_schema') -%}\n    drop schema if exists {{ relation.without_identifier() }} cascade\n  {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.464809, "supported_languages": null}, "macro.dbt.current_timestamp": {"name": "current_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp", "macro_sql": "{%- macro current_timestamp() -%}\n    {{ adapter.dispatch('current_timestamp', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.465291, "supported_languages": null}, "macro.dbt.default__current_timestamp": {"name": "default__current_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() -%}\n  {{ exceptions.raise_not_implemented(\n    'current_timestamp macro not implemented for adapter ' + adapter.type()) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.465446, "supported_languages": null}, "macro.dbt.snapshot_get_time": {"name": "snapshot_get_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.snapshot_get_time", "macro_sql": "\n\n{%- macro snapshot_get_time() -%}\n    {{ adapter.dispatch('snapshot_get_time', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4655948, "supported_languages": null}, "macro.dbt.default__snapshot_get_time": {"name": "default__snapshot_get_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__snapshot_get_time", "macro_sql": "{% macro default__snapshot_get_time() %}\n    {{ current_timestamp() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4657001, "supported_languages": null}, "macro.dbt.current_timestamp_backcompat": {"name": "current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp_backcompat", "macro_sql": "{% macro current_timestamp_backcompat() %}\n    {{ return(adapter.dispatch('current_timestamp_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__current_timestamp_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.465866, "supported_languages": null}, "macro.dbt.default__current_timestamp_backcompat": {"name": "default__current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp_backcompat", "macro_sql": "{% macro default__current_timestamp_backcompat() %}\n    current_timestamp::timestamp\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.46595, "supported_languages": null}, "macro.dbt.current_timestamp_in_utc_backcompat": {"name": "current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp_in_utc_backcompat", "macro_sql": "{% macro current_timestamp_in_utc_backcompat() %}\n    {{ return(adapter.dispatch('current_timestamp_in_utc_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__current_timestamp_in_utc_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.46618, "supported_languages": null}, "macro.dbt.default__current_timestamp_in_utc_backcompat": {"name": "default__current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp_in_utc_backcompat", "macro_sql": "{% macro default__current_timestamp_in_utc_backcompat() %}\n    {{ return(adapter.dispatch('current_timestamp_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp_backcompat", "macro.dbt_bigquery.bigquery__current_timestamp_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4663522, "supported_languages": null}, "macro.dbt.get_create_index_sql": {"name": "get_create_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_create_index_sql", "macro_sql": "{% macro get_create_index_sql(relation, index_dict) -%}\n  {{ return(adapter.dispatch('get_create_index_sql', 'dbt')(relation, index_dict)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.46719, "supported_languages": null}, "macro.dbt.default__get_create_index_sql": {"name": "default__get_create_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_create_index_sql", "macro_sql": "{% macro default__get_create_index_sql(relation, index_dict) -%}\n  {% do return(None) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4673269, "supported_languages": null}, "macro.dbt.create_indexes": {"name": "create_indexes", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.create_indexes", "macro_sql": "{% macro create_indexes(relation) -%}\n  {{ adapter.dispatch('create_indexes', 'dbt')(relation) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.467495, "supported_languages": null}, "macro.dbt.default__create_indexes": {"name": "default__create_indexes", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__create_indexes", "macro_sql": "{% macro default__create_indexes(relation) -%}\n  {%- set _indexes = config.get('indexes', default=[]) -%}\n\n  {% for _index_dict in _indexes %}\n    {% set create_index_sql = get_create_index_sql(relation, _index_dict) %}\n    {% if create_index_sql %}\n      {% do run_query(create_index_sql) %}\n    {% endif %}\n  {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_create_index_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.467965, "supported_languages": null}, "macro.dbt.get_drop_index_sql": {"name": "get_drop_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_drop_index_sql", "macro_sql": "{% macro get_drop_index_sql(relation, index_name) -%}\n    {{ adapter.dispatch('get_drop_index_sql', 'dbt')(relation, index_name) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_drop_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.46818, "supported_languages": null}, "macro.dbt.default__get_drop_index_sql": {"name": "default__get_drop_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_drop_index_sql", "macro_sql": "{% macro default__get_drop_index_sql(relation, index_name) -%}\n    {{ exceptions.raise_compiler_error(\"`get_drop_index_sql has not been implemented for this adapter.\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.468328, "supported_languages": null}, "macro.dbt.get_show_indexes_sql": {"name": "get_show_indexes_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_show_indexes_sql", "macro_sql": "{% macro get_show_indexes_sql(relation) -%}\n    {{ adapter.dispatch('get_show_indexes_sql', 'dbt')(relation) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_show_indexes_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4684942, "supported_languages": null}, "macro.dbt.default__get_show_indexes_sql": {"name": "default__get_show_indexes_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_show_indexes_sql", "macro_sql": "{% macro default__get_show_indexes_sql(relation) -%}\n    {{ exceptions.raise_compiler_error(\"`get_show_indexes_sql has not been implemented for this adapter.\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.468626, "supported_languages": null}, "macro.dbt.make_intermediate_relation": {"name": "make_intermediate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_intermediate_relation", "macro_sql": "{% macro make_intermediate_relation(base_relation, suffix='__dbt_tmp') %}\n  {{ return(adapter.dispatch('make_intermediate_relation', 'dbt')(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_intermediate_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.470634, "supported_languages": null}, "macro.dbt.default__make_intermediate_relation": {"name": "default__make_intermediate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_intermediate_relation", "macro_sql": "{% macro default__make_intermediate_relation(base_relation, suffix) %}\n    {{ return(default__make_temp_relation(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4708061, "supported_languages": null}, "macro.dbt.make_temp_relation": {"name": "make_temp_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n  {{ return(adapter.dispatch('make_temp_relation', 'dbt')(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4710348, "supported_languages": null}, "macro.dbt.default__make_temp_relation": {"name": "default__make_temp_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_temp_relation", "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n    {%- set temp_identifier = base_relation.identifier ~ suffix -%}\n    {%- set temp_relation = base_relation.incorporate(\n                                path={\"identifier\": temp_identifier}) -%}\n\n    {{ return(temp_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.471338, "supported_languages": null}, "macro.dbt.make_backup_relation": {"name": "make_backup_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_backup_relation", "macro_sql": "{% macro make_backup_relation(base_relation, backup_relation_type, suffix='__dbt_backup') %}\n    {{ return(adapter.dispatch('make_backup_relation', 'dbt')(base_relation, backup_relation_type, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_backup_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.471594, "supported_languages": null}, "macro.dbt.default__make_backup_relation": {"name": "default__make_backup_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_backup_relation", "macro_sql": "{% macro default__make_backup_relation(base_relation, backup_relation_type, suffix) %}\n    {%- set backup_identifier = base_relation.identifier ~ suffix -%}\n    {%- set backup_relation = base_relation.incorporate(\n                                  path={\"identifier\": backup_identifier},\n                                  type=backup_relation_type\n    ) -%}\n    {{ return(backup_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.47192, "supported_languages": null}, "macro.dbt.truncate_relation": {"name": "truncate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.truncate_relation", "macro_sql": "{% macro truncate_relation(relation) -%}\n  {{ return(adapter.dispatch('truncate_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__truncate_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4721081, "supported_languages": null}, "macro.dbt.default__truncate_relation": {"name": "default__truncate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__truncate_relation", "macro_sql": "{% macro default__truncate_relation(relation) -%}\n  {% call statement('truncate_relation') -%}\n    truncate table {{ relation }}\n  {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.472272, "supported_languages": null}, "macro.dbt.get_or_create_relation": {"name": "get_or_create_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.get_or_create_relation", "macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) -%}\n  {{ return(adapter.dispatch('get_or_create_relation', 'dbt')(database, schema, identifier, type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_or_create_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4725251, "supported_languages": null}, "macro.dbt.default__get_or_create_relation": {"name": "default__get_or_create_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__get_or_create_relation", "macro_sql": "{% macro default__get_or_create_relation(database, schema, identifier, type) %}\n  {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n  {% if target_relation %}\n    {% do return([true, target_relation]) %}\n  {% endif %}\n\n  {%- set new_relation = api.Relation.create(\n      database=database,\n      schema=schema,\n      identifier=identifier,\n      type=type\n  ) -%}\n  {% do return([false, new_relation]) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.473284, "supported_languages": null}, "macro.dbt.load_cached_relation": {"name": "load_cached_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.load_cached_relation", "macro_sql": "{% macro load_cached_relation(relation) %}\n  {% do return(adapter.get_relation(\n    database=relation.database,\n    schema=relation.schema,\n    identifier=relation.identifier\n  )) -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.47352, "supported_languages": null}, "macro.dbt.load_relation": {"name": "load_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.load_relation", "macro_sql": "{% macro load_relation(relation) %}\n    {{ return(load_cached_relation(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.473664, "supported_languages": null}, "macro.dbt.collect_freshness": {"name": "collect_freshness", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "unique_id": "macro.dbt.collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n  {{ return(adapter.dispatch('collect_freshness', 'dbt')(source, loaded_at_field, filter))}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.474088, "supported_languages": null}, "macro.dbt.default__collect_freshness": {"name": "default__collect_freshness", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "unique_id": "macro.dbt.default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n  {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n    select\n      max({{ loaded_at_field }}) as max_loaded_at,\n      {{ current_timestamp() }} as snapshotted_at\n    from {{ source }}\n    {% if filter %}\n    where {{ filter }}\n    {% endif %}\n  {% endcall %}\n  {{ return(load_result('collect_freshness')) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4745018, "supported_languages": null}, "macro.dbt.validate_sql": {"name": "validate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/validate_sql.sql", "original_file_path": "macros/adapters/validate_sql.sql", "unique_id": "macro.dbt.validate_sql", "macro_sql": "{% macro validate_sql(sql) -%}\n  {{ return(adapter.dispatch('validate_sql', 'dbt')(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__validate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.474786, "supported_languages": null}, "macro.dbt.default__validate_sql": {"name": "default__validate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/validate_sql.sql", "original_file_path": "macros/adapters/validate_sql.sql", "unique_id": "macro.dbt.default__validate_sql", "macro_sql": "{% macro default__validate_sql(sql) -%}\n  {% call statement('validate_sql') -%}\n    explain {{ sql }}\n  {% endcall %}\n  {{ return(load_result('validate_sql')) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.475014, "supported_languages": null}, "macro.dbt.copy_grants": {"name": "copy_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.copy_grants", "macro_sql": "{% macro copy_grants() %}\n    {{ return(adapter.dispatch('copy_grants', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__copy_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.476736, "supported_languages": null}, "macro.dbt.default__copy_grants": {"name": "default__copy_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__copy_grants", "macro_sql": "{% macro default__copy_grants() %}\n    {{ return(True) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.476856, "supported_languages": null}, "macro.dbt.support_multiple_grantees_per_dcl_statement": {"name": "support_multiple_grantees_per_dcl_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.support_multiple_grantees_per_dcl_statement", "macro_sql": "{% macro support_multiple_grantees_per_dcl_statement() %}\n    {{ return(adapter.dispatch('support_multiple_grantees_per_dcl_statement', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__support_multiple_grantees_per_dcl_statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4770281, "supported_languages": null}, "macro.dbt.default__support_multiple_grantees_per_dcl_statement": {"name": "default__support_multiple_grantees_per_dcl_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__support_multiple_grantees_per_dcl_statement", "macro_sql": "\n\n{%- macro default__support_multiple_grantees_per_dcl_statement() -%}\n    {{ return(True) }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.477139, "supported_languages": null}, "macro.dbt.should_revoke": {"name": "should_revoke", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.should_revoke", "macro_sql": "{% macro should_revoke(existing_relation, full_refresh_mode=True) %}\n\n    {% if not existing_relation %}\n        {#-- The table doesn't already exist, so no grants to copy over --#}\n        {{ return(False) }}\n    {% elif full_refresh_mode %}\n        {#-- The object is being REPLACED -- whether grants are copied over depends on the value of user config --#}\n        {{ return(copy_grants()) }}\n    {% else %}\n        {#-- The table is being merged/upserted/inserted -- grants will be carried over --#}\n        {{ return(True) }}\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.copy_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.477494, "supported_languages": null}, "macro.dbt.get_show_grant_sql": {"name": "get_show_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_show_grant_sql", "macro_sql": "{% macro get_show_grant_sql(relation) %}\n    {{ return(adapter.dispatch(\"get_show_grant_sql\", \"dbt\")(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_show_grant_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.477688, "supported_languages": null}, "macro.dbt.default__get_show_grant_sql": {"name": "default__get_show_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_show_grant_sql", "macro_sql": "{% macro default__get_show_grant_sql(relation) %}\n    show grants on {{ relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.477794, "supported_languages": null}, "macro.dbt.get_grant_sql": {"name": "get_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_grant_sql", "macro_sql": "{% macro get_grant_sql(relation, privilege, grantees) %}\n    {{ return(adapter.dispatch('get_grant_sql', 'dbt')(relation, privilege, grantees)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_grant_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.478028, "supported_languages": null}, "macro.dbt.default__get_grant_sql": {"name": "default__get_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_grant_sql", "macro_sql": "\n\n{%- macro default__get_grant_sql(relation, privilege, grantees) -%}\n    grant {{ privilege }} on {{ relation }} to {{ grantees | join(', ') }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.47822, "supported_languages": null}, "macro.dbt.get_revoke_sql": {"name": "get_revoke_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_revoke_sql", "macro_sql": "{% macro get_revoke_sql(relation, privilege, grantees) %}\n    {{ return(adapter.dispatch('get_revoke_sql', 'dbt')(relation, privilege, grantees)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_revoke_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.478456, "supported_languages": null}, "macro.dbt.default__get_revoke_sql": {"name": "default__get_revoke_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_revoke_sql", "macro_sql": "\n\n{%- macro default__get_revoke_sql(relation, privilege, grantees) -%}\n    revoke {{ privilege }} on {{ relation }} from {{ grantees | join(', ') }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.47865, "supported_languages": null}, "macro.dbt.get_dcl_statement_list": {"name": "get_dcl_statement_list", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_dcl_statement_list", "macro_sql": "{% macro get_dcl_statement_list(relation, grant_config, get_dcl_macro) %}\n    {{ return(adapter.dispatch('get_dcl_statement_list', 'dbt')(relation, grant_config, get_dcl_macro)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_dcl_statement_list"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.47889, "supported_languages": null}, "macro.dbt.default__get_dcl_statement_list": {"name": "default__get_dcl_statement_list", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_dcl_statement_list", "macro_sql": "\n\n{%- macro default__get_dcl_statement_list(relation, grant_config, get_dcl_macro) -%}\n    {#\n      -- Unpack grant_config into specific privileges and the set of users who need them granted/revoked.\n      -- Depending on whether this database supports multiple grantees per statement, pass in the list of\n      -- all grantees per privilege, or (if not) template one statement per privilege-grantee pair.\n      -- `get_dcl_macro` will be either `get_grant_sql` or `get_revoke_sql`\n    #}\n    {%- set dcl_statements = [] -%}\n    {%- for privilege, grantees in grant_config.items() %}\n        {%- if support_multiple_grantees_per_dcl_statement() and grantees -%}\n          {%- set dcl = get_dcl_macro(relation, privilege, grantees) -%}\n          {%- do dcl_statements.append(dcl) -%}\n        {%- else -%}\n          {%- for grantee in grantees -%}\n              {% set dcl = get_dcl_macro(relation, privilege, [grantee]) %}\n              {%- do dcl_statements.append(dcl) -%}\n          {% endfor -%}\n        {%- endif -%}\n    {%- endfor -%}\n    {{ return(dcl_statements) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.support_multiple_grantees_per_dcl_statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4796438, "supported_languages": null}, "macro.dbt.call_dcl_statements": {"name": "call_dcl_statements", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.call_dcl_statements", "macro_sql": "{% macro call_dcl_statements(dcl_statement_list) %}\n    {{ return(adapter.dispatch(\"call_dcl_statements\", \"dbt\")(dcl_statement_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__call_dcl_statements"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.47984, "supported_languages": null}, "macro.dbt.default__call_dcl_statements": {"name": "default__call_dcl_statements", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__call_dcl_statements", "macro_sql": "{% macro default__call_dcl_statements(dcl_statement_list) %}\n    {#\n      -- By default, supply all grant + revoke statements in a single semicolon-separated block,\n      -- so that they're all processed together.\n\n      -- Some databases do not support this. Those adapters will need to override this macro\n      -- to run each statement individually.\n    #}\n    {% call statement('grants') %}\n        {% for dcl_statement in dcl_statement_list %}\n            {{ dcl_statement }};\n        {% endfor %}\n    {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.480093, "supported_languages": null}, "macro.dbt.apply_grants": {"name": "apply_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.apply_grants", "macro_sql": "{% macro apply_grants(relation, grant_config, should_revoke) %}\n    {{ return(adapter.dispatch(\"apply_grants\", \"dbt\")(relation, grant_config, should_revoke)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.480335, "supported_languages": null}, "macro.dbt.default__apply_grants": {"name": "default__apply_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__apply_grants", "macro_sql": "{% macro default__apply_grants(relation, grant_config, should_revoke=True) %}\n    {#-- If grant_config is {} or None, this is a no-op --#}\n    {% if grant_config %}\n        {% if should_revoke %}\n            {#-- We think previous grants may have carried over --#}\n            {#-- Show current grants and calculate diffs --#}\n            {% set current_grants_table = run_query(get_show_grant_sql(relation)) %}\n            {% set current_grants_dict = adapter.standardize_grants_dict(current_grants_table) %}\n            {% set needs_granting = diff_of_two_dicts(grant_config, current_grants_dict) %}\n            {% set needs_revoking = diff_of_two_dicts(current_grants_dict, grant_config) %}\n            {% if not (needs_granting or needs_revoking) %}\n                {{ log('On ' ~ relation ~': All grants are in place, no revocation or granting needed.')}}\n            {% endif %}\n        {% else %}\n            {#-- We don't think there's any chance of previous grants having carried over. --#}\n            {#-- Jump straight to granting what the user has configured. --#}\n            {% set needs_revoking = {} %}\n            {% set needs_granting = grant_config %}\n        {% endif %}\n        {% if needs_granting or needs_revoking %}\n            {% set revoke_statement_list = get_dcl_statement_list(relation, needs_revoking, get_revoke_sql) %}\n            {% set grant_statement_list = get_dcl_statement_list(relation, needs_granting, get_grant_sql) %}\n            {% set dcl_statement_list = revoke_statement_list + grant_statement_list %}\n            {% if dcl_statement_list %}\n                {{ call_dcl_statements(dcl_statement_list) }}\n            {% endif %}\n        {% endif %}\n    {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.get_show_grant_sql", "macro.dbt.get_dcl_statement_list", "macro.dbt.call_dcl_statements"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.481486, "supported_languages": null}, "macro.dbt.get_show_sql": {"name": "get_show_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.get_show_sql", "macro_sql": "{% macro get_show_sql(compiled_code, sql_header, limit) -%}\n  {%- if sql_header -%}\n  {{ sql_header }}\n  {%- endif -%}\n  {%- if limit is not none -%}\n  {{ get_limit_subquery_sql(compiled_code, limit) }}\n  {%- else -%}\n  {{ compiled_code }}\n  {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_limit_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.482018, "supported_languages": null}, "macro.dbt.get_limit_subquery_sql": {"name": "get_limit_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.get_limit_subquery_sql", "macro_sql": "{% macro get_limit_subquery_sql(sql, limit) %}\n  {{ adapter.dispatch('get_limit_subquery_sql', 'dbt')(sql, limit) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_limit_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.482212, "supported_languages": null}, "macro.dbt.default__get_limit_subquery_sql": {"name": "default__get_limit_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.default__get_limit_subquery_sql", "macro_sql": "{% macro default__get_limit_subquery_sql(sql, limit) %}\n    select *\n    from (\n        {{ sql }}\n    ) as model_limit_subq\n    limit {{ limit }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.482347, "supported_languages": null}, "macro.dbt.alter_column_comment": {"name": "alter_column_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n  {{ return(adapter.dispatch('alter_column_comment', 'dbt')(relation, column_dict)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.483017, "supported_languages": null}, "macro.dbt.default__alter_column_comment": {"name": "default__alter_column_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.default__alter_column_comment", "macro_sql": "{% macro default__alter_column_comment(relation, column_dict) -%}\n  {{ exceptions.raise_not_implemented(\n    'alter_column_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.483189, "supported_languages": null}, "macro.dbt.alter_relation_comment": {"name": "alter_relation_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n  {{ return(adapter.dispatch('alter_relation_comment', 'dbt')(relation, relation_comment)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__alter_relation_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.483403, "supported_languages": null}, "macro.dbt.default__alter_relation_comment": {"name": "default__alter_relation_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.default__alter_relation_comment", "macro_sql": "{% macro default__alter_relation_comment(relation, relation_comment) -%}\n  {{ exceptions.raise_not_implemented(\n    'alter_relation_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.483571, "supported_languages": null}, "macro.dbt.persist_docs": {"name": "persist_docs", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n  {{ return(adapter.dispatch('persist_docs', 'dbt')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.483846, "supported_languages": null}, "macro.dbt.default__persist_docs": {"name": "default__persist_docs", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.default__persist_docs", "macro_sql": "{% macro default__persist_docs(relation, model, for_relation, for_columns) -%}\n  {% if for_relation and config.persist_relation_docs() and model.description %}\n    {% do run_query(alter_relation_comment(relation, model.description)) %}\n  {% endif %}\n\n  {% if for_columns and config.persist_column_docs() and model.columns %}\n    {% do run_query(alter_column_comment(relation, model.columns)) %}\n  {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.alter_relation_comment", "macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.484339, "supported_languages": null}, "macro.dbt.get_catalog_relations": {"name": "get_catalog_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_catalog_relations", "macro_sql": "{% macro get_catalog_relations(information_schema, relations) -%}\n  {{ return(adapter.dispatch('get_catalog_relations', 'dbt')(information_schema, relations)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_catalog_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4871948, "supported_languages": null}, "macro.dbt.default__get_catalog_relations": {"name": "default__get_catalog_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_catalog_relations", "macro_sql": "{% macro default__get_catalog_relations(information_schema, relations) -%}\n  {% set typename = adapter.type() %}\n  {% set msg -%}\n    get_catalog_relations not implemented for {{ typename }}\n  {%- endset %}\n\n  {{ exceptions.raise_compiler_error(msg) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.487455, "supported_languages": null}, "macro.dbt.get_catalog": {"name": "get_catalog", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n  {{ return(adapter.dispatch('get_catalog', 'dbt')(information_schema, schemas)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4876642, "supported_languages": null}, "macro.dbt.default__get_catalog": {"name": "default__get_catalog", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_catalog", "macro_sql": "{% macro default__get_catalog(information_schema, schemas) -%}\n\n  {% set typename = adapter.type() %}\n  {% set msg -%}\n    get_catalog not implemented for {{ typename }}\n  {%- endset %}\n\n  {{ exceptions.raise_compiler_error(msg) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.487927, "supported_languages": null}, "macro.dbt.information_schema_name": {"name": "information_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n  {{ return(adapter.dispatch('information_schema_name', 'dbt')(database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__information_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.488117, "supported_languages": null}, "macro.dbt.default__information_schema_name": {"name": "default__information_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__information_schema_name", "macro_sql": "{% macro default__information_schema_name(database) -%}\n  {%- if database -%}\n    {{ database }}.INFORMATION_SCHEMA\n  {%- else -%}\n    INFORMATION_SCHEMA\n  {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.488276, "supported_languages": null}, "macro.dbt.list_schemas": {"name": "list_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n  {{ return(adapter.dispatch('list_schemas', 'dbt')(database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__list_schemas"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4884639, "supported_languages": null}, "macro.dbt.default__list_schemas": {"name": "default__list_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__list_schemas", "macro_sql": "{% macro default__list_schemas(database) -%}\n  {% set sql %}\n    select distinct schema_name\n    from {{ information_schema_name(database) }}.SCHEMATA\n    where catalog_name ilike '{{ database }}'\n  {% endset %}\n  {{ return(run_query(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.information_schema_name", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.48879, "supported_languages": null}, "macro.dbt.check_schema_exists": {"name": "check_schema_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n  {{ return(adapter.dispatch('check_schema_exists', 'dbt')(information_schema, schema)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__check_schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.489001, "supported_languages": null}, "macro.dbt.default__check_schema_exists": {"name": "default__check_schema_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__check_schema_exists", "macro_sql": "{% macro default__check_schema_exists(information_schema, schema) -%}\n  {% set sql -%}\n        select count(*)\n        from {{ information_schema.replace(information_schema_view='SCHEMATA') }}\n        where catalog_name='{{ information_schema.database }}'\n          and schema_name='{{ schema }}'\n  {%- endset %}\n  {{ return(run_query(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.489312, "supported_languages": null}, "macro.dbt.list_relations_without_caching": {"name": "list_relations_without_caching", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n  {{ return(adapter.dispatch('list_relations_without_caching', 'dbt')(schema_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4894998, "supported_languages": null}, "macro.dbt.default__list_relations_without_caching": {"name": "default__list_relations_without_caching", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__list_relations_without_caching", "macro_sql": "{% macro default__list_relations_without_caching(schema_relation) %}\n  {{ exceptions.raise_not_implemented(\n    'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.489664, "supported_languages": null}, "macro.dbt.get_relations": {"name": "get_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_relations", "macro_sql": "{% macro get_relations() %}\n  {{ return(adapter.dispatch('get_relations', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.489832, "supported_languages": null}, "macro.dbt.default__get_relations": {"name": "default__get_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_relations", "macro_sql": "{% macro default__get_relations() %}\n  {{ exceptions.raise_not_implemented(\n    'get_relations macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.48999, "supported_languages": null}, "macro.dbt.get_relation_last_modified": {"name": "get_relation_last_modified", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_relation_last_modified", "macro_sql": "{% macro get_relation_last_modified(information_schema, relations) %}\n  {{ return(adapter.dispatch('get_relation_last_modified', 'dbt')(information_schema, relations)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_relation_last_modified"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.490199, "supported_languages": null}, "macro.dbt.default__get_relation_last_modified": {"name": "default__get_relation_last_modified", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_relation_last_modified", "macro_sql": "{% macro default__get_relation_last_modified(information_schema, relations) %}\n  {{ exceptions.raise_not_implemented(\n    'get_relation_last_modified macro not implemented for adapter ' + adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4903731, "supported_languages": null}, "macro.dbt.get_columns_in_relation": {"name": "get_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n  {{ return(adapter.dispatch('get_columns_in_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.492634, "supported_languages": null}, "macro.dbt.default__get_columns_in_relation": {"name": "default__get_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_columns_in_relation", "macro_sql": "{% macro default__get_columns_in_relation(relation) -%}\n  {{ exceptions.raise_not_implemented(\n    'get_columns_in_relation macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4927979, "supported_languages": null}, "macro.dbt.sql_convert_columns_in_relation": {"name": "sql_convert_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.sql_convert_columns_in_relation", "macro_sql": "{% macro sql_convert_columns_in_relation(table) -%}\n  {% set columns = [] %}\n  {% for row in table %}\n    {% do columns.append(api.Column(*row)) %}\n  {% endfor %}\n  {{ return(columns) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.493113, "supported_languages": null}, "macro.dbt.get_empty_subquery_sql": {"name": "get_empty_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_empty_subquery_sql", "macro_sql": "{% macro get_empty_subquery_sql(select_sql, select_sql_header=none) -%}\n  {{ return(adapter.dispatch('get_empty_subquery_sql', 'dbt')(select_sql, select_sql_header)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.49334, "supported_languages": null}, "macro.dbt.default__get_empty_subquery_sql": {"name": "default__get_empty_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_empty_subquery_sql", "macro_sql": "{% macro default__get_empty_subquery_sql(select_sql, select_sql_header=none) %}\n    {%- if select_sql_header is not none -%}\n    {{ select_sql_header }}\n    {%- endif -%}\n    select * from (\n        {{ select_sql }}\n    ) as __dbt_sbq\n    where false\n    limit 0\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4935439, "supported_languages": null}, "macro.dbt.get_empty_schema_sql": {"name": "get_empty_schema_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_empty_schema_sql", "macro_sql": "{% macro get_empty_schema_sql(columns) -%}\n  {{ return(adapter.dispatch('get_empty_schema_sql', 'dbt')(columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_empty_schema_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.493731, "supported_languages": null}, "macro.dbt.default__get_empty_schema_sql": {"name": "default__get_empty_schema_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_empty_schema_sql", "macro_sql": "{% macro default__get_empty_schema_sql(columns) %}\n    {%- set col_err = [] -%}\n    {%- set col_naked_numeric = [] -%}\n    select\n    {% for i in columns %}\n      {%- set col = columns[i] -%}\n      {%- if col['data_type'] is not defined -%}\n        {%- do col_err.append(col['name']) -%}\n      {#-- If this column's type is just 'numeric' then it is missing precision/scale, raise a warning --#}\n      {%- elif col['data_type'].strip().lower() in ('numeric', 'decimal', 'number') -%}\n        {%- do col_naked_numeric.append(col['name']) -%}\n      {%- endif -%}\n      {% set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] %}\n      cast(null as {{ col['data_type'] }}) as {{ col_name }}{{ \", \" if not loop.last }}\n    {%- endfor -%}\n    {%- if (col_err | length) > 0 -%}\n      {{ exceptions.column_type_missing(column_names=col_err) }}\n    {%- elif (col_naked_numeric | length) > 0 -%}\n      {{ exceptions.warn(\"Detected columns with numeric type and unspecified precision/scale, this can lead to unintended rounding: \" ~ col_naked_numeric ~ \"`\") }}\n    {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.494966, "supported_languages": null}, "macro.dbt.get_column_schema_from_query": {"name": "get_column_schema_from_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_column_schema_from_query", "macro_sql": "{% macro get_column_schema_from_query(select_sql, select_sql_header=none) -%}\n    {% set columns = [] %}\n    {# -- Using an 'empty subquery' here to get the same schema as the given select_sql statement, without necessitating a data scan.#}\n    {% set sql = get_empty_subquery_sql(select_sql, select_sql_header) %}\n    {% set column_schema = adapter.get_column_schema_from_query(sql) %}\n    {{ return(column_schema) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.495321, "supported_languages": null}, "macro.dbt.get_columns_in_query": {"name": "get_columns_in_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_columns_in_query", "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n  {{ return(adapter.dispatch('get_columns_in_query', 'dbt')(select_sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.49551, "supported_languages": null}, "macro.dbt.default__get_columns_in_query": {"name": "default__get_columns_in_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_columns_in_query", "macro_sql": "{% macro default__get_columns_in_query(select_sql) %}\n    {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n        {{ get_empty_subquery_sql(select_sql) }}\n    {% endcall %}\n    {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.4958642, "supported_languages": null}, "macro.dbt.alter_column_type": {"name": "alter_column_type", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n  {{ return(adapter.dispatch('alter_column_type', 'dbt')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.496095, "supported_languages": null}, "macro.dbt.default__alter_column_type": {"name": "default__alter_column_type", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__alter_column_type", "macro_sql": "{% macro default__alter_column_type(relation, column_name, new_column_type) -%}\n  {#\n    1. Create a new column (w/ temp name and correct type)\n    2. Copy data over to it\n    3. Drop the existing column (cascade!)\n    4. Rename the new column to existing column\n  #}\n  {%- set tmp_column = column_name + \"__dbt_alter\" -%}\n\n  {% call statement('alter_column_type') %}\n    alter table {{ relation }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n    update {{ relation }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n    alter table {{ relation }} drop column {{ adapter.quote(column_name) }} cascade;\n    alter table {{ relation }} rename column {{ adapter.quote(tmp_column) }} to {{ adapter.quote(column_name) }}\n  {% endcall %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.496696, "supported_languages": null}, "macro.dbt.alter_relation_add_remove_columns": {"name": "alter_relation_add_remove_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.alter_relation_add_remove_columns", "macro_sql": "{% macro alter_relation_add_remove_columns(relation, add_columns = none, remove_columns = none) -%}\n  {{ return(adapter.dispatch('alter_relation_add_remove_columns', 'dbt')(relation, add_columns, remove_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__alter_relation_add_remove_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.496958, "supported_languages": null}, "macro.dbt.default__alter_relation_add_remove_columns": {"name": "default__alter_relation_add_remove_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__alter_relation_add_remove_columns", "macro_sql": "{% macro default__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n\n  {% if add_columns is none %}\n    {% set add_columns = [] %}\n  {% endif %}\n  {% if remove_columns is none %}\n    {% set remove_columns = [] %}\n  {% endif %}\n\n  {% set sql -%}\n\n     alter {{ relation.type }} {{ relation }}\n\n            {% for column in add_columns %}\n               add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n            {% endfor %}{{ ',' if add_columns and remove_columns }}\n\n            {% for column in remove_columns %}\n                drop column {{ column.name }}{{ ',' if not loop.last }}\n            {% endfor %}\n\n  {%- endset -%}\n\n  {% do run_query(sql) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.497751, "supported_languages": null}, "macro.dbt.resolve_model_name": {"name": "resolve_model_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.resolve_model_name", "macro_sql": "{% macro resolve_model_name(input_model_name) %}\n    {{ return(adapter.dispatch('resolve_model_name', 'dbt')(input_model_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.499416, "supported_languages": null}, "macro.dbt.default__resolve_model_name": {"name": "default__resolve_model_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.default__resolve_model_name", "macro_sql": "\n\n{%- macro default__resolve_model_name(input_model_name) -%}\n    {{  input_model_name | string | replace('\"', '\\\"') }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.499573, "supported_languages": null}, "macro.dbt.build_ref_function": {"name": "build_ref_function", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_ref_function", "macro_sql": "{% macro build_ref_function(model) %}\n\n    {%- set ref_dict = {} -%}\n    {%- for _ref in model.refs -%}\n        {% set _ref_args = [_ref.get('package'), _ref['name']] if _ref.get('package') else [_ref['name'],] %}\n        {%- set resolved = ref(*_ref_args, v=_ref.get('version')) -%}\n        {%- if _ref.get('version') -%}\n            {% do _ref_args.extend([\"v\" ~ _ref['version']]) %}\n        {%- endif -%}\n       {%- do ref_dict.update({_ref_args | join('.'): resolve_model_name(resolved)}) -%}\n    {%- endfor -%}\n\ndef ref(*args, **kwargs):\n    refs = {{ ref_dict | tojson }}\n    key = '.'.join(args)\n    version = kwargs.get(\"v\") or kwargs.get(\"version\")\n    if version:\n        key += f\".v{version}\"\n    dbt_load_df_function = kwargs.get(\"dbt_load_df_function\")\n    return dbt_load_df_function(refs[key])\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.500413, "supported_languages": null}, "macro.dbt.build_source_function": {"name": "build_source_function", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_source_function", "macro_sql": "{% macro build_source_function(model) %}\n\n    {%- set source_dict = {} -%}\n    {%- for _source in model.sources -%}\n        {%- set resolved = source(*_source) -%}\n        {%- do source_dict.update({_source | join('.'): resolve_model_name(resolved)}) -%}\n    {%- endfor -%}\n\ndef source(*args, dbt_load_df_function):\n    sources = {{ source_dict | tojson }}\n    key = '.'.join(args)\n    return dbt_load_df_function(sources[key])\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5008352, "supported_languages": null}, "macro.dbt.build_config_dict": {"name": "build_config_dict", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_config_dict", "macro_sql": "{% macro build_config_dict(model) %}\n    {%- set config_dict = {} -%}\n    {% set config_dbt_used = zip(model.config.config_keys_used, model.config.config_keys_defaults) | list %}\n    {%- for key, default in config_dbt_used -%}\n        {# weird type testing with enum, would be much easier to write this logic in Python! #}\n        {%- if key == \"language\" -%}\n          {%- set value = \"python\" -%}\n        {%- endif -%}\n        {%- set value = model.config.get(key, default) -%}\n        {%- do config_dict.update({key: value}) -%}\n    {%- endfor -%}\nconfig_dict = {{ config_dict }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.501431, "supported_languages": null}, "macro.dbt.py_script_postfix": {"name": "py_script_postfix", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.py_script_postfix", "macro_sql": "{% macro py_script_postfix(model) %}\n# This part is user provided model code\n# you will need to copy the next section to run the code\n# COMMAND ----------\n# this part is dbt logic for get ref work, do not modify\n\n{{ build_ref_function(model ) }}\n{{ build_source_function(model ) }}\n{{ build_config_dict(model) }}\n\nclass config:\n    def __init__(self, *args, **kwargs):\n        pass\n\n    @staticmethod\n    def get(key, default=None):\n        return config_dict.get(key, default)\n\nclass this:\n    \"\"\"dbt.this() or dbt.this.identifier\"\"\"\n    database = \"{{ this.database }}\"\n    schema = \"{{ this.schema }}\"\n    identifier = \"{{ this.identifier }}\"\n    {% set this_relation_name = resolve_model_name(this) %}\n    def __repr__(self):\n        return '{{ this_relation_name  }}'\n\n\nclass dbtObj:\n    def __init__(self, load_df_function) -> None:\n        self.source = lambda *args: source(*args, dbt_load_df_function=load_df_function)\n        self.ref = lambda *args, **kwargs: ref(*args, **kwargs, dbt_load_df_function=load_df_function)\n        self.config = config\n        self.this = this()\n        self.is_incremental = {{ is_incremental() }}\n\n# COMMAND ----------\n{{py_script_comment()}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.build_ref_function", "macro.dbt.build_source_function", "macro.dbt.build_config_dict", "macro.dbt.resolve_model_name", "macro.dbt.is_incremental", "macro.dbt.py_script_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.501915, "supported_languages": null}, "macro.dbt.py_script_comment": {"name": "py_script_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.py_script_comment", "macro_sql": "{%macro py_script_comment()%}\n{%endmacro%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5019898, "supported_languages": null}, "macro.dbt.test_unique": {"name": "test_unique", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_unique", "macro_sql": "{% test unique(model, column_name) %}\n    {% set macro = adapter.dispatch('test_unique', 'dbt') %}\n    {{ macro(model, column_name) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__test_unique"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5025039, "supported_languages": null}, "macro.dbt.test_not_null": {"name": "test_not_null", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_not_null", "macro_sql": "{% test not_null(model, column_name) %}\n    {% set macro = adapter.dispatch('test_not_null', 'dbt') %}\n    {{ macro(model, column_name) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5027359, "supported_languages": null}, "macro.dbt.test_accepted_values": {"name": "test_accepted_values", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_accepted_values", "macro_sql": "{% test accepted_values(model, column_name, values, quote=True) %}\n    {% set macro = adapter.dispatch('test_accepted_values', 'dbt') %}\n    {{ macro(model, column_name, values, quote) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.503048, "supported_languages": null}, "macro.dbt.test_relationships": {"name": "test_relationships", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_relationships", "macro_sql": "{% test relationships(model, column_name, to, field) %}\n    {% set macro = adapter.dispatch('test_relationships', 'dbt') %}\n    {{ macro(model, column_name, to, field) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_relationships"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.503325, "supported_languages": null}, "macro.dbt_utils.get_url_host": {"name": "get_url_host", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "unique_id": "macro.dbt_utils.get_url_host", "macro_sql": "{% macro get_url_host(field) -%}\n    {{ return(adapter.dispatch('get_url_host', 'dbt_utils')(field)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_host"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.50368, "supported_languages": null}, "macro.dbt_utils.default__get_url_host": {"name": "default__get_url_host", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "unique_id": "macro.dbt_utils.default__get_url_host", "macro_sql": "{% macro default__get_url_host(field) -%}\n\n{%- set parsed =\n    dbt.split_part(\n        dbt.split_part(\n            dbt.replace(\n                dbt.replace(\n                    dbt.replace(field, \"'android-app://'\", \"''\"\n                    ), \"'http://'\", \"''\"\n                ), \"'https://'\", \"''\"\n            ), \"'/'\", 1\n        ), \"'?'\", 1\n    )\n\n-%}\n\n\n    {{ dbt.safe_cast(\n        parsed,\n        dbt.type_string()\n        )}}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.split_part", "macro.dbt.replace", "macro.dbt.safe_cast", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.504229, "supported_languages": null}, "macro.dbt_utils.get_url_path": {"name": "get_url_path", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "unique_id": "macro.dbt_utils.get_url_path", "macro_sql": "{% macro get_url_path(field) -%}\n    {{ return(adapter.dispatch('get_url_path', 'dbt_utils')(field)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_path"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.504716, "supported_languages": null}, "macro.dbt_utils.default__get_url_path": {"name": "default__get_url_path", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "unique_id": "macro.dbt_utils.default__get_url_path", "macro_sql": "{% macro default__get_url_path(field) -%}\n\n    {%- set stripped_url =\n        dbt.replace(\n            dbt.replace(field, \"'http://'\", \"''\"), \"'https://'\", \"''\")\n    -%}\n\n    {%- set first_slash_pos -%}\n        coalesce(\n            nullif({{ dbt.position(\"'/'\", stripped_url) }}, 0),\n            {{ dbt.position(\"'?'\", stripped_url) }} - 1\n            )\n    {%- endset -%}\n\n    {%- set parsed_path =\n        dbt.split_part(\n            dbt.right(\n                stripped_url,\n                dbt.length(stripped_url) ~ \"-\" ~ first_slash_pos\n                ),\n            \"'?'\", 1\n            )\n    -%}\n\n    {{ dbt.safe_cast(\n        parsed_path,\n        dbt.type_string()\n    )}}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.replace", "macro.dbt.position", "macro.dbt.split_part", "macro.dbt.right", "macro.dbt.length", "macro.dbt.safe_cast", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.505383, "supported_languages": null}, "macro.dbt_utils.get_url_parameter": {"name": "get_url_parameter", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "unique_id": "macro.dbt_utils.get_url_parameter", "macro_sql": "{% macro get_url_parameter(field, url_parameter) -%}\n    {{ return(adapter.dispatch('get_url_parameter', 'dbt_utils')(field, url_parameter)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5057018, "supported_languages": null}, "macro.dbt_utils.default__get_url_parameter": {"name": "default__get_url_parameter", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "unique_id": "macro.dbt_utils.default__get_url_parameter", "macro_sql": "{% macro default__get_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"='\" -%}\n\n{%- set split = dbt.split_part(dbt.split_part(field, formatted_url_parameter, 2), \"'&'\", 1) -%}\n\nnullif({{ split }},'')\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.split_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.50603, "supported_languages": null}, "macro.dbt_utils.test_fewer_rows_than": {"name": "test_fewer_rows_than", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "unique_id": "macro.dbt_utils.test_fewer_rows_than", "macro_sql": "{% test fewer_rows_than(model, compare_model, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_fewer_rows_than', 'dbt_utils')(model, compare_model, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_fewer_rows_than"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.507123, "supported_languages": null}, "macro.dbt_utils.default__test_fewer_rows_than": {"name": "default__test_fewer_rows_than", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "unique_id": "macro.dbt_utils.default__test_fewer_rows_than", "macro_sql": "{% macro default__test_fewer_rows_than(model, compare_model, group_by_columns) %}\n\n{{ config(fail_calc = 'sum(coalesce(row_count_delta, 0))') }}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set join_gb_cols %}\n    {% for c in group_by_columns %}\n      and a.{{c}} = b.{{c}}\n    {% endfor %}\n  {% endset %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n{#-- We must add a fake join key in case additional grouping variables are not provided --#}\n{#-- Redshift does not allow for dynamically created join conditions (e.g. full join on 1 = 1 --#}\n{#-- The same logic is used in equal_rowcount. In case of changes, maintain consistent logic --#}\n{% set group_by_columns = ['id_dbtutils_test_fewer_rows_than'] + group_by_columns %}\n{% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n\n\nwith a as (\n\n    select \n      {{select_gb_cols}}\n      1 as id_dbtutils_test_fewer_rows_than,\n      count(*) as count_our_model \n    from {{ model }}\n    {{ groupby_gb_cols }}\n\n),\nb as (\n\n    select \n      {{select_gb_cols}}\n      1 as id_dbtutils_test_fewer_rows_than,\n      count(*) as count_comparison_model \n    from {{ compare_model }}\n    {{ groupby_gb_cols }}\n\n),\ncounts as (\n\n    select\n\n        {% for c in group_by_columns -%}\n          a.{{c}} as {{c}}_a,\n          b.{{c}} as {{c}}_b,\n        {% endfor %}\n\n        count_our_model,\n        count_comparison_model\n    from a\n    full join b on \n    a.id_dbtutils_test_fewer_rows_than = b.id_dbtutils_test_fewer_rows_than\n    {{ join_gb_cols }}\n\n),\nfinal as (\n\n    select *,\n        case\n            -- fail the test if we have more rows than the reference model and return the row count delta\n            when count_our_model > count_comparison_model then (count_our_model - count_comparison_model)\n            -- fail the test if they are the same number\n            when count_our_model = count_comparison_model then 1\n            -- pass the test if the delta is positive (i.e. return the number 0)\n            else 0\n    end as row_count_delta\n    from counts\n\n)\n\nselect * from final\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.50817, "supported_languages": null}, "macro.dbt_utils.test_equal_rowcount": {"name": "test_equal_rowcount", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "unique_id": "macro.dbt_utils.test_equal_rowcount", "macro_sql": "{% test equal_rowcount(model, compare_model, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_equal_rowcount', 'dbt_utils')(model, compare_model, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_equal_rowcount"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5090508, "supported_languages": null}, "macro.dbt_utils.default__test_equal_rowcount": {"name": "default__test_equal_rowcount", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "unique_id": "macro.dbt_utils.default__test_equal_rowcount", "macro_sql": "{% macro default__test_equal_rowcount(model, compare_model, group_by_columns) %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = 'sum(coalesce(diff_count, 0))') }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n    {{ return('') }}\n{% endif %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(', ') + ', ' %}\n  {% set join_gb_cols %}\n    {% for c in group_by_columns %}\n      and a.{{c}} = b.{{c}}\n    {% endfor %}\n  {% endset %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n{#-- We must add a fake join key in case additional grouping variables are not provided --#}\n{#-- Redshift does not allow for dynamically created join conditions (e.g. full join on 1 = 1 --#}\n{#-- The same logic is used in fewer_rows_than. In case of changes, maintain consistent logic --#}\n{% set group_by_columns = ['id_dbtutils_test_equal_rowcount'] + group_by_columns %}\n{% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n\nwith a as (\n\n    select \n      {{select_gb_cols}}\n      1 as id_dbtutils_test_equal_rowcount,\n      count(*) as count_a \n    from {{ model }}\n    {{groupby_gb_cols}}\n\n\n),\nb as (\n\n    select \n      {{select_gb_cols}}\n      1 as id_dbtutils_test_equal_rowcount,\n      count(*) as count_b \n    from {{ compare_model }}\n    {{groupby_gb_cols}}\n\n),\nfinal as (\n\n    select\n    \n        {% for c in group_by_columns -%}\n          a.{{c}} as {{c}}_a,\n          b.{{c}} as {{c}}_b,\n        {% endfor %}\n\n        count_a,\n        count_b,\n        abs(count_a - count_b) as diff_count\n\n    from a\n    full join b\n    on\n    a.id_dbtutils_test_equal_rowcount = b.id_dbtutils_test_equal_rowcount\n    {{join_gb_cols}}\n\n\n)\n\nselect * from final\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.510169, "supported_languages": null}, "macro.dbt_utils.test_relationships_where": {"name": "test_relationships_where", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "unique_id": "macro.dbt_utils.test_relationships_where", "macro_sql": "{% test relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n  {{ return(adapter.dispatch('test_relationships_where', 'dbt_utils')(model, column_name, to, field, from_condition, to_condition)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_relationships_where"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.510859, "supported_languages": null}, "macro.dbt_utils.default__test_relationships_where": {"name": "default__test_relationships_where", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "unique_id": "macro.dbt_utils.default__test_relationships_where", "macro_sql": "{% macro default__test_relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n\nwith left_table as (\n\n  select\n    {{column_name}} as id\n\n  from {{model}}\n\n  where {{column_name}} is not null\n    and {{from_condition}}\n\n),\n\nright_table as (\n\n  select\n    {{field}} as id\n\n  from {{to}}\n\n  where {{field}} is not null\n    and {{to_condition}}\n\n),\n\nexceptions as (\n\n  select\n    left_table.id,\n    right_table.id as right_id\n\n  from left_table\n\n  left join right_table\n         on left_table.id = right_table.id\n\n  where right_table.id is null\n\n)\n\nselect * from exceptions\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.51121, "supported_languages": null}, "macro.dbt_utils.test_recency": {"name": "test_recency", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "unique_id": "macro.dbt_utils.test_recency", "macro_sql": "{% test recency(model, field, datepart, interval, ignore_time_component=False, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_recency', 'dbt_utils')(model, field, datepart, interval, ignore_time_component, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_recency"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.511939, "supported_languages": null}, "macro.dbt_utils.default__test_recency": {"name": "default__test_recency", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "unique_id": "macro.dbt_utils.default__test_recency", "macro_sql": "{% macro default__test_recency(model, field, datepart, interval, ignore_time_component, group_by_columns) %}\n\n{% set threshold = 'cast(' ~ dbt.dateadd(datepart, interval * -1, dbt.current_timestamp()) ~ ' as ' ~ ('date' if ignore_time_component else dbt.type_timestamp()) ~ ')'  %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n\nwith recency as (\n\n    select \n\n      {{ select_gb_cols }}\n      {% if ignore_time_component %}\n        cast(max({{ field }}) as date) as most_recent\n      {%- else %}\n        max({{ field }}) as most_recent\n      {%- endif %}\n\n    from {{ model }}\n\n    {{ groupby_gb_cols }}\n\n)\n\nselect\n\n    {{ select_gb_cols }}\n    most_recent,\n    {{ threshold }} as threshold\n\nfrom recency\nwhere most_recent < {{ threshold }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.current_timestamp", "macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.51279, "supported_languages": null}, "macro.dbt_utils.test_not_constant": {"name": "test_not_constant", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "unique_id": "macro.dbt_utils.test_not_constant", "macro_sql": "{% test not_constant(model, column_name, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_not_constant', 'dbt_utils')(model, column_name, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_constant"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.513246, "supported_languages": null}, "macro.dbt_utils.default__test_not_constant": {"name": "default__test_not_constant", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "unique_id": "macro.dbt_utils.default__test_not_constant", "macro_sql": "{% macro default__test_not_constant(model, column_name, group_by_columns) %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n\nselect\n    {# In TSQL, subquery aggregate columns need aliases #}\n    {# thus: a filler col name, 'filler_column' #}\n    {{select_gb_cols}}\n    count(distinct {{ column_name }}) as filler_column\n\nfrom {{ model }}\n\n  {{groupby_gb_cols}}\n\nhaving count(distinct {{ column_name }}) = 1\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.51371, "supported_languages": null}, "macro.dbt_utils.test_accepted_range": {"name": "test_accepted_range", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "unique_id": "macro.dbt_utils.test_accepted_range", "macro_sql": "{% test accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n  {{ return(adapter.dispatch('test_accepted_range', 'dbt_utils')(model, column_name, min_value, max_value, inclusive)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_accepted_range"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.514324, "supported_languages": null}, "macro.dbt_utils.default__test_accepted_range": {"name": "default__test_accepted_range", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "unique_id": "macro.dbt_utils.default__test_accepted_range", "macro_sql": "{% macro default__test_accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n\nwith meet_condition as(\n  select *\n  from {{ model }}\n),\n\nvalidation_errors as (\n  select *\n  from meet_condition\n  where\n    -- never true, defaults to an empty result set. Exists to ensure any combo of the `or` clauses below succeeds\n    1 = 2\n\n  {%- if min_value is not none %}\n    -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.\n    or not {{ column_name }} > {{- \"=\" if inclusive }} {{ min_value }}\n  {%- endif %}\n\n  {%- if max_value is not none %}\n    -- records with a value <= max_value are permitted. The `not` flips this to find records that don't meet the rule.\n    or not {{ column_name }} < {{- \"=\" if inclusive }} {{ max_value }}\n  {%- endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.514806, "supported_languages": null}, "macro.dbt_utils.test_not_accepted_values": {"name": "test_not_accepted_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "unique_id": "macro.dbt_utils.test_not_accepted_values", "macro_sql": "{% test not_accepted_values(model, column_name, values, quote=True) %}\n  {{ return(adapter.dispatch('test_not_accepted_values', 'dbt_utils')(model, column_name, values, quote)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.515363, "supported_languages": null}, "macro.dbt_utils.default__test_not_accepted_values": {"name": "default__test_not_accepted_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "unique_id": "macro.dbt_utils.default__test_not_accepted_values", "macro_sql": "{% macro default__test_not_accepted_values(model, column_name, values, quote=True) %}\nwith all_values as (\n\n    select distinct\n        {{ column_name }} as value_field\n\n    from {{ model }}\n\n),\n\nvalidation_errors as (\n\n    select\n        value_field\n\n    from all_values\n    where value_field in (\n        {% for value in values -%}\n            {% if quote -%}\n            '{{ value }}'\n            {%- else -%}\n            {{ value }}\n            {%- endif -%}\n            {%- if not loop.last -%},{%- endif %}\n        {%- endfor %}\n        )\n\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.515815, "supported_languages": null}, "macro.dbt_utils.test_at_least_one": {"name": "test_at_least_one", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "unique_id": "macro.dbt_utils.test_at_least_one", "macro_sql": "{% test at_least_one(model, column_name, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_at_least_one', 'dbt_utils')(model, column_name, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_at_least_one"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.51649, "supported_languages": null}, "macro.dbt_utils.default__test_at_least_one": {"name": "default__test_at_least_one", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "unique_id": "macro.dbt_utils.default__test_at_least_one", "macro_sql": "{% macro default__test_at_least_one(model, column_name, group_by_columns) %}\n\n{% set pruned_cols = [column_name] %}\n\n{% if group_by_columns|length() > 0 %}\n\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n  {% set pruned_cols = group_by_columns %}\n\n  {% if column_name not in pruned_cols %}\n    {% do pruned_cols.append(column_name) %}\n  {% endif %}\n\n{% endif %}\n\n{% set select_pruned_cols = pruned_cols|join(' ,') %}\n\nselect *\nfrom (\n    with pruned_rows as (\n      select\n        {{ select_pruned_cols }}\n      from {{ model }}\n      where {{ column_name }} is not null\n      limit 1\n    )\n    select\n        {# In TSQL, subquery aggregate columns need aliases #}\n        {# thus: a filler col name, 'filler_column' #}\n      {{select_gb_cols}}\n      count({{ column_name }}) as filler_column\n\n    from pruned_rows\n\n    {{groupby_gb_cols}}\n\n    having count({{ column_name }}) = 0\n\n) validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.517296, "supported_languages": null}, "macro.dbt_utils.test_unique_combination_of_columns": {"name": "test_unique_combination_of_columns", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "unique_id": "macro.dbt_utils.test_unique_combination_of_columns", "macro_sql": "{% test unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n  {{ return(adapter.dispatch('test_unique_combination_of_columns', 'dbt_utils')(model, combination_of_columns, quote_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_combination_of_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.517929, "supported_languages": null}, "macro.dbt_utils.default__test_unique_combination_of_columns": {"name": "default__test_unique_combination_of_columns", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "unique_id": "macro.dbt_utils.default__test_unique_combination_of_columns", "macro_sql": "{% macro default__test_unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n\n{% if not quote_columns %}\n    {%- set column_list=combination_of_columns %}\n{% elif quote_columns %}\n    {%- set column_list=[] %}\n        {% for column in combination_of_columns -%}\n            {% set column_list = column_list.append( adapter.quote(column) ) %}\n        {%- endfor %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\n        \"`quote_columns` argument for unique_combination_of_columns test must be one of [True, False] Got: '\" ~ quote ~\"'.'\"\n    ) }}\n{% endif %}\n\n{%- set columns_csv=column_list | join(', ') %}\n\n\nwith validation_errors as (\n\n    select\n        {{ columns_csv }}\n    from {{ model }}\n    group by {{ columns_csv }}\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.518582, "supported_languages": null}, "macro.dbt_utils.test_cardinality_equality": {"name": "test_cardinality_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "unique_id": "macro.dbt_utils.test_cardinality_equality", "macro_sql": "{% test cardinality_equality(model, column_name, to, field) %}\n    {{ return(adapter.dispatch('test_cardinality_equality', 'dbt_utils')(model, column_name, to, field)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_cardinality_equality"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.519157, "supported_languages": null}, "macro.dbt_utils.default__test_cardinality_equality": {"name": "default__test_cardinality_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "unique_id": "macro.dbt_utils.default__test_cardinality_equality", "macro_sql": "{% macro default__test_cardinality_equality(model, column_name, to, field) %}\n\n{# T-SQL does not let you use numbers as aliases for columns #}\n{# Thus, no \"GROUP BY 1\" #}\n\nwith table_a as (\nselect\n  {{ column_name }},\n  count(*) as num_rows\nfrom {{ model }}\ngroup by {{ column_name }}\n),\n\ntable_b as (\nselect\n  {{ field }},\n  count(*) as num_rows\nfrom {{ to }}\ngroup by {{ field }}\n),\n\nexcept_a as (\n  select *\n  from table_a\n  {{ dbt.except() }}\n  select *\n  from table_b\n),\n\nexcept_b as (\n  select *\n  from table_b\n  {{ dbt.except() }}\n  select *\n  from table_a\n),\n\nunioned as (\n  select *\n  from except_a\n  union all\n  select *\n  from except_b\n)\n\nselect *\nfrom unioned\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.519508, "supported_languages": null}, "macro.dbt_utils.test_expression_is_true": {"name": "test_expression_is_true", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "unique_id": "macro.dbt_utils.test_expression_is_true", "macro_sql": "{% test expression_is_true(model, expression, column_name=None) %}\n  {{ return(adapter.dispatch('test_expression_is_true', 'dbt_utils')(model, expression, column_name)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.519913, "supported_languages": null}, "macro.dbt_utils.default__test_expression_is_true": {"name": "default__test_expression_is_true", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "unique_id": "macro.dbt_utils.default__test_expression_is_true", "macro_sql": "{% macro default__test_expression_is_true(model, expression, column_name) %}\n\n{% set column_list = '*' if should_store_failures() else \"1\" %}\n\nselect\n    {{ column_list }}\nfrom {{ model }}\n{% if column_name is none %}\nwhere not({{ expression }})\n{%- else %}\nwhere not({{ column_name }} {{ expression }})\n{%- endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_store_failures"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.520276, "supported_languages": null}, "macro.dbt_utils.test_not_null_proportion": {"name": "test_not_null_proportion", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "unique_id": "macro.dbt_utils.test_not_null_proportion", "macro_sql": "{% macro test_not_null_proportion(model, group_by_columns = []) %}\n  {{ return(adapter.dispatch('test_not_null_proportion', 'dbt_utils')(model, group_by_columns, **kwargs)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_proportion"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.520928, "supported_languages": null}, "macro.dbt_utils.default__test_not_null_proportion": {"name": "default__test_not_null_proportion", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "unique_id": "macro.dbt_utils.default__test_not_null_proportion", "macro_sql": "{% macro default__test_not_null_proportion(model, group_by_columns) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n{% set at_least = kwargs.get('at_least', kwargs.get('arg')) %}\n{% set at_most = kwargs.get('at_most', kwargs.get('arg', 1)) %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n  {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\nwith validation as (\n  select\n    {{select_gb_cols}}\n    sum(case when {{ column_name }} is null then 0 else 1 end) / cast(count(*) as numeric) as not_null_proportion\n  from {{ model }}\n  {{groupby_gb_cols}}\n),\nvalidation_errors as (\n  select\n    {{select_gb_cols}}\n    not_null_proportion\n  from validation\n  where not_null_proportion < {{ at_least }} or not_null_proportion > {{ at_most }}\n)\nselect\n  *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.521759, "supported_languages": null}, "macro.dbt_utils.test_sequential_values": {"name": "test_sequential_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "unique_id": "macro.dbt_utils.test_sequential_values", "macro_sql": "{% test sequential_values(model, column_name, interval=1, datepart=None, group_by_columns = []) %}\n\n  {{ return(adapter.dispatch('test_sequential_values', 'dbt_utils')(model, column_name, interval, datepart, group_by_columns)) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_sequential_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.522667, "supported_languages": null}, "macro.dbt_utils.default__test_sequential_values": {"name": "default__test_sequential_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "unique_id": "macro.dbt_utils.default__test_sequential_values", "macro_sql": "{% macro default__test_sequential_values(model, column_name, interval=1, datepart=None, group_by_columns = []) %}\n\n{% set previous_column_name = \"previous_\" ~ dbt_utils.slugify(column_name) %}\n\n{% if group_by_columns|length() > 0 %}\n  {% set select_gb_cols = group_by_columns|join(',') + ', ' %}\n  {% set partition_gb_cols = 'partition by ' + group_by_columns|join(',') %}\n{% endif %}\n\nwith windowed as (\n\n    select\n        {{ select_gb_cols }}\n        {{ column_name }},\n        lag({{ column_name }}) over (\n            {{partition_gb_cols}}\n            order by {{ column_name }}\n        ) as {{ previous_column_name }}\n    from {{ model }}\n),\n\nvalidation_errors as (\n    select\n        *\n    from windowed\n    {% if datepart %}\n    where not(cast({{ column_name }} as {{ dbt.type_timestamp() }})= cast({{ dbt.dateadd(datepart, interval, previous_column_name) }} as {{ dbt.type_timestamp() }}))\n    {% else %}\n    where not({{ column_name }} = {{ previous_column_name }} + {{ interval }})\n    {% endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.slugify", "macro.dbt.type_timestamp", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.523593, "supported_languages": null}, "macro.dbt_utils.test_equality": {"name": "test_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "unique_id": "macro.dbt_utils.test_equality", "macro_sql": "{% test equality(model, compare_model, compare_columns=None) %}\n  {{ return(adapter.dispatch('test_equality', 'dbt_utils')(model, compare_model, compare_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_equality"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5243351, "supported_languages": null}, "macro.dbt_utils.default__test_equality": {"name": "default__test_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "unique_id": "macro.dbt_utils.default__test_equality", "macro_sql": "{% macro default__test_equality(model, compare_model, compare_columns=None) %}\n\n{% set set_diff %}\n    count(*) + coalesce(abs(\n        sum(case when which_diff = 'a_minus_b' then 1 else 0 end) -\n        sum(case when which_diff = 'b_minus_a' then 1 else 0 end)\n    ), 0)\n{% endset %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = set_diff) }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n    {{ return('') }}\n{% endif %}\n\n-- setup\n{%- do dbt_utils._is_relation(model, 'test_equality') -%}\n\n{#-\nIf the compare_cols arg is provided, we can run this test without querying the\ninformation schema\u00a0\u2014 this allows the model to be an ephemeral model\n-#}\n\n{%- if not compare_columns -%}\n    {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n    {%- set compare_columns = adapter.get_columns_in_relation(model) | map(attribute='quoted') -%}\n{%- endif -%}\n\n{% set compare_cols_csv = compare_columns | join(', ') %}\n\nwith a as (\n\n    select * from {{ model }}\n\n),\n\nb as (\n\n    select * from {{ compare_model }}\n\n),\n\na_minus_b as (\n\n    select {{compare_cols_csv}} from a\n    {{ dbt.except() }}\n    select {{compare_cols_csv}} from b\n\n),\n\nb_minus_a as (\n\n    select {{compare_cols_csv}} from b\n    {{ dbt.except() }}\n    select {{compare_cols_csv}} from a\n\n),\n\nunioned as (\n\n    select 'a_minus_b' as which_diff, a_minus_b.* from a_minus_b\n    union all\n    select 'b_minus_a' as which_diff, b_minus_a.* from b_minus_a\n\n)\n\nselect * from unioned\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5252328, "supported_languages": null}, "macro.dbt_utils.test_not_empty_string": {"name": "test_not_empty_string", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_empty_string.sql", "original_file_path": "macros/generic_tests/not_empty_string.sql", "unique_id": "macro.dbt_utils.test_not_empty_string", "macro_sql": "{% test not_empty_string(model, column_name, trim_whitespace=true) %}\n\n  {{ return(adapter.dispatch('test_not_empty_string', 'dbt_utils')(model, column_name, trim_whitespace)) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_empty_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.525755, "supported_languages": null}, "macro.dbt_utils.default__test_not_empty_string": {"name": "default__test_not_empty_string", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_empty_string.sql", "original_file_path": "macros/generic_tests/not_empty_string.sql", "unique_id": "macro.dbt_utils.default__test_not_empty_string", "macro_sql": "{% macro default__test_not_empty_string(model, column_name, trim_whitespace=true) %}\n\n    with\n    \n    all_values as (\n\n        select \n\n\n            {% if trim_whitespace == true -%}\n\n                trim({{ column_name }}) as {{ column_name }}\n\n            {%- else -%}\n\n                {{ column_name }}\n\n            {%- endif %}\n            \n        from {{ model }}\n\n    ),\n\n    errors as (\n\n        select * from all_values\n        where {{ column_name }} = ''\n\n    )\n\n    select * from errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.526057, "supported_languages": null}, "macro.dbt_utils.test_mutually_exclusive_ranges": {"name": "test_mutually_exclusive_ranges", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "unique_id": "macro.dbt_utils.test_mutually_exclusive_ranges", "macro_sql": "{% test mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n  {{ return(adapter.dispatch('test_mutually_exclusive_ranges', 'dbt_utils')(model, lower_bound_column, upper_bound_column, partition_by, gaps, zero_length_range_allowed)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_mutually_exclusive_ranges"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5296361, "supported_languages": null}, "macro.dbt_utils.default__test_mutually_exclusive_ranges": {"name": "default__test_mutually_exclusive_ranges", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "unique_id": "macro.dbt_utils.default__test_mutually_exclusive_ranges", "macro_sql": "{% macro default__test_mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n{% if gaps == 'not_allowed' %}\n    {% set allow_gaps_operator='=' %}\n    {% set allow_gaps_operator_in_words='equal_to' %}\n{% elif gaps == 'allowed' %}\n    {% set allow_gaps_operator='<=' %}\n    {% set allow_gaps_operator_in_words='less_than_or_equal_to' %}\n{% elif gaps == 'required' %}\n    {% set allow_gaps_operator='<' %}\n    {% set allow_gaps_operator_in_words='less_than' %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\n        \"`gaps` argument for mutually_exclusive_ranges test must be one of ['not_allowed', 'allowed', 'required'] Got: '\" ~ gaps ~\"'.'\"\n    ) }}\n{% endif %}\n{% if not zero_length_range_allowed %}\n    {% set allow_zero_length_operator='<' %}\n    {% set allow_zero_length_operator_in_words='less_than' %}\n{% elif zero_length_range_allowed %}\n    {% set allow_zero_length_operator='<=' %}\n    {% set allow_zero_length_operator_in_words='less_than_or_equal_to' %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\n        \"`zero_length_range_allowed` argument for mutually_exclusive_ranges test must be one of [true, false] Got: '\" ~ zero_length_range_allowed ~\"'.'\"\n    ) }}\n{% endif %}\n\n{% set partition_clause=\"partition by \" ~ partition_by if partition_by else '' %}\n\nwith window_functions as (\n\n    select\n        {% if partition_by %}\n        {{ partition_by }} as partition_by_col,\n        {% endif %}\n        {{ lower_bound_column }} as lower_bound,\n        {{ upper_bound_column }} as upper_bound,\n\n        lead({{ lower_bound_column }}) over (\n            {{ partition_clause }}\n            order by {{ lower_bound_column }}, {{ upper_bound_column }}\n        ) as next_lower_bound,\n\n        row_number() over (\n            {{ partition_clause }}\n            order by {{ lower_bound_column }} desc, {{ upper_bound_column }} desc\n        ) = 1 as is_last_record\n\n    from {{ model }}\n\n),\n\ncalc as (\n    -- We want to return records where one of our assumptions fails, so we'll use\n    -- the `not` function with `and` statements so we can write our assumptions more cleanly\n    select\n        *,\n\n        -- For each record: lower_bound should be < upper_bound.\n        -- Coalesce it to return an error on the null case (implicit assumption\n        -- these columns are not_null)\n        coalesce(\n            lower_bound {{ allow_zero_length_operator }} upper_bound,\n            false\n        ) as lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound,\n\n        -- For each record: upper_bound {{ allow_gaps_operator }} the next lower_bound.\n        -- Coalesce it to handle null cases for the last record.\n        coalesce(\n            upper_bound {{ allow_gaps_operator }} next_lower_bound,\n            is_last_record,\n            false\n        ) as upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n\n    from window_functions\n\n),\n\nvalidation_errors as (\n\n    select\n        *\n    from calc\n\n    where not(\n        -- THE FOLLOWING SHOULD BE TRUE --\n        lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound\n        and upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n    )\n)\n\nselect * from validation_errors\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.53133, "supported_languages": null}, "macro.dbt_utils.pretty_log_format": {"name": "pretty_log_format", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "unique_id": "macro.dbt_utils.pretty_log_format", "macro_sql": "{% macro pretty_log_format(message) %}\n    {{ return(adapter.dispatch('pretty_log_format', 'dbt_utils')(message)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.531629, "supported_languages": null}, "macro.dbt_utils.default__pretty_log_format": {"name": "default__pretty_log_format", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "unique_id": "macro.dbt_utils.default__pretty_log_format", "macro_sql": "{% macro default__pretty_log_format(message) %}\n    {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.531803, "supported_languages": null}, "macro.dbt_utils._is_relation": {"name": "_is_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/_is_relation.sql", "original_file_path": "macros/jinja_helpers/_is_relation.sql", "unique_id": "macro.dbt_utils._is_relation", "macro_sql": "{% macro _is_relation(obj, macro) %}\n    {%- if not (obj is mapping and obj.get('metadata', {}).get('type', '').endswith('Relation')) -%}\n        {%- do exceptions.raise_compiler_error(\"Macro \" ~ macro ~ \" expected a Relation but received the value: \" ~ obj) -%}\n    {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.532266, "supported_languages": null}, "macro.dbt_utils.pretty_time": {"name": "pretty_time", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "unique_id": "macro.dbt_utils.pretty_time", "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n    {{ return(adapter.dispatch('pretty_time', 'dbt_utils')(format)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5325608, "supported_languages": null}, "macro.dbt_utils.default__pretty_time": {"name": "default__pretty_time", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "unique_id": "macro.dbt_utils.default__pretty_time", "macro_sql": "{% macro default__pretty_time(format='%H:%M:%S') %}\n    {{ return(modules.datetime.datetime.now().strftime(format)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.532767, "supported_languages": null}, "macro.dbt_utils.log_info": {"name": "log_info", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "unique_id": "macro.dbt_utils.log_info", "macro_sql": "{% macro log_info(message) %}\n    {{ return(adapter.dispatch('log_info', 'dbt_utils')(message)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__log_info"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.533026, "supported_languages": null}, "macro.dbt_utils.default__log_info": {"name": "default__log_info", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "unique_id": "macro.dbt_utils.default__log_info", "macro_sql": "{% macro default__log_info(message) %}\n    {{ log(dbt_utils.pretty_log_format(message), info=True) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.533204, "supported_languages": null}, "macro.dbt_utils.slugify": {"name": "slugify", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/slugify.sql", "original_file_path": "macros/jinja_helpers/slugify.sql", "unique_id": "macro.dbt_utils.slugify", "macro_sql": "{% macro slugify(string) %}\n\n{#- Lower case the string -#}\n{% set string = string | lower %}\n{#- Replace spaces and dashes with underscores -#}\n{% set string = modules.re.sub('[ -]+', '_', string) %}\n{#- Only take letters, numbers, and underscores -#}\n{% set string = modules.re.sub('[^a-z0-9_]+', '', string) %}\n{#- Prepends \"_\" if string begins with a number -#}\n{% set string = modules.re.sub('^[0-9]', '_' + string[0], string) %}\n\n{{ return(string) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5338209, "supported_languages": null}, "macro.dbt_utils._is_ephemeral": {"name": "_is_ephemeral", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/_is_ephemeral.sql", "original_file_path": "macros/jinja_helpers/_is_ephemeral.sql", "unique_id": "macro.dbt_utils._is_ephemeral", "macro_sql": "{% macro _is_ephemeral(obj, macro) %}\n    {%- if obj.is_cte -%}\n        {% set ephemeral_prefix = api.Relation.add_ephemeral_prefix('') %}\n        {% if obj.name.startswith(ephemeral_prefix) %}\n            {% set model_name = obj.name[(ephemeral_prefix|length):] %}\n        {% else %}\n            {% set model_name = obj.name %}\n        {%- endif -%}\n        {% set error_message %}\nThe `{{ macro }}` macro cannot be used with ephemeral models, as it relies on the information schema.\n\n`{{ model_name }}` is an ephemeral model. Consider making it a view or table instead.\n        {% endset %}\n        {%- do exceptions.raise_compiler_error(error_message) -%}\n    {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.534664, "supported_languages": null}, "macro.dbt_utils.get_intervals_between": {"name": "get_intervals_between", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n    {{ return(adapter.dispatch('get_intervals_between', 'dbt_utils')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5353742, "supported_languages": null}, "macro.dbt_utils.default__get_intervals_between": {"name": "default__get_intervals_between", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n    {%- call statement('get_intervals_between', fetch_result=True) %}\n\n        select {{ dbt.datediff(start_date, end_date, datepart) }}\n\n    {%- endcall -%}\n\n    {%- set value_list = load_result('get_intervals_between') -%}\n\n    {%- if value_list and value_list['data'] -%}\n        {%- set values = value_list['data'] | map(attribute=0) | list %}\n        {{ return(values[0]) }}\n    {%- else -%}\n        {{ return(1) }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.535975, "supported_languages": null}, "macro.dbt_utils.date_spine": {"name": "date_spine", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n    {{ return(adapter.dispatch('date_spine', 'dbt_utils')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.536212, "supported_languages": null}, "macro.dbt_utils.default__date_spine": {"name": "default__date_spine", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n{# call as follows:\n\ndate_spine(\n    \"day\",\n    \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n    \"dbt.dateadd(week, 1, current_date)\"\n) #}\n\n\nwith rawdata as (\n\n    {{dbt_utils.generate_series(\n        dbt_utils.get_intervals_between(start_date, end_date, datepart)\n    )}}\n\n),\n\nall_periods as (\n\n    select (\n        {{\n            dbt.dateadd(\n                datepart,\n                \"row_number() over (order by 1) - 1\",\n                start_date\n            )\n        }}\n    ) as date_{{datepart}}\n    from rawdata\n\n),\n\nfiltered as (\n\n    select *\n    from all_periods\n    where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.generate_series", "macro.dbt_utils.get_intervals_between", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.536588, "supported_languages": null}, "macro.dbt_utils.safe_subtract": {"name": "safe_subtract", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_subtract.sql", "original_file_path": "macros/sql/safe_subtract.sql", "unique_id": "macro.dbt_utils.safe_subtract", "macro_sql": "{%- macro safe_subtract(field_list) -%}\n    {{ return(adapter.dispatch('safe_subtract', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_subtract"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5369751, "supported_languages": null}, "macro.dbt_utils.default__safe_subtract": {"name": "default__safe_subtract", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_subtract.sql", "original_file_path": "macros/sql/safe_subtract.sql", "unique_id": "macro.dbt_utils.default__safe_subtract", "macro_sql": "\n\n{%- macro default__safe_subtract(field_list) -%}\n\n{%- if field_list is not iterable or field_list is string or field_list is mapping -%}\n\n{%- set error_message = '\nWarning: the `safe_subtract` macro takes a single list argument instead of \\\nstring arguments. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.raise_compiler_error(error_message) -%}\n\n{%- endif -%}\n\n{% set fields = [] %}\n\n{%- for field in field_list -%}\n\n    {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' -\\n  ') }}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.537531, "supported_languages": null}, "macro.dbt_utils.nullcheck_table": {"name": "nullcheck_table", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "unique_id": "macro.dbt_utils.nullcheck_table", "macro_sql": "{% macro nullcheck_table(relation) %}\n    {{ return(adapter.dispatch('nullcheck_table', 'dbt_utils')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.537846, "supported_languages": null}, "macro.dbt_utils.default__nullcheck_table": {"name": "default__nullcheck_table", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "unique_id": "macro.dbt_utils.default__nullcheck_table", "macro_sql": "{% macro default__nullcheck_table(relation) %}\n\n  {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%}\n  {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%}\n  {% set cols = adapter.get_columns_in_relation(relation) %}\n\n  select {{ dbt_utils.nullcheck(cols) }}\n  from {{relation}}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.538193, "supported_languages": null}, "macro.dbt_utils.get_relations_by_pattern": {"name": "get_relations_by_pattern", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "unique_id": "macro.dbt_utils.get_relations_by_pattern", "macro_sql": "{% macro get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {{ return(adapter.dispatch('get_relations_by_pattern', 'dbt_utils')(schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5388942, "supported_languages": null}, "macro.dbt_utils.default__get_relations_by_pattern": {"name": "default__get_relations_by_pattern", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "unique_id": "macro.dbt_utils.default__get_relations_by_pattern", "macro_sql": "{% macro default__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n    {%- call statement('get_tables', fetch_result=True) %}\n\n      {{ dbt_utils.get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude, database) }}\n\n    {%- endcall -%}\n\n    {%- set table_list = load_result('get_tables') -%}\n\n    {%- if table_list and table_list['table'] -%}\n        {%- set tbl_relations = [] -%}\n        {%- for row in table_list['table'] -%}\n            {%- set tbl_relation = api.Relation.create(\n                database=database,\n                schema=row.table_schema,\n                identifier=row.table_name,\n                type=row.table_type\n            ) -%}\n            {%- do tbl_relations.append(tbl_relation) -%}\n        {%- endfor -%}\n\n        {{ return(tbl_relations) }}\n    {%- else -%}\n        {{ return([]) }}\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.539819, "supported_languages": null}, "macro.dbt_utils.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n    {{ return(adapter.dispatch('get_powers_of_two', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.540677, "supported_languages": null}, "macro.dbt_utils.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n    {% if upper_bound <= 0 %}\n    {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n    {% endif %}\n\n    {% for _ in range(1, 100) %}\n       {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n    {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.541097, "supported_languages": null}, "macro.dbt_utils.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n    {{ return(adapter.dispatch('generate_series', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.541285, "supported_languages": null}, "macro.dbt_utils.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n    {% set n = dbt_utils.get_powers_of_two(upper_bound) %}\n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    {% for i in range(n) %}\n    p{{i}}.generated_number * power(2, {{i}})\n    {% if not loop.last %} + {% endif %}\n    {% endfor %}\n    + 1\n    as generated_number\n\n    from\n\n    {% for i in range(n) %}\n    p as p{{i}}\n    {% if not loop.last %} cross join {% endif %}\n    {% endfor %}\n\n    )\n\n    select *\n    from unioned\n    where generated_number <= {{upper_bound}}\n    order by generated_number\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.541806, "supported_languages": null}, "macro.dbt_utils.get_relations_by_prefix": {"name": "get_relations_by_prefix", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "unique_id": "macro.dbt_utils.get_relations_by_prefix", "macro_sql": "{% macro get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n    {{ return(adapter.dispatch('get_relations_by_prefix', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.542497, "supported_languages": null}, "macro.dbt_utils.default__get_relations_by_prefix": {"name": "default__get_relations_by_prefix", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "unique_id": "macro.dbt_utils.default__get_relations_by_prefix", "macro_sql": "{% macro default__get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n\n    {%- call statement('get_tables', fetch_result=True) %}\n\n      {{ dbt_utils.get_tables_by_prefix_sql(schema, prefix, exclude, database) }}\n\n    {%- endcall -%}\n\n    {%- set table_list = load_result('get_tables') -%}\n\n    {%- if table_list and table_list['table'] -%}\n        {%- set tbl_relations = [] -%}\n        {%- for row in table_list['table'] -%}\n            {%- set tbl_relation = api.Relation.create(\n                database=database,\n                schema=row.table_schema,\n                identifier=row.table_name,\n                type=row.table_type\n            ) -%}\n            {%- do tbl_relations.append(tbl_relation) -%}\n        {%- endfor -%}\n\n        {{ return(tbl_relations) }}\n    {%- else -%}\n        {{ return([]) }}\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.54336, "supported_languages": null}, "macro.dbt_utils.get_tables_by_prefix_sql": {"name": "get_tables_by_prefix_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "unique_id": "macro.dbt_utils.get_tables_by_prefix_sql", "macro_sql": "{% macro get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n    {{ return(adapter.dispatch('get_tables_by_prefix_sql', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.54377, "supported_languages": null}, "macro.dbt_utils.default__get_tables_by_prefix_sql": {"name": "default__get_tables_by_prefix_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "unique_id": "macro.dbt_utils.default__get_tables_by_prefix_sql", "macro_sql": "{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n\n    {{ dbt_utils.get_tables_by_pattern_sql(\n        schema_pattern = schema,\n        table_pattern = prefix ~ '%',\n        exclude = exclude,\n        database = database\n    ) }}\n    \n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.544062, "supported_languages": null}, "macro.dbt_utils.star": {"name": "star", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "unique_id": "macro.dbt_utils.star", "macro_sql": "{% macro star(from, relation_alias=False, except=[], prefix='', suffix='', quote_identifiers=True) -%}\r\n    {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix, quote_identifiers)) }}\r\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__star"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5453482, "supported_languages": null}, "macro.dbt_utils.default__star": {"name": "default__star", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "unique_id": "macro.dbt_utils.default__star", "macro_sql": "{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='', quote_identifiers=True) -%}\r\n    {%- do dbt_utils._is_relation(from, 'star') -%}\r\n    {%- do dbt_utils._is_ephemeral(from, 'star') -%}\r\n\r\n    {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\r\n    {%- if not execute -%}\r\n        {% do return('*') %}\r\n    {%- endif -%}\r\n\r\n    {% set cols = dbt_utils.get_filtered_columns_in_relation(from, except) %}\r\n\r\n    {%- if cols|length <= 0 -%}\r\n        {% if flags.WHICH == 'compile' %}\r\n            {% set response %}\r\n*\r\n/* No columns were returned. Maybe the relation doesn't exist yet \r\nor all columns were excluded. This star is only output during  \r\ndbt compile, and exists to keep SQLFluff happy. */\r\n            {% endset %}\r\n            {% do return(response) %}\r\n        {% else %}\r\n            {% do return(\"/* no columns returned from star() macro */\") %}\r\n        {% endif %}\r\n    {%- else -%}\r\n        {%- for col in cols %}\r\n            {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%}\r\n                {%- if quote_identifiers -%}\r\n                    {{ adapter.quote(col)|trim }} {%- if prefix!='' or suffix!='' %} as {{ adapter.quote(prefix ~ col ~ suffix)|trim }} {%- endif -%}\r\n                {%- else -%}\r\n                    {{ col|trim }} {%- if prefix!='' or suffix!='' %} as {{ (prefix ~ col ~ suffix)|trim }} {%- endif -%}\r\n                {% endif %}\r\n            {%- if not loop.last %},{{ '\\n  ' }}{%- endif -%}\r\n        {%- endfor -%}\r\n    {% endif %}\r\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.546798, "supported_languages": null}, "macro.dbt_utils.unpivot": {"name": "unpivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "unique_id": "macro.dbt_utils.unpivot", "macro_sql": "{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value') -%}\n    {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__unpivot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.548147, "supported_languages": null}, "macro.dbt_utils.default__unpivot": {"name": "default__unpivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "unique_id": "macro.dbt_utils.default__unpivot", "macro_sql": "{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value') -%}\n\n    {% if not relation %}\n        {{ exceptions.raise_compiler_error(\"Error: argument `relation` is required for `unpivot` macro.\") }}\n    {% endif %}\n\n  {%- set exclude = exclude if exclude is not none else [] %}\n  {%- set remove = remove if remove is not none else [] %}\n\n  {%- set include_cols = [] %}\n\n  {%- set table_columns = {} %}\n\n  {%- do table_columns.update({relation: []}) %}\n\n  {%- do dbt_utils._is_relation(relation, 'unpivot') -%}\n  {%- do dbt_utils._is_ephemeral(relation, 'unpivot') -%}\n  {%- set cols = adapter.get_columns_in_relation(relation) %}\n\n  {%- for col in cols -%}\n    {%- if col.column.lower() not in remove|map('lower') and col.column.lower() not in exclude|map('lower') -%}\n      {% do include_cols.append(col) %}\n    {%- endif %}\n  {%- endfor %}\n\n\n  {%- for col in include_cols -%}\n    select\n      {%- for exclude_col in exclude %}\n        {{ exclude_col }},\n      {%- endfor %}\n\n      cast('{{ col.column }}' as {{ dbt.type_string() }}) as {{ field_name }},\n      cast(  {% if col.data_type == 'boolean' %}\n           {{ dbt.cast_bool_to_text(col.column) }}\n             {% else %}\n           {{ col.column }}\n             {% endif %}\n           as {{ cast_to }}) as {{ value_name }}\n\n    from {{ relation }}\n\n    {% if not loop.last -%}\n      union all\n    {% endif -%}\n  {%- endfor -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.type_string", "macro.dbt.cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.549823, "supported_languages": null}, "macro.dbt_utils.safe_divide": {"name": "safe_divide", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_divide.sql", "original_file_path": "macros/sql/safe_divide.sql", "unique_id": "macro.dbt_utils.safe_divide", "macro_sql": "{% macro safe_divide(numerator, denominator) -%}\n  {{ return(adapter.dispatch('safe_divide', 'dbt_utils')(numerator, denominator)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_divide"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.550123, "supported_languages": null}, "macro.dbt_utils.default__safe_divide": {"name": "default__safe_divide", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_divide.sql", "original_file_path": "macros/sql/safe_divide.sql", "unique_id": "macro.dbt_utils.default__safe_divide", "macro_sql": "{% macro default__safe_divide(numerator, denominator) %}\n    ( {{ numerator }} ) / nullif( ( {{ denominator }} ), 0)\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.550258, "supported_languages": null}, "macro.dbt_utils.union_relations": {"name": "union_relations", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "unique_id": "macro.dbt_utils.union_relations", "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n    {{ return(adapter.dispatch('union_relations', 'dbt_utils')(relations, column_override, include, exclude, source_column_name, where)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__union_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.553515, "supported_languages": null}, "macro.dbt_utils.default__union_relations": {"name": "default__union_relations", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "unique_id": "macro.dbt_utils.default__union_relations", "macro_sql": "\n\n{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n\n    {%- if exclude and include -%}\n        {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n    {%- endif -%}\n\n    {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n    {%- if not execute %}\n        {{ return('') }}\n    {% endif -%}\n\n    {%- set column_override = column_override if column_override is not none else {} -%}\n\n    {%- set relation_columns = {} -%}\n    {%- set column_superset = {} -%}\n    {%- set all_excludes = [] -%}\n    {%- set all_includes = [] -%}\n\n    {%- if exclude -%}\n        {%- for exc in exclude -%}\n            {%- do all_excludes.append(exc | lower) -%}\n        {%- endfor -%}\n    {%- endif -%}\n\n    {%- if include -%}\n        {%- for inc in include -%}\n            {%- do all_includes.append(inc | lower) -%}\n        {%- endfor -%}\n    {%- endif -%}\n\n    {%- for relation in relations -%}\n\n        {%- do relation_columns.update({relation: []}) -%}\n\n        {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n        {%- do dbt_utils._is_ephemeral(relation, 'union_relations') -%}\n        {%- set cols = adapter.get_columns_in_relation(relation) -%}\n        {%- for col in cols -%}\n\n        {#- If an exclude list was provided and the column is in the list, do nothing -#}\n        {%- if exclude and col.column | lower in all_excludes -%}\n\n        {#- If an include list was provided and the column is not in the list, do nothing -#}\n        {%- elif include and col.column | lower not in all_includes -%}\n\n        {#- Otherwise add the column to the column superset -#}\n        {%- else -%}\n\n            {#- update the list of columns in this relation -#}\n            {%- do relation_columns[relation].append(col.column) -%}\n\n            {%- if col.column in column_superset -%}\n\n                {%- set stored = column_superset[col.column] -%}\n                {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n                    {%- do column_superset.update({col.column: col}) -%}\n\n                {%- endif %}\n\n            {%- else -%}\n\n                {%- do column_superset.update({col.column: col}) -%}\n\n            {%- endif -%}\n\n        {%- endif -%}\n\n        {%- endfor -%}\n    {%- endfor -%}\n\n    {%- set ordered_column_names = column_superset.keys() -%}\n    {%- set dbt_command = flags.WHICH -%}\n\n\n    {% if dbt_command in ['run', 'build'] %}\n    {% if (include | length > 0 or exclude | length > 0) and not column_superset.keys() %}\n        {%- set relations_string -%}\n            {%- for relation in relations -%}\n                {{ relation.name }}\n            {%- if not loop.last %}, {% endif -%}\n            {%- endfor -%}\n        {%- endset -%}\n\n        {%- set error_message -%}\n            There were no columns found to union for relations {{ relations_string }}\n        {%- endset -%}\n\n        {{ exceptions.raise_compiler_error(error_message) }}\n    {%- endif -%}\n    {%- endif -%}\n\n    {%- for relation in relations %}\n\n        (\n            select\n\n                {%- if source_column_name is not none %}\n                cast({{ dbt.string_literal(relation) }} as {{ dbt.type_string() }}) as {{ source_column_name }},\n                {%- endif %}\n\n                {% for col_name in ordered_column_names -%}\n\n                    {%- set col = column_superset[col_name] %}\n                    {%- set col_type = column_override.get(col.column, col.data_type) %}\n                    {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n                    cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n                {%- endfor %}\n\n            from {{ relation }}\n\n            {% if where -%}\n            where {{ where }}\n            {%- endif %}\n        )\n\n        {% if not loop.last -%}\n            union all\n        {% endif -%}\n\n    {%- endfor -%}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.string_literal", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5570219, "supported_languages": null}, "macro.dbt_utils.group_by": {"name": "group_by", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "unique_id": "macro.dbt_utils.group_by", "macro_sql": "{%- macro group_by(n) -%}\n    {{ return(adapter.dispatch('group_by', 'dbt_utils')(n)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__group_by"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5573251, "supported_languages": null}, "macro.dbt_utils.default__group_by": {"name": "default__group_by", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "unique_id": "macro.dbt_utils.default__group_by", "macro_sql": "\n\n{%- macro default__group_by(n) -%}\n\n  group by {% for i in range(1, n + 1) -%}\n      {{ i }}{{ ',' if not loop.last }}   \n   {%- endfor -%}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.557575, "supported_languages": null}, "macro.dbt_utils.deduplicate": {"name": "deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.deduplicate", "macro_sql": "{%- macro deduplicate(relation, partition_by, order_by) -%}\n    {{ return(adapter.dispatch('deduplicate', 'dbt_utils')(relation, partition_by, order_by)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.bigquery__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5583491, "supported_languages": null}, "macro.dbt_utils.default__deduplicate": {"name": "default__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.default__deduplicate", "macro_sql": "\n\n{%- macro default__deduplicate(relation, partition_by, order_by) -%}\n\n    with row_numbered as (\n        select\n            _inner.*,\n            row_number() over (\n                partition by {{ partition_by }}\n                order by {{ order_by }}\n            ) as rn\n        from {{ relation }} as _inner\n    )\n\n    select\n        distinct data.*\n    from {{ relation }} as data\n    {#\n    -- Not all DBs will support natural joins but the ones that do include:\n    -- Oracle, MySQL, SQLite, Redshift, Teradata, Materialize, Databricks\n    -- Apache Spark, SingleStore, Vertica\n    -- Those that do not appear to support natural joins include:\n    -- SQLServer, Trino, Presto, Rockset, Athena\n    #}\n    natural join row_numbered\n    where row_numbered.rn = 1\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5585659, "supported_languages": null}, "macro.dbt_utils.redshift__deduplicate": {"name": "redshift__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.redshift__deduplicate", "macro_sql": "{% macro redshift__deduplicate(relation, partition_by, order_by) -%}\n\n    {{ return(dbt_utils.default__deduplicate(relation, partition_by, order_by=order_by)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.558772, "supported_languages": null}, "macro.dbt_utils.postgres__deduplicate": {"name": "postgres__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.postgres__deduplicate", "macro_sql": "\n{%- macro postgres__deduplicate(relation, partition_by, order_by) -%}\n\n    select\n        distinct on ({{ partition_by }}) *\n    from {{ relation }}\n    order by {{ partition_by }}{{ ',' ~ order_by }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.558963, "supported_languages": null}, "macro.dbt_utils.snowflake__deduplicate": {"name": "snowflake__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.snowflake__deduplicate", "macro_sql": "\n{%- macro snowflake__deduplicate(relation, partition_by, order_by) -%}\n\n    select *\n    from {{ relation }}\n    qualify\n        row_number() over (\n            partition by {{ partition_by }}\n            order by {{ order_by }}\n        ) = 1\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.559134, "supported_languages": null}, "macro.dbt_utils.bigquery__deduplicate": {"name": "bigquery__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.bigquery__deduplicate", "macro_sql": "\n{%- macro bigquery__deduplicate(relation, partition_by, order_by) -%}\n\n    select unique.*\n    from (\n        select\n            array_agg (\n                original\n                order by {{ order_by }}\n                limit 1\n            )[offset(0)] unique\n        from {{ relation }} original\n        group by {{ partition_by }}\n    )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5593102, "supported_languages": null}, "macro.dbt_utils.surrogate_key": {"name": "surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "unique_id": "macro.dbt_utils.surrogate_key", "macro_sql": "{%- macro surrogate_key(field_list) -%}\n    {% set frustrating_jinja_feature = varargs %}\n    {{ return(adapter.dispatch('surrogate_key', 'dbt_utils')(field_list, *varargs)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.559699, "supported_languages": null}, "macro.dbt_utils.default__surrogate_key": {"name": "default__surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "unique_id": "macro.dbt_utils.default__surrogate_key", "macro_sql": "\n\n{%- macro default__surrogate_key(field_list) -%}\n\n{%- set error_message = '\nWarning: `dbt_utils.surrogate_key` has been replaced by \\\n`dbt_utils.generate_surrogate_key`. The new macro treats null values \\\ndifferently to empty strings. To restore the behaviour of the original \\\nmacro, add a global variable in dbt_project.yml called \\\n`surrogate_key_treat_nulls_as_empty_strings` to your \\\ndbt_project.yml file with a value of True. \\\nThe {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.raise_compiler_error(error_message) -%}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.559941, "supported_languages": null}, "macro.dbt_utils.safe_add": {"name": "safe_add", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "unique_id": "macro.dbt_utils.safe_add", "macro_sql": "{%- macro safe_add(field_list) -%}\n    {{ return(adapter.dispatch('safe_add', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_add"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.560321, "supported_languages": null}, "macro.dbt_utils.default__safe_add": {"name": "default__safe_add", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "unique_id": "macro.dbt_utils.default__safe_add", "macro_sql": "\n\n{%- macro default__safe_add(field_list) -%}\n\n{%- if field_list is not iterable or field_list is string or field_list is mapping -%}\n\n{%- set error_message = '\nWarning: the `safe_add` macro now takes a single list argument instead of \\\nstring arguments. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.warn(error_message) -%}\n\n{%- endif -%}\n\n{% set fields = [] %}\n\n{%- for field in field_list -%}\n\n    {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' +\\n  ') }}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.560871, "supported_languages": null}, "macro.dbt_utils.nullcheck": {"name": "nullcheck", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "unique_id": "macro.dbt_utils.nullcheck", "macro_sql": "{% macro nullcheck(cols) %}\n    {{ return(adapter.dispatch('nullcheck', 'dbt_utils')(cols)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.561213, "supported_languages": null}, "macro.dbt_utils.default__nullcheck": {"name": "default__nullcheck", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "unique_id": "macro.dbt_utils.default__nullcheck", "macro_sql": "{% macro default__nullcheck(cols) %}\n{%- for col in cols %}\n\n    {% if col.is_string() -%}\n\n    nullif({{col.name}},'') as {{col.name}}\n\n    {%- else -%}\n\n    {{col.name}}\n\n    {%- endif -%}\n\n{%- if not loop.last -%} , {%- endif -%}\n\n{%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.561546, "supported_languages": null}, "macro.dbt_utils.get_tables_by_pattern_sql": {"name": "get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.get_tables_by_pattern_sql", "macro_sql": "{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {{ return(adapter.dispatch('get_tables_by_pattern_sql', 'dbt_utils')\n        (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.bigquery__get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5632892, "supported_languages": null}, "macro.dbt_utils.default__get_tables_by_pattern_sql": {"name": "default__get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.default__get_tables_by_pattern_sql", "macro_sql": "{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n        select distinct\n            table_schema as {{ adapter.quote('table_schema') }},\n            table_name as {{ adapter.quote('table_name') }},\n            {{ dbt_utils.get_table_types_sql() }}\n        from {{ database }}.information_schema.tables\n        where table_schema ilike '{{ schema_pattern }}'\n        and table_name ilike '{{ table_pattern }}'\n        and table_name not ilike '{{ exclude }}'\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5636601, "supported_languages": null}, "macro.dbt_utils.bigquery__get_tables_by_pattern_sql": {"name": "bigquery__get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.bigquery__get_tables_by_pattern_sql", "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n    {% if '%' in schema_pattern %}\n        {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n    {% else %}\n        {% set schemata=[schema_pattern] %}\n    {% endif %}\n\n    {% set sql %}\n        {% for schema in schemata %}\n            select distinct\n                table_schema,\n                table_name,\n                {{ dbt_utils.get_table_types_sql() }}\n\n            from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES\n            where lower(table_name) like lower ('{{ table_pattern }}')\n                and lower(table_name) not like lower ('{{ exclude }}')\n\n            {% if not loop.last %} union all {% endif %}\n\n        {% endfor %}\n    {% endset %}\n\n    {{ return(sql) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._bigquery__get_matching_schemata", "macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.564449, "supported_languages": null}, "macro.dbt_utils._bigquery__get_matching_schemata": {"name": "_bigquery__get_matching_schemata", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils._bigquery__get_matching_schemata", "macro_sql": "{% macro _bigquery__get_matching_schemata(schema_pattern, database) %}\n    {% if execute %}\n\n        {% set sql %}\n        select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA\n        where lower(schema_name) like lower('{{ schema_pattern }}')\n        {% endset %}\n\n        {% set results=run_query(sql) %}\n\n        {% set schemata=results.columns['schema_name'].values() %}\n\n        {{ return(schemata) }}\n\n    {% else %}\n\n        {{ return([]) }}\n\n    {% endif %}\n\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.564966, "supported_languages": null}, "macro.dbt_utils.get_column_values": {"name": "get_column_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "unique_id": "macro.dbt_utils.get_column_values", "macro_sql": "{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n    {{ return(adapter.dispatch('get_column_values', 'dbt_utils')(table, column, order_by, max_records, default, where)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_column_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.566103, "supported_languages": null}, "macro.dbt_utils.default__get_column_values": {"name": "default__get_column_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "unique_id": "macro.dbt_utils.default__get_column_values", "macro_sql": "{% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n    {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n    {%- if not execute -%}\n        {% set default = [] if not default %}\n        {{ return(default) }}\n    {% endif %}\n\n    {%- do dbt_utils._is_ephemeral(table, 'get_column_values') -%}\n\n    {# Not all relations are tables. Renaming for internal clarity without breaking functionality for anyone using named arguments #}\n    {# TODO: Change the method signature in a future 0.x.0 release #}\n    {%- set target_relation = table -%}\n\n    {# adapter.load_relation is a convenience wrapper to avoid building a Relation when we already have one #}\n    {% set relation_exists = (load_relation(target_relation)) is not none %}\n\n    {%- call statement('get_column_values', fetch_result=true) %}\n\n        {%- if not relation_exists and default is none -%}\n\n          {{ exceptions.raise_compiler_error(\"In get_column_values(): relation \" ~ target_relation ~ \" does not exist and no default value was provided.\") }}\n\n        {%- elif not relation_exists and default is not none -%}\n\n          {{ log(\"Relation \" ~ target_relation ~ \" does not exist. Returning the default value: \" ~ default) }}\n\n          {{ return(default) }}\n\n        {%- else -%}\n\n\n            select\n                {{ column }} as value\n\n            from {{ target_relation }}\n\n            {% if where is not none %}\n            where {{ where }}\n            {% endif %}\n\n            group by {{ column }}\n            order by {{ order_by }}\n\n            {% if max_records is not none %}\n            limit {{ max_records }}\n            {% endif %}\n\n        {% endif %}\n\n    {%- endcall -%}\n\n    {%- set value_list = load_result('get_column_values') -%}\n\n    {%- if value_list and value_list['data'] -%}\n        {%- set values = value_list['data'] | map(attribute=0) | list %}\n        {{ return(values) }}\n    {%- else -%}\n        {{ return(default) }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_ephemeral", "macro.dbt.load_relation", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.567657, "supported_languages": null}, "macro.dbt_utils.pivot": {"name": "pivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "unique_id": "macro.dbt_utils.pivot", "macro_sql": "{% macro pivot(column,\n               values,\n               alias=True,\n               agg='sum',\n               cmp='=',\n               prefix='',\n               suffix='',\n               then_value=1,\n               else_value=0,\n               quote_identifiers=True,\n               distinct=False) %}\n    {{ return(adapter.dispatch('pivot', 'dbt_utils')(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pivot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.568733, "supported_languages": null}, "macro.dbt_utils.default__pivot": {"name": "default__pivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "unique_id": "macro.dbt_utils.default__pivot", "macro_sql": "{% macro default__pivot(column,\n               values,\n               alias=True,\n               agg='sum',\n               cmp='=',\n               prefix='',\n               suffix='',\n               then_value=1,\n               else_value=0,\n               quote_identifiers=True,\n               distinct=False) %}\n  {% for value in values %}\n    {{ agg }}(\n      {% if distinct %} distinct {% endif %}\n      case\n      when {{ column }} {{ cmp }} '{{ dbt.escape_single_quotes(value) }}'\n        then {{ then_value }}\n      else {{ else_value }}\n      end\n    )\n    {% if alias %}\n      {% if quote_identifiers %}\n            as {{ adapter.quote(prefix ~ value ~ suffix) }}\n      {% else %}\n        as {{ dbt_utils.slugify(prefix ~ value ~ suffix) }}\n      {% endif %}\n    {% endif %}\n    {% if not loop.last %},{% endif %}\n  {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.escape_single_quotes", "macro.dbt_utils.slugify"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.569587, "supported_languages": null}, "macro.dbt_utils.get_filtered_columns_in_relation": {"name": "get_filtered_columns_in_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "unique_id": "macro.dbt_utils.get_filtered_columns_in_relation", "macro_sql": "{% macro get_filtered_columns_in_relation(from, except=[]) -%}\n    {{ return(adapter.dispatch('get_filtered_columns_in_relation', 'dbt_utils')(from, except)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.570057, "supported_languages": null}, "macro.dbt_utils.default__get_filtered_columns_in_relation": {"name": "default__get_filtered_columns_in_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "unique_id": "macro.dbt_utils.default__get_filtered_columns_in_relation", "macro_sql": "{% macro default__get_filtered_columns_in_relation(from, except=[]) -%}\n    {%- do dbt_utils._is_relation(from, 'get_filtered_columns_in_relation') -%}\n    {%- do dbt_utils._is_ephemeral(from, 'get_filtered_columns_in_relation') -%}\n\n    {# -- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n    {%- if not execute -%}\n        {{ return('') }}\n    {% endif %}\n\n    {%- set include_cols = [] %}\n    {%- set cols = adapter.get_columns_in_relation(from) -%}\n    {%- set except = except | map(\"lower\") | list %}\n    {%- for col in cols -%}\n        {%- if col.column|lower not in except -%}\n            {% do include_cols.append(col.column) %}\n        {%- endif %}\n    {%- endfor %}\n\n    {{ return(include_cols) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.570802, "supported_languages": null}, "macro.dbt_utils.width_bucket": {"name": "width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.width_bucket", "macro_sql": "{% macro width_bucket(expr, min_value, max_value, num_buckets) %}\n  {{ return(adapter.dispatch('width_bucket', 'dbt_utils') (expr, min_value, max_value, num_buckets)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__width_bucket"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5715892, "supported_languages": null}, "macro.dbt_utils.default__width_bucket": {"name": "default__width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.default__width_bucket", "macro_sql": "{% macro default__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n    {% set bin_size -%}\n    (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n    {%- endset %}\n    (\n        -- to break ties when the amount is eaxtly at the bucket egde\n        case\n            when\n                mod(\n                    {{ dbt.safe_cast(expr, dbt.type_numeric() ) }},\n                    {{ dbt.safe_cast(bin_size, dbt.type_numeric() ) }}\n                ) = 0\n            then 1\n            else 0\n        end\n    ) +\n      -- Anything over max_value goes the N+1 bucket\n    least(\n        ceil(\n            ({{ expr }} - {{ min_value }})/{{ bin_size }}\n        ),\n        {{ num_buckets }} + 1\n    )\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.safe_cast", "macro.dbt.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5720608, "supported_languages": null}, "macro.dbt_utils.snowflake__width_bucket": {"name": "snowflake__width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.snowflake__width_bucket", "macro_sql": "{% macro snowflake__width_bucket(expr, min_value, max_value, num_buckets) %}\n    width_bucket({{ expr }}, {{ min_value }}, {{ max_value }}, {{ num_buckets }} )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.572255, "supported_languages": null}, "macro.dbt_utils.get_query_results_as_dict": {"name": "get_query_results_as_dict", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "unique_id": "macro.dbt_utils.get_query_results_as_dict", "macro_sql": "{% macro get_query_results_as_dict(query) %}\n    {{ return(adapter.dispatch('get_query_results_as_dict', 'dbt_utils')(query)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_query_results_as_dict"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.572642, "supported_languages": null}, "macro.dbt_utils.default__get_query_results_as_dict": {"name": "default__get_query_results_as_dict", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "unique_id": "macro.dbt_utils.default__get_query_results_as_dict", "macro_sql": "{% macro default__get_query_results_as_dict(query) %}\n\n{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #}\n\n    {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%}\n\n        {{ query }}\n\n    {%- endcall -%}\n\n    {% set sql_results={} %}\n\n    {%- if execute -%}\n        {% set sql_results_table = load_result('get_query_results').table.columns %}\n        {% for column_name, column in sql_results_table.items() %}\n            {% do sql_results.update({column_name: column.values()}) %}\n        {% endfor %}\n    {%- endif -%}\n\n    {{ return(sql_results) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.573243, "supported_languages": null}, "macro.dbt_utils.generate_surrogate_key": {"name": "generate_surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_surrogate_key.sql", "original_file_path": "macros/sql/generate_surrogate_key.sql", "unique_id": "macro.dbt_utils.generate_surrogate_key", "macro_sql": "{%- macro generate_surrogate_key(field_list) -%}\n    {{ return(adapter.dispatch('generate_surrogate_key', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__generate_surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5737011, "supported_languages": null}, "macro.dbt_utils.default__generate_surrogate_key": {"name": "default__generate_surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_surrogate_key.sql", "original_file_path": "macros/sql/generate_surrogate_key.sql", "unique_id": "macro.dbt_utils.default__generate_surrogate_key", "macro_sql": "\n\n{%- macro default__generate_surrogate_key(field_list) -%}\n\n{%- if var('surrogate_key_treat_nulls_as_empty_strings', False) -%}\n    {%- set default_null_value = \"\" -%}\n{%- else -%}\n    {%- set default_null_value = '_dbt_utils_surrogate_key_null_' -%}\n{%- endif -%}\n\n{%- set fields = [] -%}\n\n{%- for field in field_list -%}\n\n    {%- do fields.append(\n        \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt.type_string() ~ \"), '\" ~ default_null_value  ~\"')\"\n    ) -%}\n\n    {%- if not loop.last %}\n        {%- do fields.append(\"'-'\") -%}\n    {%- endif -%}\n\n{%- endfor -%}\n\n{{ dbt.hash(dbt.concat(fields)) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.hash", "macro.dbt.concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.574336, "supported_languages": null}, "macro.dbt_utils.get_table_types_sql": {"name": "get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.get_table_types_sql", "macro_sql": "{%- macro get_table_types_sql() -%}\n  {{ return(adapter.dispatch('get_table_types_sql', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_utils.default__get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5748742, "supported_languages": null}, "macro.dbt_utils.default__get_table_types_sql": {"name": "default__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.default__get_table_types_sql", "macro_sql": "{% macro default__get_table_types_sql() %}\n            case table_type\n                when 'BASE TABLE' then 'table'\n                when 'EXTERNAL TABLE' then 'external'\n                when 'MATERIALIZED VIEW' then 'materializedview'\n                else lower(table_type)\n            end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5750241, "supported_languages": null}, "macro.dbt_utils.postgres__get_table_types_sql": {"name": "postgres__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.postgres__get_table_types_sql", "macro_sql": "{% macro postgres__get_table_types_sql() %}\n            case table_type\n                when 'BASE TABLE' then 'table'\n                when 'FOREIGN' then 'external'\n                when 'MATERIALIZED VIEW' then 'materializedview'\n                else lower(table_type)\n            end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5751638, "supported_languages": null}, "macro.dbt_utils.databricks__get_table_types_sql": {"name": "databricks__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.databricks__get_table_types_sql", "macro_sql": "{% macro databricks__get_table_types_sql() %}\n            case table_type\n                when 'MANAGED' then 'table'\n                when 'BASE TABLE' then 'table'\n                when 'MATERIALIZED VIEW' then 'materializedview'\n                else lower(table_type)\n            end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5753028, "supported_languages": null}, "macro.dbt_utils.get_single_value": {"name": "get_single_value", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_single_value.sql", "original_file_path": "macros/sql/get_single_value.sql", "unique_id": "macro.dbt_utils.get_single_value", "macro_sql": "{% macro get_single_value(query, default=none) %}\n    {{ return(adapter.dispatch('get_single_value', 'dbt_utils')(query, default)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_single_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.575828, "supported_languages": null}, "macro.dbt_utils.default__get_single_value": {"name": "default__get_single_value", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_single_value.sql", "original_file_path": "macros/sql/get_single_value.sql", "unique_id": "macro.dbt_utils.default__get_single_value", "macro_sql": "{% macro default__get_single_value(query, default) %}\n\n{# This macro returns the (0, 0) record in a query, i.e. the first row of the first column #}\n\n    {%- call statement('get_query_result', fetch_result=True, auto_begin=false) -%}\n\n        {{ query }}\n\n    {%- endcall -%}\n\n    {%- if execute -%}\n\n        {% set r = load_result('get_query_result').table.columns[0].values() %}\n        {% if r | length == 0 %}\n            {% do print('Query `' ~ query ~ '` returned no rows. Using the default value: ' ~ default) %}\n            {% set sql_result = default %}\n        {% else %}\n            {% set sql_result = r[0] %}\n        {% endif %}\n        \n    {%- else -%}\n    \n        {% set sql_result = default %}\n    \n    {%- endif -%}\n\n    {% do return(sql_result) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5766358, "supported_languages": null}, "macro.dbt_utils.degrees_to_radians": {"name": "degrees_to_radians", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.degrees_to_radians", "macro_sql": "{% macro degrees_to_radians(degrees) -%}\n    acos(-1) * {{degrees}} / 180\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5777228, "supported_languages": null}, "macro.dbt_utils.haversine_distance": {"name": "haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.haversine_distance", "macro_sql": "{% macro haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n    {{ return(adapter.dispatch('haversine_distance', 'dbt_utils')(lat1,lon1,lat2,lon2,unit)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.bigquery__haversine_distance"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.578007, "supported_languages": null}, "macro.dbt_utils.default__haversine_distance": {"name": "default__haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{%- if unit == 'mi' %}\n    {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n    {% set conversion_rate = 1.60934 %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n\n    2 * 3961 * asin(sqrt(power((sin(radians(({{ lat2 }} - {{ lat1 }}) / 2))), 2) +\n    cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n    power((sin(radians(({{ lon2 }} - {{ lon1 }}) / 2))), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.578599, "supported_languages": null}, "macro.dbt_utils.bigquery__haversine_distance": {"name": "bigquery__haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.bigquery__haversine_distance", "macro_sql": "{% macro bigquery__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{% set radians_lat1 = dbt_utils.degrees_to_radians(lat1) %}\n{% set radians_lat2 = dbt_utils.degrees_to_radians(lat2) %}\n{% set radians_lon1 = dbt_utils.degrees_to_radians(lon1) %}\n{% set radians_lon2 = dbt_utils.degrees_to_radians(lon2) %}\n{%- if unit == 'mi' %}\n    {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n    {% set conversion_rate = 1.60934 %}\n{% else %}\n    {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n    2 * 3961 * asin(sqrt(power(sin(({{ radians_lat2 }} - {{ radians_lat1 }}) / 2), 2) +\n    cos({{ radians_lat1 }}) * cos({{ radians_lat2 }}) *\n    power(sin(({{ radians_lon2 }} - {{ radians_lon1 }}) / 2), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.degrees_to_radians"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5794141, "supported_languages": null}, "macro.spark_utils.get_tables": {"name": "get_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.get_tables", "macro_sql": "{% macro get_tables(table_regex_pattern='.*') %}\n\n  {% set tables = [] %}\n  {% for database in spark__list_schemas('not_used') %}\n    {% for table in spark__list_relations_without_caching(database[0]) %}\n      {% set db_tablename = database[0] ~ \".\" ~ table[1] %}\n      {% set is_match = modules.re.match(table_regex_pattern, db_tablename) %}\n      {% if is_match %}\n        {% call statement('table_detail', fetch_result=True) -%}\n          describe extended {{ db_tablename }}\n        {% endcall %}\n\n        {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('type', 'TYPE', 'Type'))|first %}\n        {% if table_type[1]|lower != 'view' %}\n          {{ tables.append(db_tablename) }}\n        {% endif %}\n      {% endif %}\n    {% endfor %}\n  {% endfor %}\n  {{ return(tables) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.584695, "supported_languages": null}, "macro.spark_utils.get_delta_tables": {"name": "get_delta_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.get_delta_tables", "macro_sql": "{% macro get_delta_tables(table_regex_pattern='.*') %}\n\n  {% set delta_tables = [] %}\n  {% for db_tablename in get_tables(table_regex_pattern) %}\n    {% call statement('table_detail', fetch_result=True) -%}\n      describe extended {{ db_tablename }}\n    {% endcall %}\n\n    {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('provider', 'PROVIDER', 'Provider'))|first %}\n    {% if table_type[1]|lower == 'delta' %}\n      {{ delta_tables.append(db_tablename) }}\n    {% endif %}\n  {% endfor %}\n  {{ return(delta_tables) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.585403, "supported_languages": null}, "macro.spark_utils.get_statistic_columns": {"name": "get_statistic_columns", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.get_statistic_columns", "macro_sql": "{% macro get_statistic_columns(table) %}\n\n  {% call statement('input_columns', fetch_result=True) %}\n    SHOW COLUMNS IN {{ table }}\n  {% endcall %}\n  {% set input_columns = load_result('input_columns').table %}\n\n  {% set output_columns = [] %}\n  {% for column in input_columns %}\n    {% call statement('column_information', fetch_result=True) %}\n      DESCRIBE TABLE {{ table }} `{{ column[0] }}`\n    {% endcall %}\n    {% if not load_result('column_information').table[1][1].startswith('struct') and not load_result('column_information').table[1][1].startswith('array')  %}\n      {{ output_columns.append('`' ~ column[0] ~ '`') }}\n    {% endif %}\n  {% endfor %}\n  {{ return(output_columns) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.586304, "supported_languages": null}, "macro.spark_utils.spark_optimize_delta_tables": {"name": "spark_optimize_delta_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.spark_optimize_delta_tables", "macro_sql": "{% macro spark_optimize_delta_tables(table_regex_pattern='.*') %}\n\n  {% for table in get_delta_tables(table_regex_pattern) %}\n    {% set start=modules.datetime.datetime.now() %}\n    {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Optimizing \" ~ table) }}\n    {% do run_query(\"optimize \" ~ table) %}\n    {% set end=modules.datetime.datetime.now() %}\n    {% set total_seconds = (end - start).total_seconds() | round(2)  %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n  {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5870662, "supported_languages": null}, "macro.spark_utils.spark_vacuum_delta_tables": {"name": "spark_vacuum_delta_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.spark_vacuum_delta_tables", "macro_sql": "{% macro spark_vacuum_delta_tables(table_regex_pattern='.*') %}\n\n  {% for table in get_delta_tables(table_regex_pattern) %}\n    {% set start=modules.datetime.datetime.now() %}\n    {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Vacuuming \" ~ table) }}\n    {% do run_query(\"vacuum \" ~ table) %}\n    {% set end=modules.datetime.datetime.now() %}\n    {% set total_seconds = (end - start).total_seconds() | round(2)  %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n  {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5878139, "supported_languages": null}, "macro.spark_utils.spark_analyze_tables": {"name": "spark_analyze_tables", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "unique_id": "macro.spark_utils.spark_analyze_tables", "macro_sql": "{% macro spark_analyze_tables(table_regex_pattern='.*') %}\n\n  {% for table in get_tables(table_regex_pattern) %}\n    {% set start=modules.datetime.datetime.now() %}\n    {% set columns = get_statistic_columns(table) | join(',') %}\n    {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Analyzing \" ~ table) }}\n    {% if columns != '' %}\n      {% do run_query(\"analyze table \" ~ table ~ \" compute statistics for columns \" ~ columns) %}\n    {% endif %}\n    {% set end=modules.datetime.datetime.now() %}\n    {% set total_seconds = (end - start).total_seconds() | round(2)  %}\n    {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n  {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.spark_utils.get_statistic_columns", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.588935, "supported_languages": null}, "macro.spark_utils.spark__concat": {"name": "spark__concat", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/concat.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/concat.sql", "unique_id": "macro.spark_utils.spark__concat", "macro_sql": "{% macro spark__concat(fields) -%}\n    concat({{ fields|join(', ') }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5891159, "supported_languages": null}, "macro.spark_utils.spark__type_numeric": {"name": "spark__type_numeric", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "unique_id": "macro.spark_utils.spark__type_numeric", "macro_sql": "{% macro spark__type_numeric() %}\n    decimal(28, 6)\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.5892239, "supported_languages": null}, "macro.spark_utils.spark__dateadd": {"name": "spark__dateadd", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "unique_id": "macro.spark_utils.spark__dateadd", "macro_sql": "{% macro spark__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n    {%- set clock_component -%}\n        {# make sure the dates + timestamps are real, otherwise raise an error asap #}\n        to_unix_timestamp({{ spark_utils.assert_not_null('to_timestamp', from_date_or_timestamp) }})\n        - to_unix_timestamp({{ spark_utils.assert_not_null('date', from_date_or_timestamp) }})\n    {%- endset -%}\n\n    {%- if datepart in ['day', 'week'] -%}\n        \n        {%- set multiplier = 7 if datepart == 'week' else 1 -%}\n\n        to_timestamp(\n            to_unix_timestamp(\n                date_add(\n                    {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n                    cast({{interval}} * {{multiplier}} as int)\n                )\n            ) + {{clock_component}}\n        )\n\n    {%- elif datepart in ['month', 'quarter', 'year'] -%}\n    \n        {%- set multiplier -%} \n            {%- if datepart == 'month' -%} 1\n            {%- elif datepart == 'quarter' -%} 3\n            {%- elif datepart == 'year' -%} 12\n            {%- endif -%}\n        {%- endset -%}\n\n        to_timestamp(\n            to_unix_timestamp(\n                add_months(\n                    {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n                    cast({{interval}} * {{multiplier}} as int)\n                )\n            ) + {{clock_component}}\n        )\n\n    {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n    \n        {%- set multiplier -%} \n            {%- if datepart == 'hour' -%} 3600\n            {%- elif datepart == 'minute' -%} 60\n            {%- elif datepart == 'second' -%} 1\n            {%- elif datepart == 'millisecond' -%} (1/1000000)\n            {%- elif datepart == 'microsecond' -%} (1/1000000)\n            {%- endif -%}\n        {%- endset -%}\n\n        to_timestamp(\n            {{ spark_utils.assert_not_null('to_unix_timestamp', from_date_or_timestamp) }}\n            + cast({{interval}} * {{multiplier}} as int)\n        )\n\n    {%- else -%}\n\n        {{ exceptions.raise_compiler_error(\"macro dateadd not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.592126, "supported_languages": null}, "macro.spark_utils.spark__datediff": {"name": "spark__datediff", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/datediff.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datediff.sql", "unique_id": "macro.spark_utils.spark__datediff", "macro_sql": "{% macro spark__datediff(first_date, second_date, datepart) %}\n\n    {%- if datepart in ['day', 'week', 'month', 'quarter', 'year'] -%}\n    \n        {# make sure the dates are real, otherwise raise an error asap #}\n        {% set first_date = spark_utils.assert_not_null('date', first_date) %}\n        {% set second_date = spark_utils.assert_not_null('date', second_date) %}\n    \n    {%- endif -%}\n    \n    {%- if datepart == 'day' -%}\n    \n        datediff({{second_date}}, {{first_date}})\n    \n    {%- elif datepart == 'week' -%}\n    \n        case when {{first_date}} < {{second_date}}\n            then floor(datediff({{second_date}}, {{first_date}})/7)\n            else ceil(datediff({{second_date}}, {{first_date}})/7)\n            end\n        \n        -- did we cross a week boundary (Sunday)?\n        + case\n            when {{first_date}} < {{second_date}} and dayofweek({{second_date}}) < dayofweek({{first_date}}) then 1\n            when {{first_date}} > {{second_date}} and dayofweek({{second_date}}) > dayofweek({{first_date}}) then -1\n            else 0 end\n\n    {%- elif datepart == 'month' -%}\n\n        case when {{first_date}} < {{second_date}}\n            then floor(months_between(date({{second_date}}), date({{first_date}})))\n            else ceil(months_between(date({{second_date}}), date({{first_date}})))\n            end\n        \n        -- did we cross a month boundary?\n        + case\n            when {{first_date}} < {{second_date}} and dayofmonth({{second_date}}) < dayofmonth({{first_date}}) then 1\n            when {{first_date}} > {{second_date}} and dayofmonth({{second_date}}) > dayofmonth({{first_date}}) then -1\n            else 0 end\n        \n    {%- elif datepart == 'quarter' -%}\n    \n        case when {{first_date}} < {{second_date}}\n            then floor(months_between(date({{second_date}}), date({{first_date}}))/3)\n            else ceil(months_between(date({{second_date}}), date({{first_date}}))/3)\n            end\n        \n        -- did we cross a quarter boundary?\n        + case\n            when {{first_date}} < {{second_date}} and (\n                (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n                < (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n            ) then 1\n            when {{first_date}} > {{second_date}} and (\n                (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n                > (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n            ) then -1\n            else 0 end\n\n    {%- elif datepart == 'year' -%}\n    \n        year({{second_date}}) - year({{first_date}})\n\n    {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n    \n        {%- set divisor -%} \n            {%- if datepart == 'hour' -%} 3600\n            {%- elif datepart == 'minute' -%} 60\n            {%- elif datepart == 'second' -%} 1\n            {%- elif datepart == 'millisecond' -%} (1/1000)\n            {%- elif datepart == 'microsecond' -%} (1/1000000)\n            {%- endif -%}\n        {%- endset -%}\n\n        case when {{first_date}} < {{second_date}}\n            then ceil((\n                {# make sure the timestamps are real, otherwise raise an error asap #}\n                {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n                - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n            ) / {{divisor}})\n            else floor((\n                {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n                - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n            ) / {{divisor}})\n            end\n            \n            {% if datepart == 'millisecond' %}\n                + cast(date_format({{second_date}}, 'SSS') as int)\n                - cast(date_format({{first_date}}, 'SSS') as int)\n            {% endif %}\n            \n            {% if datepart == 'microsecond' %}    \n                {% set capture_str = '[0-9]{4}-[0-9]{2}-[0-9]{2}.[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]{6})' %}\n                -- Spark doesn't really support microseconds, so this is a massive hack!\n                -- It will only work if the timestamp-string is of the format\n                -- 'yyyy-MM-dd-HH mm.ss.SSSSSS'\n                + cast(regexp_extract({{second_date}}, '{{capture_str}}', 1) as int)\n                - cast(regexp_extract({{first_date}}, '{{capture_str}}', 1) as int)    \n            {% endif %}\n\n    {%- else -%}\n\n        {{ exceptions.raise_compiler_error(\"macro datediff not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.599827, "supported_languages": null}, "macro.spark_utils.spark__current_timestamp": {"name": "spark__current_timestamp", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "unique_id": "macro.spark_utils.spark__current_timestamp", "macro_sql": "{% macro spark__current_timestamp() %}\n    current_timestamp()\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.599969, "supported_languages": null}, "macro.spark_utils.spark__current_timestamp_in_utc": {"name": "spark__current_timestamp_in_utc", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "unique_id": "macro.spark_utils.spark__current_timestamp_in_utc", "macro_sql": "{% macro spark__current_timestamp_in_utc() %}\n    unix_timestamp()\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.600045, "supported_languages": null}, "macro.spark_utils.spark__split_part": {"name": "spark__split_part", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/cross_db_utils/split_part.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/split_part.sql", "unique_id": "macro.spark_utils.spark__split_part", "macro_sql": "{% macro spark__split_part(string_text, delimiter_text, part_number) %}\n\n    {% set delimiter_expr %}\n    \n        -- escape if starts with a special character\n        case when regexp_extract({{ delimiter_text }}, '([^A-Za-z0-9])(.*)', 1) != '_'\n            then concat('\\\\', {{ delimiter_text }})\n            else {{ delimiter_text }} end\n    \n    {% endset %}\n\n    {% set split_part_expr %}\n    \n    split(\n        {{ string_text }},\n        {{ delimiter_expr }}\n        )[({{ part_number - 1 }})]\n    \n    {% endset %}\n    \n    {{ return(split_part_expr) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6006222, "supported_languages": null}, "macro.spark_utils.spark__get_relations_by_pattern": {"name": "spark__get_relations_by_pattern", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "unique_id": "macro.spark_utils.spark__get_relations_by_pattern", "macro_sql": "{% macro spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n    {%- call statement('get_tables', fetch_result=True) %}\n\n        show table extended in {{ schema_pattern }} like '{{ table_pattern }}'\n\n    {%- endcall -%}\n\n    {%- set table_list = load_result('get_tables') -%}\n\n    {%- if table_list and table_list['table'] -%}\n    {%- set tbl_relations = [] -%}\n    {%- for row in table_list['table'] -%}\n        {%- set tbl_relation = api.Relation.create(\n            database=None,\n            schema=row[0],\n            identifier=row[1],\n            type=('view' if 'Type: VIEW' in row[3] else 'table')\n        ) -%}\n        {%- do tbl_relations.append(tbl_relation) -%}\n    {%- endfor -%}\n\n    {{ return(tbl_relations) }}\n    {%- else -%}\n    {{ return([]) }}\n    {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.602228, "supported_languages": null}, "macro.spark_utils.spark__get_relations_by_prefix": {"name": "spark__get_relations_by_prefix", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "unique_id": "macro.spark_utils.spark__get_relations_by_prefix", "macro_sql": "{% macro spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {% set table_pattern = table_pattern ~ '*' %}\n    {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.602568, "supported_languages": null}, "macro.spark_utils.spark__get_tables_by_pattern": {"name": "spark__get_tables_by_pattern", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "unique_id": "macro.spark_utils.spark__get_tables_by_pattern", "macro_sql": "{% macro spark__get_tables_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.602849, "supported_languages": null}, "macro.spark_utils.spark__get_tables_by_prefix": {"name": "spark__get_tables_by_prefix", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "unique_id": "macro.spark_utils.spark__get_tables_by_prefix", "macro_sql": "{% macro spark__get_tables_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n    {{ return(spark_utils.spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.603128, "supported_languages": null}, "macro.spark_utils.assert_not_null": {"name": "assert_not_null", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "unique_id": "macro.spark_utils.assert_not_null", "macro_sql": "{% macro assert_not_null(function, arg) -%}\n  {{ return(adapter.dispatch('assert_not_null', 'spark_utils')(function, arg)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.spark_utils.default__assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.60345, "supported_languages": null}, "macro.spark_utils.default__assert_not_null": {"name": "default__assert_not_null", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "unique_id": "macro.spark_utils.default__assert_not_null", "macro_sql": "{% macro default__assert_not_null(function, arg) %}\n\n    coalesce({{function}}({{arg}}), nvl2({{function}}({{arg}}), assert_true({{function}}({{arg}}) is not null), null))\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.603651, "supported_languages": null}, "macro.spark_utils.spark__convert_timezone": {"name": "spark__convert_timezone", "resource_type": "macro", "package_name": "spark_utils", "path": "macros/snowplow/convert_timezone.sql", "original_file_path": "macros/snowplow/convert_timezone.sql", "unique_id": "macro.spark_utils.spark__convert_timezone", "macro_sql": "{% macro spark__convert_timezone(in_tz, out_tz, in_timestamp) %}\n    from_utc_timestamp(to_utc_timestamp({{in_timestamp}}, {{in_tz}}), {{out_tz}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6038542, "supported_languages": null}, "macro.dbt_date.get_date_dimension": {"name": "get_date_dimension", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_date_dimension.sql", "original_file_path": "macros/get_date_dimension.sql", "unique_id": "macro.dbt_date.get_date_dimension", "macro_sql": "{% macro get_date_dimension(start_date, end_date) %}\n    {{ adapter.dispatch('get_date_dimension', 'dbt_date') (start_date, end_date) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__get_date_dimension"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.613007, "supported_languages": null}, "macro.dbt_date.default__get_date_dimension": {"name": "default__get_date_dimension", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_date_dimension.sql", "original_file_path": "macros/get_date_dimension.sql", "unique_id": "macro.dbt_date.default__get_date_dimension", "macro_sql": "{% macro default__get_date_dimension(start_date, end_date) %}\nwith base_dates as (\n    {{ dbt_date.get_base_dates(start_date, end_date) }}\n),\ndates_with_prior_year_dates as (\n\n    select\n        cast(d.date_day as date) as date_day,\n        cast({{ dbt.dateadd('year', -1 , 'd.date_day') }} as date) as prior_year_date_day,\n        cast({{ dbt.dateadd('day', -364 , 'd.date_day') }} as date) as prior_year_over_year_date_day\n    from\n    \tbase_dates d\n\n)\nselect\n    d.date_day,\n    {{ dbt_date.yesterday('d.date_day') }} as prior_date_day,\n    {{ dbt_date.tomorrow('d.date_day') }} as next_date_day,\n    d.prior_year_date_day as prior_year_date_day,\n    d.prior_year_over_year_date_day,\n    {{ dbt_date.day_of_week('d.date_day', isoweek=false) }} as day_of_week,\n    {{ dbt_date.day_of_week('d.date_day', isoweek=true) }} as day_of_week_iso,\n    {{ dbt_date.day_name('d.date_day', short=false) }} as day_of_week_name,\n    {{ dbt_date.day_name('d.date_day', short=true) }} as day_of_week_name_short,\n    {{ dbt_date.day_of_month('d.date_day') }} as day_of_month,\n    {{ dbt_date.day_of_year('d.date_day') }} as day_of_year,\n\n    {{ dbt_date.week_start('d.date_day') }} as week_start_date,\n    {{ dbt_date.week_end('d.date_day') }} as week_end_date,\n    {{ dbt_date.week_start('d.prior_year_over_year_date_day') }} as prior_year_week_start_date,\n    {{ dbt_date.week_end('d.prior_year_over_year_date_day') }} as prior_year_week_end_date,\n    {{ dbt_date.week_of_year('d.date_day') }} as week_of_year,\n\n    {{ dbt_date.iso_week_start('d.date_day') }} as iso_week_start_date,\n    {{ dbt_date.iso_week_end('d.date_day') }} as iso_week_end_date,\n    {{ dbt_date.iso_week_start('d.prior_year_over_year_date_day') }} as prior_year_iso_week_start_date,\n    {{ dbt_date.iso_week_end('d.prior_year_over_year_date_day') }} as prior_year_iso_week_end_date,\n    {{ dbt_date.iso_week_of_year('d.date_day') }} as iso_week_of_year,\n\n    {{ dbt_date.week_of_year('d.prior_year_over_year_date_day') }} as prior_year_week_of_year,\n    {{ dbt_date.iso_week_of_year('d.prior_year_over_year_date_day') }} as prior_year_iso_week_of_year,\n\n    cast({{ dbt_date.date_part('month', 'd.date_day') }} as {{ dbt.type_int() }}) as month_of_year,\n    {{ dbt_date.month_name('d.date_day', short=false) }}  as month_name,\n    {{ dbt_date.month_name('d.date_day', short=true) }}  as month_name_short,\n\n    cast({{ dbt.date_trunc('month', 'd.date_day') }} as date) as month_start_date,\n    cast({{ last_day('d.date_day', 'month') }} as date) as month_end_date,\n\n    cast({{ dbt.date_trunc('month', 'd.prior_year_date_day') }} as date) as prior_year_month_start_date,\n    cast({{ last_day('d.prior_year_date_day', 'month') }} as date) as prior_year_month_end_date,\n\n    cast({{ dbt_date.date_part('quarter', 'd.date_day') }} as {{ dbt.type_int() }}) as quarter_of_year,\n    cast({{ dbt.date_trunc('quarter', 'd.date_day') }} as date) as quarter_start_date,\n    cast({{ last_day('d.date_day', 'quarter') }} as date) as quarter_end_date,\n\n    cast({{ dbt_date.date_part('year', 'd.date_day') }} as {{ dbt.type_int() }}) as year_number,\n    cast({{ dbt.date_trunc('year', 'd.date_day') }} as date) as year_start_date,\n    cast({{ last_day('d.date_day', 'year') }} as date) as year_end_date\nfrom\n    dates_with_prior_year_dates d\norder by 1\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.get_base_dates", "macro.dbt.dateadd", "macro.dbt_date.yesterday", "macro.dbt_date.tomorrow", "macro.dbt_date.day_of_week", "macro.dbt_date.day_name", "macro.dbt_date.day_of_month", "macro.dbt_date.day_of_year", "macro.dbt_date.week_start", "macro.dbt_date.week_end", "macro.dbt_date.week_of_year", "macro.dbt_date.iso_week_start", "macro.dbt_date.iso_week_end", "macro.dbt_date.iso_week_of_year", "macro.dbt_date.date_part", "macro.dbt.type_int", "macro.dbt_date.month_name", "macro.dbt.date_trunc", "macro.dbt.last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.615345, "supported_languages": null}, "macro.dbt_date.postgres__get_date_dimension": {"name": "postgres__get_date_dimension", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_date_dimension.sql", "original_file_path": "macros/get_date_dimension.sql", "unique_id": "macro.dbt_date.postgres__get_date_dimension", "macro_sql": "{% macro postgres__get_date_dimension(start_date, end_date) %}\nwith base_dates as (\n    {{ dbt_date.get_base_dates(start_date, end_date) }}\n),\ndates_with_prior_year_dates as (\n\n    select\n        cast(d.date_day as date) as date_day,\n        cast({{ dbt.dateadd('year', -1 , 'd.date_day') }} as date) as prior_year_date_day,\n        cast({{ dbt.dateadd('day', -364 , 'd.date_day') }} as date) as prior_year_over_year_date_day\n    from\n    \tbase_dates d\n\n)\nselect\n    d.date_day,\n    {{ dbt_date.yesterday('d.date_day') }} as prior_date_day,\n    {{ dbt_date.tomorrow('d.date_day') }} as next_date_day,\n    d.prior_year_date_day as prior_year_date_day,\n    d.prior_year_over_year_date_day,\n    {{ dbt_date.day_of_week('d.date_day', isoweek=true) }} as day_of_week,\n\n    {{ dbt_date.day_name('d.date_day', short=false) }} as day_of_week_name,\n    {{ dbt_date.day_name('d.date_day', short=true) }} as day_of_week_name_short,\n    {{ dbt_date.day_of_month('d.date_day') }} as day_of_month,\n    {{ dbt_date.day_of_year('d.date_day') }} as day_of_year,\n\n    {{ dbt_date.week_start('d.date_day') }} as week_start_date,\n    {{ dbt_date.week_end('d.date_day') }} as week_end_date,\n    {{ dbt_date.week_start('d.prior_year_over_year_date_day') }} as prior_year_week_start_date,\n    {{ dbt_date.week_end('d.prior_year_over_year_date_day') }} as prior_year_week_end_date,\n    {{ dbt_date.week_of_year('d.date_day') }} as week_of_year,\n\n    {{ dbt_date.iso_week_start('d.date_day') }} as iso_week_start_date,\n    {{ dbt_date.iso_week_end('d.date_day') }} as iso_week_end_date,\n    {{ dbt_date.iso_week_start('d.prior_year_over_year_date_day') }} as prior_year_iso_week_start_date,\n    {{ dbt_date.iso_week_end('d.prior_year_over_year_date_day') }} as prior_year_iso_week_end_date,\n    {{ dbt_date.iso_week_of_year('d.date_day') }} as iso_week_of_year,\n\n    {{ dbt_date.week_of_year('d.prior_year_over_year_date_day') }} as prior_year_week_of_year,\n    {{ dbt_date.iso_week_of_year('d.prior_year_over_year_date_day') }} as prior_year_iso_week_of_year,\n\n    cast({{ dbt_date.date_part('month', 'd.date_day') }} as {{ dbt.type_int() }}) as month_of_year,\n    {{ dbt_date.month_name('d.date_day', short=false) }}  as month_name,\n    {{ dbt_date.month_name('d.date_day', short=true) }}  as month_name_short,\n\n    cast({{ dbt.date_trunc('month', 'd.date_day') }} as date) as month_start_date,\n    cast({{ last_day('d.date_day', 'month') }} as date) as month_end_date,\n\n    cast({{ dbt.date_trunc('month', 'd.prior_year_date_day') }} as date) as prior_year_month_start_date,\n    cast({{ last_day('d.prior_year_date_day', 'month') }} as date) as prior_year_month_end_date,\n\n    cast({{ dbt_date.date_part('quarter', 'd.date_day') }} as {{ dbt.type_int() }}) as quarter_of_year,\n    cast({{ dbt.date_trunc('quarter', 'd.date_day') }} as date) as quarter_start_date,\n    {# last_day does not support quarter because postgresql does not support quarter interval. #}\n    cast({{dbt.dateadd('day', '-1', dbt.dateadd('month', '3', dbt.date_trunc('quarter', 'd.date_day')))}} as date) as quarter_end_date,\n\n    cast({{ dbt_date.date_part('year', 'd.date_day') }} as {{ dbt.type_int() }}) as year_number,\n    cast({{ dbt.date_trunc('year', 'd.date_day') }} as date) as year_start_date,\n    cast({{ last_day('d.date_day', 'year') }} as date) as year_end_date\nfrom\n    dates_with_prior_year_dates d\norder by 1\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.get_base_dates", "macro.dbt.dateadd", "macro.dbt_date.yesterday", "macro.dbt_date.tomorrow", "macro.dbt_date.day_of_week", "macro.dbt_date.day_name", "macro.dbt_date.day_of_month", "macro.dbt_date.day_of_year", "macro.dbt_date.week_start", "macro.dbt_date.week_end", "macro.dbt_date.week_of_year", "macro.dbt_date.iso_week_start", "macro.dbt_date.iso_week_end", "macro.dbt_date.iso_week_of_year", "macro.dbt_date.date_part", "macro.dbt.type_int", "macro.dbt_date.month_name", "macro.dbt.date_trunc", "macro.dbt.last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.617701, "supported_languages": null}, "macro.dbt_date.get_base_dates": {"name": "get_base_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "unique_id": "macro.dbt_date.get_base_dates", "macro_sql": "{% macro get_base_dates(start_date=None, end_date=None, n_dateparts=None, datepart=\"day\") %}\n    {{ adapter.dispatch('get_base_dates', 'dbt_date') (start_date, end_date, n_dateparts, datepart) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.bigquery__get_base_dates"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.619353, "supported_languages": null}, "macro.dbt_date.default__get_base_dates": {"name": "default__get_base_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "unique_id": "macro.dbt_date.default__get_base_dates", "macro_sql": "{% macro default__get_base_dates(start_date, end_date, n_dateparts, datepart) %}\n\n{%- if start_date and end_date -%}\n{%- set start_date=\"cast('\" ~ start_date ~ \"' as \" ~ dbt.type_timestamp() ~ \")\" -%}\n{%- set end_date=\"cast('\" ~ end_date ~ \"' as \" ~ dbt.type_timestamp() ~ \")\"  -%}\n\n{%- elif n_dateparts and datepart -%}\n\n{%- set start_date = dbt.dateadd(datepart, -1 * n_dateparts, dbt_date.today()) -%}\n{%- set end_date = dbt_date.tomorrow() -%}\n{%- endif -%}\n\nwith date_spine as\n(\n\n    {{ dbt_date.date_spine(\n        datepart=datepart,\n        start_date=start_date,\n        end_date=end_date,\n       )\n    }}\n\n)\nselect\n    cast(d.date_{{ datepart }} as {{ dbt.type_timestamp() }}) as date_{{ datepart }}\nfrom\n    date_spine d\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp", "macro.dbt.dateadd", "macro.dbt_date.today", "macro.dbt_date.tomorrow", "macro.dbt_date.date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.620117, "supported_languages": null}, "macro.dbt_date.bigquery__get_base_dates": {"name": "bigquery__get_base_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "unique_id": "macro.dbt_date.bigquery__get_base_dates", "macro_sql": "{% macro bigquery__get_base_dates(start_date, end_date, n_dateparts, datepart) %}\n\n{%- if start_date and end_date -%}\n{%- set start_date=\"cast('\" ~ start_date ~ \"' as datetime )\" -%}\n{%- set end_date=\"cast('\" ~ end_date ~ \"' as datetime )\" -%}\n\n{%- elif n_dateparts and datepart -%}\n\n{%- set start_date = dbt.dateadd(datepart, -1 * n_dateparts, dbt_date.today()) -%}\n{%- set end_date = dbt_date.tomorrow() -%}\n{%- endif -%}\n\nwith date_spine as\n(\n\n    {{ dbt_date.date_spine(\n        datepart=datepart,\n        start_date=start_date,\n        end_date=end_date,\n       )\n    }}\n\n)\nselect\n    cast(d.date_{{ datepart }} as {{ dbt.type_timestamp() }}) as date_{{ datepart }}\nfrom\n    date_spine d\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt_date.today", "macro.dbt_date.tomorrow", "macro.dbt_date.date_spine", "macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.62081, "supported_languages": null}, "macro.dbt_date.trino__get_base_dates": {"name": "trino__get_base_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "unique_id": "macro.dbt_date.trino__get_base_dates", "macro_sql": "{% macro trino__get_base_dates(start_date, end_date, n_dateparts, datepart) %}\n\n{%- if start_date and end_date -%}\n{%- set start_date=\"cast('\" ~ start_date ~ \"' as \" ~ dbt.type_timestamp() ~ \")\" -%}\n{%- set end_date=\"cast('\" ~ end_date ~ \"' as \" ~ dbt.type_timestamp() ~ \")\"  -%}\n\n{%- elif n_dateparts and datepart -%}\n\n{%- set start_date = dbt.dateadd(datepart, -1 * n_dateparts, dbt_date.now()) -%}\n{%- set end_date = dbt_date.tomorrow() -%}\n{%- endif -%}\n\nwith date_spine as\n(\n\n    {{ dbt_date.date_spine(\n        datepart=datepart,\n        start_date=start_date,\n        end_date=end_date,\n       )\n    }}\n\n)\nselect\n    cast(d.date_{{ datepart }} as {{ dbt.type_timestamp() }}) as date_{{ datepart }}\nfrom\n    date_spine d\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp", "macro.dbt.dateadd", "macro.dbt_date.now", "macro.dbt_date.tomorrow", "macro.dbt_date.date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.621572, "supported_languages": null}, "macro.dbt_date.get_intervals_between": {"name": "get_intervals_between", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/date_spine.sql", "original_file_path": "macros/_utils/date_spine.sql", "unique_id": "macro.dbt_date.get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n    {{ return(adapter.dispatch('get_intervals_between', 'dbt_date')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.622293, "supported_languages": null}, "macro.dbt_date.default__get_intervals_between": {"name": "default__get_intervals_between", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/date_spine.sql", "original_file_path": "macros/_utils/date_spine.sql", "unique_id": "macro.dbt_date.default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n    {%- call statement('get_intervals_between', fetch_result=True) %}\n\n        select {{ dbt.datediff(start_date, end_date, datepart) }}\n\n    {%- endcall -%}\n\n    {%- set value_list = load_result('get_intervals_between') -%}\n\n    {%- if value_list and value_list['data'] -%}\n        {%- set values = value_list['data'] | map(attribute=0) | list %}\n        {{ return(values[0]) }}\n    {%- else -%}\n        {{ return(1) }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.622889, "supported_languages": null}, "macro.dbt_date.date_spine": {"name": "date_spine", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/date_spine.sql", "original_file_path": "macros/_utils/date_spine.sql", "unique_id": "macro.dbt_date.date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n    {{ return(adapter.dispatch('date_spine', 'dbt_date')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.623122, "supported_languages": null}, "macro.dbt_date.default__date_spine": {"name": "default__date_spine", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/date_spine.sql", "original_file_path": "macros/_utils/date_spine.sql", "unique_id": "macro.dbt_date.default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n{# call as follows:\n\ndate_spine(\n    \"day\",\n    \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n    \"dbt.dateadd(week, 1, current_date)\"\n) #}\n\n\nwith rawdata as (\n\n    {{\n        dbt_date.generate_series(\n            dbt_date.get_intervals_between(start_date, end_date, datepart)\n        )\n    }}\n\n),\n\nall_periods as (\n\n    select (\n        {{\n            dbt.dateadd(\n                datepart,\n                \"(row_number() over (order by 1) - 1)\",\n                start_date\n            )\n        }}\n    ) as date_{{datepart}}\n    from rawdata\n\n),\n\nfiltered as (\n\n    select *\n    from all_periods\n    where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.generate_series", "macro.dbt_date.get_intervals_between", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.623497, "supported_languages": null}, "macro.dbt_date.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/generate_series.sql", "original_file_path": "macros/_utils/generate_series.sql", "unique_id": "macro.dbt_date.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n    {{ return(adapter.dispatch('get_powers_of_two', 'dbt_date')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.624335, "supported_languages": null}, "macro.dbt_date.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/generate_series.sql", "original_file_path": "macros/_utils/generate_series.sql", "unique_id": "macro.dbt_date.default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n    {% if upper_bound <= 0 %}\n    {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n    {% endif %}\n\n    {% for _ in range(1, 100) %}\n       {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n    {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6247559, "supported_languages": null}, "macro.dbt_date.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/generate_series.sql", "original_file_path": "macros/_utils/generate_series.sql", "unique_id": "macro.dbt_date.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n    {{ return(adapter.dispatch('generate_series', 'dbt_date')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.62495, "supported_languages": null}, "macro.dbt_date.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/generate_series.sql", "original_file_path": "macros/_utils/generate_series.sql", "unique_id": "macro.dbt_date.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n    {% set n = dbt_date.get_powers_of_two(upper_bound) %}\n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    {% for i in range(n) %}\n    p{{i}}.generated_number * power(2, {{i}})\n    {% if not loop.last %} + {% endif %}\n    {% endfor %}\n    + 1\n    as generated_number\n\n    from\n\n    {% for i in range(n) %}\n    p as p{{i}}\n    {% if not loop.last %} cross join {% endif %}\n    {% endfor %}\n\n    )\n\n    select *\n    from unioned\n    where generated_number <= {{upper_bound}}\n    order by generated_number\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6254878, "supported_languages": null}, "macro.dbt_date.date": {"name": "date", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/modules_datetime.sql", "original_file_path": "macros/_utils/modules_datetime.sql", "unique_id": "macro.dbt_date.date", "macro_sql": "{% macro date(year, month, day) %}\n    {{ return(modules.datetime.date(year, month, day)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.62583, "supported_languages": null}, "macro.dbt_date.datetime": {"name": "datetime", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/_utils/modules_datetime.sql", "original_file_path": "macros/_utils/modules_datetime.sql", "unique_id": "macro.dbt_date.datetime", "macro_sql": "{% macro datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tz=None) %}\n    {% set tz = tz if tz else var(\"dbt_date:time_zone\") %}\n    {{ return(\n        modules.datetime.datetime(\n            year=year, month=month, day=day, hour=hour,\n            minute=minute, second=second, microsecond=microsecond,\n            tzinfo=modules.pytz.timezone(tz)\n        )\n    ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.626389, "supported_languages": null}, "macro.dbt_date.get_fiscal_year_dates": {"name": "get_fiscal_year_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/fiscal_date/get_fiscal_year_dates.sql", "original_file_path": "macros/fiscal_date/get_fiscal_year_dates.sql", "unique_id": "macro.dbt_date.get_fiscal_year_dates", "macro_sql": "{% macro get_fiscal_year_dates(dates, year_end_month=12, week_start_day=1, shift_year=1) %}\n{{ adapter.dispatch('get_fiscal_year_dates', 'dbt_date') (dates, year_end_month, week_start_day, shift_year) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__get_fiscal_year_dates"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.628234, "supported_languages": null}, "macro.dbt_date.default__get_fiscal_year_dates": {"name": "default__get_fiscal_year_dates", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/fiscal_date/get_fiscal_year_dates.sql", "original_file_path": "macros/fiscal_date/get_fiscal_year_dates.sql", "unique_id": "macro.dbt_date.default__get_fiscal_year_dates", "macro_sql": "{% macro default__get_fiscal_year_dates(dates, year_end_month, week_start_day, shift_year) %}\n-- this gets all the dates within a fiscal year\n-- determined by the given year-end-month\n-- ending on the saturday closest to that month's end date\nwith fsc_date_dimension as (\n    select * from {{ dates }}\n),\nyear_month_end as (\n\n    select\n       d.year_number - {{ shift_year }} as fiscal_year_number,\n       d.month_end_date\n    from\n        fsc_date_dimension d\n    where\n        d.month_of_year = {{ year_end_month }}\n    group by 1,2\n\n),\nweeks as (\n\n    select\n        d.year_number,\n        d.month_of_year,\n        d.date_day as week_start_date,\n        cast({{ dbt.dateadd('day', 6, 'd.date_day') }} as date) as week_end_date\n    from\n        fsc_date_dimension d\n    where\n        d.day_of_week = {{ week_start_day }}\n\n),\n-- get all the weeks that start in the month the year ends\nyear_week_ends as (\n\n    select\n        d.year_number - {{ shift_year }} as fiscal_year_number,\n        d.week_end_date\n    from\n        weeks d\n    where\n        d.month_of_year = {{ year_end_month }}\n    group by\n        1,2\n\n),\n-- then calculate which Saturday is closest to month end\nweeks_at_month_end as (\n\n    select\n        d.fiscal_year_number,\n        d.week_end_date,\n        m.month_end_date,\n        rank() over\n            (partition by d.fiscal_year_number\n                order by\n                abs({{ dbt.datediff('d.week_end_date', 'm.month_end_date', 'day') }})\n\n            ) as closest_to_month_end\n    from\n        year_week_ends d\n        join\n        year_month_end m on d.fiscal_year_number = m.fiscal_year_number\n),\nfiscal_year_range as (\n\n    select\n        w.fiscal_year_number,\n        cast(\n            {{ dbt.dateadd('day', 1,\n            'lag(w.week_end_date) over(order by w.week_end_date)') }}\n            as date) as fiscal_year_start_date,\n        w.week_end_date as fiscal_year_end_date\n    from\n        weeks_at_month_end w\n    where\n        w.closest_to_month_end = 1\n\n),\nfiscal_year_dates as (\n\n    select\n        d.date_day,\n        m.fiscal_year_number,\n        m.fiscal_year_start_date,\n        m.fiscal_year_end_date,\n        w.week_start_date,\n        w.week_end_date,\n        -- we reset the weeks of the year starting with the merch year start date\n        dense_rank()\n            over(\n                partition by m.fiscal_year_number\n                order by w.week_start_date\n                ) as fiscal_week_of_year\n    from\n        fsc_date_dimension d\n        join\n        fiscal_year_range m on d.date_day between m.fiscal_year_start_date and m.fiscal_year_end_date\n        join\n        weeks w on d.date_day between w.week_start_date and w.week_end_date\n\n)\nselect * from fiscal_year_dates order by 1\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.62884, "supported_languages": null}, "macro.dbt_date.get_fiscal_periods": {"name": "get_fiscal_periods", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/fiscal_date/get_fiscal_periods.sql", "original_file_path": "macros/fiscal_date/get_fiscal_periods.sql", "unique_id": "macro.dbt_date.get_fiscal_periods", "macro_sql": "{% macro get_fiscal_periods(dates, year_end_month, week_start_day, shift_year=1) %}\n{#\nThis macro requires you to pass in a ref to a date dimension, created via\ndbt_date.get_date_dimension()s\n#}\nwith fscl_year_dates_for_periods as (\n    {{ dbt_date.get_fiscal_year_dates(dates, year_end_month, week_start_day, shift_year) }}\n),\nfscl_year_w13 as (\n\n    select\n        f.*,\n        -- We count the weeks in a 13 week period\n        -- and separate the 4-5-4 week sequences\n        mod(cast(\n            (f.fiscal_week_of_year-1) as {{ dbt.type_int() }}\n            ), 13) as w13_number,\n        -- Chop weeks into 13 week merch quarters\n        cast(\n            least(\n                floor((f.fiscal_week_of_year-1)/13.0)\n                , 3)\n            as {{ dbt.type_int() }}) as quarter_number\n    from\n        fscl_year_dates_for_periods f\n\n),\nfscl_periods as (\n\n    select\n        f.date_day,\n        f.fiscal_year_number,\n        f.week_start_date,\n        f.week_end_date,\n        f.fiscal_week_of_year,\n        case\n            -- we move week 53 into the 3rd period of the quarter\n            when f.fiscal_week_of_year = 53 then 3\n            when f.w13_number between 0 and 3 then 1\n            when f.w13_number between 4 and 8 then 2\n            when f.w13_number between 9 and 12 then 3\n        end as period_of_quarter,\n        f.quarter_number\n    from\n        fscl_year_w13 f\n\n),\nfscl_periods_quarters as (\n\n    select\n        f.*,\n        cast((\n            (f.quarter_number * 3) + f.period_of_quarter\n         ) as {{ dbt.type_int() }}) as fiscal_period_number\n    from\n        fscl_periods f\n\n)\nselect\n    date_day,\n    fiscal_year_number,\n    week_start_date,\n    week_end_date,\n    fiscal_week_of_year,\n    dense_rank() over(partition by fiscal_period_number order by fiscal_week_of_year) as fiscal_week_of_period,\n    fiscal_period_number,\n    quarter_number+1 as fiscal_quarter_number,\n    period_of_quarter as fiscal_period_of_quarter\nfrom\n    fscl_periods_quarters\norder by 1,2\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_date.get_fiscal_year_dates", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.629817, "supported_languages": null}, "macro.dbt_date.tomorrow": {"name": "tomorrow", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/tomorrow.sql", "original_file_path": "macros/calendar_date/tomorrow.sql", "unique_id": "macro.dbt_date.tomorrow", "macro_sql": "{%- macro tomorrow(date=None, tz=None) -%}\n{{ dbt_date.n_days_away(1, date, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.630038, "supported_languages": null}, "macro.dbt_date.next_week": {"name": "next_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/next_week.sql", "original_file_path": "macros/calendar_date/next_week.sql", "unique_id": "macro.dbt_date.next_week", "macro_sql": "{%- macro next_week(tz=None) -%}\n{{ dbt_date.n_weeks_away(1, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_weeks_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.63022, "supported_languages": null}, "macro.dbt_date.next_month_name": {"name": "next_month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/next_month_name.sql", "original_file_path": "macros/calendar_date/next_month_name.sql", "unique_id": "macro.dbt_date.next_month_name", "macro_sql": "{%- macro next_month_name(short=True, tz=None) -%}\n{{ dbt_date.month_name(dbt_date.next_month(tz), short=short) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.month_name", "macro.dbt_date.next_month"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.630529, "supported_languages": null}, "macro.dbt_date.next_month": {"name": "next_month", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/next_month.sql", "original_file_path": "macros/calendar_date/next_month.sql", "unique_id": "macro.dbt_date.next_month", "macro_sql": "{%- macro next_month(tz=None) -%}\n{{ dbt_date.n_months_away(1, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_months_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.630713, "supported_languages": null}, "macro.dbt_date.day_name": {"name": "day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.day_name", "macro_sql": "{%- macro day_name(date, short=True) -%}\n    {{ adapter.dispatch('day_name', 'dbt_date') (date, short) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.bigquery__day_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.631552, "supported_languages": null}, "macro.dbt_date.default__day_name": {"name": "default__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.default__day_name", "macro_sql": "\n\n{%- macro default__day_name(date, short) -%}\n{%- set f = 'Dy' if short else 'Day' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.631755, "supported_languages": null}, "macro.dbt_date.snowflake__day_name": {"name": "snowflake__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.snowflake__day_name", "macro_sql": "\n\n{%- macro snowflake__day_name(date, short) -%}\n    {%- if short -%}\n    dayname({{ date }})\n    {%- else -%}\n    -- long version not implemented on Snowflake so we're doing it manually :/\n    case dayname({{ date }})\n        when 'Mon' then 'Monday'\n        when 'Tue' then 'Tuesday'\n        when 'Wed' then 'Wednesday'\n        when 'Thu' then 'Thursday'\n        when 'Fri' then 'Friday'\n        when 'Sat' then 'Saturday'\n        when 'Sun' then 'Sunday'\n    end\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.631964, "supported_languages": null}, "macro.dbt_date.bigquery__day_name": {"name": "bigquery__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.bigquery__day_name", "macro_sql": "\n\n{%- macro bigquery__day_name(date, short) -%}\n{%- set f = '%a' if short else '%A' -%}\n    format_date('{{ f }}', cast({{ date }} as date))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.632169, "supported_languages": null}, "macro.dbt_date.postgres__day_name": {"name": "postgres__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.postgres__day_name", "macro_sql": "\n\n{%- macro postgres__day_name(date, short) -%}\n{# FM = Fill mode, which suppresses padding blanks #}\n{%- set f = 'FMDy' if short else 'FMDay' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.632376, "supported_languages": null}, "macro.dbt_date.duckdb__day_name": {"name": "duckdb__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.duckdb__day_name", "macro_sql": "\n\n{%- macro duckdb__day_name(date, short) -%}\n    {%- if short -%}\n    substr(dayname({{ date }}), 1, 3)\n    {%- else -%}\n    dayname({{ date }})\n    {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.632569, "supported_languages": null}, "macro.dbt_date.spark__day_name": {"name": "spark__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.spark__day_name", "macro_sql": "\n\n{%- macro spark__day_name(date, short) -%}\n{%- set f = 'E' if short else 'EEEE' -%}\n    date_format({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.632771, "supported_languages": null}, "macro.dbt_date.trino__day_name": {"name": "trino__day_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "unique_id": "macro.dbt_date.trino__day_name", "macro_sql": "\n\n{%- macro trino__day_name(date, short) -%}\n{%- set f = 'a' if short else 'W' -%}\n    date_format({{ date }}, '%{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6329951, "supported_languages": null}, "macro.dbt_date.to_unixtimestamp": {"name": "to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.to_unixtimestamp", "macro_sql": "{%- macro to_unixtimestamp(timestamp) -%}\n    {{ adapter.dispatch('to_unixtimestamp', 'dbt_date') (timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.bigquery__to_unixtimestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.633406, "supported_languages": null}, "macro.dbt_date.default__to_unixtimestamp": {"name": "default__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.default__to_unixtimestamp", "macro_sql": "\n\n{%- macro default__to_unixtimestamp(timestamp) -%}\n    {{ dbt_date.date_part('epoch', timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6335502, "supported_languages": null}, "macro.dbt_date.snowflake__to_unixtimestamp": {"name": "snowflake__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.snowflake__to_unixtimestamp", "macro_sql": "\n\n{%- macro snowflake__to_unixtimestamp(timestamp) -%}\n    {{ dbt_date.date_part('epoch_seconds', timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6336908, "supported_languages": null}, "macro.dbt_date.bigquery__to_unixtimestamp": {"name": "bigquery__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.bigquery__to_unixtimestamp", "macro_sql": "\n\n{%- macro bigquery__to_unixtimestamp(timestamp) -%}\n    unix_seconds({{ timestamp }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.633794, "supported_languages": null}, "macro.dbt_date.spark__to_unixtimestamp": {"name": "spark__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.spark__to_unixtimestamp", "macro_sql": "\n\n{%- macro spark__to_unixtimestamp(timestamp) -%}\n    unix_timestamp({{ timestamp }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.633894, "supported_languages": null}, "macro.dbt_date.trino__to_unixtimestamp": {"name": "trino__to_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "unique_id": "macro.dbt_date.trino__to_unixtimestamp", "macro_sql": "\n\n{%- macro trino__to_unixtimestamp(timestamp) -%}\n    to_unixtime({{ timestamp }} AT TIME ZONE 'UTC')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.633997, "supported_languages": null}, "macro.dbt_date.n_days_away": {"name": "n_days_away", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_days_away.sql", "original_file_path": "macros/calendar_date/n_days_away.sql", "unique_id": "macro.dbt_date.n_days_away", "macro_sql": "{%- macro n_days_away(n, date=None, tz=None) -%}\n{{ dbt_date.n_days_ago(-1 * n, date, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_days_ago"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.634239, "supported_languages": null}, "macro.dbt_date.week_start": {"name": "week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.week_start", "macro_sql": "{%- macro week_start(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('week_start', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.634741, "supported_languages": null}, "macro.dbt_date.default__week_start": {"name": "default__week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.default__week_start", "macro_sql": "{%- macro default__week_start(date) -%}\ncast({{ dbt.date_trunc('week', date) }} as date)\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.634891, "supported_languages": null}, "macro.dbt_date.snowflake__week_start": {"name": "snowflake__week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.snowflake__week_start", "macro_sql": "\n\n{%- macro snowflake__week_start(date) -%}\n    {#\n        Get the day of week offset: e.g. if the date is a Sunday,\n        dbt_date.day_of_week returns 1, so we subtract 1 to get a 0 offset\n    #}\n    {% set off_set = dbt_date.day_of_week(date, isoweek=False) ~ \" - 1\" %}\n    cast({{ dbt.dateadd(\"day\", \"-1 * (\" ~ off_set ~ \")\", date) }} as date)\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.day_of_week", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.635256, "supported_languages": null}, "macro.dbt_date.postgres__week_start": {"name": "postgres__week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.postgres__week_start", "macro_sql": "\n\n{%- macro postgres__week_start(date) -%}\n-- Sunday as week start date\ncast({{ dbt.dateadd('day', -1, dbt.date_trunc('week', dbt.dateadd('day', 1, date))) }} as date)\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6355252, "supported_languages": null}, "macro.dbt_date.duckdb__week_start": {"name": "duckdb__week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "unique_id": "macro.dbt_date.duckdb__week_start", "macro_sql": "\n\n{%- macro duckdb__week_start(date) -%}\n{{ return(dbt_date.postgres__week_start(date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.635675, "supported_languages": null}, "macro.dbt_date.iso_week_start": {"name": "iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.iso_week_start", "macro_sql": "{%- macro iso_week_start(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('iso_week_start', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.636336, "supported_languages": null}, "macro.dbt_date._iso_week_start": {"name": "_iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date._iso_week_start", "macro_sql": "{%- macro _iso_week_start(date, week_type) -%}\ncast({{ dbt.date_trunc(week_type, date) }} as date)\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.636495, "supported_languages": null}, "macro.dbt_date.default__iso_week_start": {"name": "default__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.default__iso_week_start", "macro_sql": "\n\n{%- macro default__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'isoweek') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.636638, "supported_languages": null}, "macro.dbt_date.snowflake__iso_week_start": {"name": "snowflake__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.snowflake__iso_week_start", "macro_sql": "\n\n{%- macro snowflake__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.636776, "supported_languages": null}, "macro.dbt_date.postgres__iso_week_start": {"name": "postgres__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.postgres__iso_week_start", "macro_sql": "\n\n{%- macro postgres__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.636916, "supported_languages": null}, "macro.dbt_date.duckdb__iso_week_start": {"name": "duckdb__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.duckdb__iso_week_start", "macro_sql": "\n\n{%- macro duckdb__iso_week_start(date) -%}\n{{ return(dbt_date.postgres__iso_week_start(date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.637063, "supported_languages": null}, "macro.dbt_date.spark__iso_week_start": {"name": "spark__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.spark__iso_week_start", "macro_sql": "\n\n{%- macro spark__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.637205, "supported_languages": null}, "macro.dbt_date.trino__iso_week_start": {"name": "trino__iso_week_start", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "unique_id": "macro.dbt_date.trino__iso_week_start", "macro_sql": "\n\n{%- macro trino__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.637345, "supported_languages": null}, "macro.dbt_date.n_days_ago": {"name": "n_days_ago", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_days_ago.sql", "original_file_path": "macros/calendar_date/n_days_ago.sql", "unique_id": "macro.dbt_date.n_days_ago", "macro_sql": "{%- macro n_days_ago(n, date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{%- set n = n|int -%}\ncast({{ dbt.dateadd('day', -1 * n, dt) }} as date)\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.637755, "supported_languages": null}, "macro.dbt_date.last_week": {"name": "last_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/last_week.sql", "original_file_path": "macros/calendar_date/last_week.sql", "unique_id": "macro.dbt_date.last_week", "macro_sql": "{%- macro last_week(tz=None) -%}\n{{ dbt_date.n_weeks_ago(1, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_weeks_ago"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.63794, "supported_languages": null}, "macro.dbt_date.now": {"name": "now", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/now.sql", "original_file_path": "macros/calendar_date/now.sql", "unique_id": "macro.dbt_date.now", "macro_sql": "{%- macro now(tz=None) -%}\n{{ dbt_date.convert_timezone(dbt.current_timestamp(), tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.convert_timezone", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.638141, "supported_languages": null}, "macro.dbt_date.periods_since": {"name": "periods_since", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/periods_since.sql", "original_file_path": "macros/calendar_date/periods_since.sql", "unique_id": "macro.dbt_date.periods_since", "macro_sql": "{%- macro periods_since(date_col, period_name='day', tz=None) -%}\n{{ dbt.datediff(date_col, dbt_date.now(tz), period_name) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt_date.now"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.638399, "supported_languages": null}, "macro.dbt_date.today": {"name": "today", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/today.sql", "original_file_path": "macros/calendar_date/today.sql", "unique_id": "macro.dbt_date.today", "macro_sql": "{%- macro today(tz=None) -%}\ncast({{ dbt_date.now(tz) }} as date)\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.now"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.638576, "supported_languages": null}, "macro.dbt_date.last_month": {"name": "last_month", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/last_month.sql", "original_file_path": "macros/calendar_date/last_month.sql", "unique_id": "macro.dbt_date.last_month", "macro_sql": "{%- macro last_month(tz=None) -%}\n{{ dbt_date.n_months_ago(1, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_months_ago"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.638756, "supported_languages": null}, "macro.dbt_date.day_of_year": {"name": "day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.day_of_year", "macro_sql": "{%- macro day_of_year(date) -%}\n{{ adapter.dispatch('day_of_year', 'dbt_date') (date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.default__day_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.639168, "supported_languages": null}, "macro.dbt_date.default__day_of_year": {"name": "default__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.default__day_of_year", "macro_sql": "\n\n{%- macro default__day_of_year(date) -%}\n    {{ dbt_date.date_part('dayofyear', date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.639313, "supported_languages": null}, "macro.dbt_date.postgres__day_of_year": {"name": "postgres__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.postgres__day_of_year", "macro_sql": "\n\n{%- macro postgres__day_of_year(date) -%}\n    {{ dbt_date.date_part('doy', date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.63946, "supported_languages": null}, "macro.dbt_date.redshift__day_of_year": {"name": "redshift__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.redshift__day_of_year", "macro_sql": "\n\n{%- macro redshift__day_of_year(date) -%}\n    cast({{ dbt_date.date_part('dayofyear', date) }} as {{ dbt.type_bigint() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.639644, "supported_languages": null}, "macro.dbt_date.spark__day_of_year": {"name": "spark__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.spark__day_of_year", "macro_sql": "\n\n{%- macro spark__day_of_year(date) -%}\n    dayofyear({{ date }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.639817, "supported_languages": null}, "macro.dbt_date.trino__day_of_year": {"name": "trino__day_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "unique_id": "macro.dbt_date.trino__day_of_year", "macro_sql": "\n\n{%- macro trino__day_of_year(date) -%}\n    {{ dbt_date.date_part('day_of_year', date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.639957, "supported_languages": null}, "macro.dbt_date.round_timestamp": {"name": "round_timestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/round_timestamp.sql", "original_file_path": "macros/calendar_date/round_timestamp.sql", "unique_id": "macro.dbt_date.round_timestamp", "macro_sql": "{% macro round_timestamp(timestamp) %}\n    {{ dbt.date_trunc(\"day\", dbt.dateadd(\"hour\", 12, timestamp)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6402, "supported_languages": null}, "macro.dbt_date.from_unixtimestamp": {"name": "from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.from_unixtimestamp", "macro_sql": "{%- macro from_unixtimestamp(epochs, format=\"seconds\") -%}\n    {{ adapter.dispatch('from_unixtimestamp', 'dbt_date') (epochs, format) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.bigquery__from_unixtimestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6423838, "supported_languages": null}, "macro.dbt_date.default__from_unixtimestamp": {"name": "default__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.default__from_unixtimestamp", "macro_sql": "\n\n{%- macro default__from_unixtimestamp(epochs, format=\"seconds\") -%}\n    {%- if format != \"seconds\" -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n    to_timestamp({{ epochs }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6426492, "supported_languages": null}, "macro.dbt_date.postgres__from_unixtimestamp": {"name": "postgres__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.postgres__from_unixtimestamp", "macro_sql": "\n\n{%- macro postgres__from_unixtimestamp(epochs, format=\"seconds\") -%}\n    {%- if format != \"seconds\" -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n    cast(to_timestamp({{ epochs }}) at time zone 'UTC' as timestamp)\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6429172, "supported_languages": null}, "macro.dbt_date.snowflake__from_unixtimestamp": {"name": "snowflake__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.snowflake__from_unixtimestamp", "macro_sql": "\n\n{%- macro snowflake__from_unixtimestamp(epochs, format) -%}\n    {%- if format == \"seconds\" -%}\n    {%- set scale = 0 -%}\n    {%- elif format == \"milliseconds\" -%}\n    {%- set scale = 3 -%}\n    {%- elif format == \"microseconds\" -%}\n    {%- set scale = 6 -%}\n    {%- else -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n    to_timestamp_ntz({{ epochs }}, {{ scale }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.64339, "supported_languages": null}, "macro.dbt_date.bigquery__from_unixtimestamp": {"name": "bigquery__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.bigquery__from_unixtimestamp", "macro_sql": "\n\n{%- macro bigquery__from_unixtimestamp(epochs, format) -%}\n    {%- if format == \"seconds\" -%}\n        timestamp_seconds({{ epochs }})\n    {%- elif format == \"milliseconds\" -%}\n        timestamp_millis({{ epochs }})\n    {%- elif format == \"microseconds\" -%}\n        timestamp_micros({{ epochs }})\n    {%- else -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.643786, "supported_languages": null}, "macro.dbt_date.trino__from_unixtimestamp": {"name": "trino__from_unixtimestamp", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "unique_id": "macro.dbt_date.trino__from_unixtimestamp", "macro_sql": "\n\n{%- macro trino__from_unixtimestamp(epochs, format) -%}\n    {%- if format == \"seconds\" -%}\n        cast(from_unixtime({{ epochs }}) AT TIME ZONE 'UTC' as {{ dbt.type_timestamp() }})\n    {%- elif format == \"milliseconds\" -%}\n        cast(from_unixtime_nanos({{ epochs }} * pow(10, 6)) AT TIME ZONE 'UTC' as {{ dbt.type_timestamp() }})\n    {%- elif format == \"microseconds\" -%}\n        cast(from_unixtime_nanos({{ epochs }} * pow(10, 3)) AT TIME ZONE 'UTC' as {{ dbt.type_timestamp() }})\n    {%- elif format == \"nanoseconds\" -%}\n        cast(from_unixtime_nanos({{ epochs }}) AT TIME ZONE 'UTC' as {{ dbt.type_timestamp() }})\n    {%- else -%}\n    {{ exceptions.raise_compiler_error(\n        \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n        )\n    }}\n    {% endif -%}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.644404, "supported_languages": null}, "macro.dbt_date.n_months_ago": {"name": "n_months_ago", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_months_ago.sql", "original_file_path": "macros/calendar_date/n_months_ago.sql", "unique_id": "macro.dbt_date.n_months_ago", "macro_sql": "{%- macro n_months_ago(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt.date_trunc('month',\n    dbt.dateadd('month', -1 * n,\n        dbt_date.today(tz)\n        )\n    ) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.644779, "supported_languages": null}, "macro.dbt_date.date_part": {"name": "date_part", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "unique_id": "macro.dbt_date.date_part", "macro_sql": "{% macro date_part(datepart, date) -%}\n    {{ adapter.dispatch('date_part', 'dbt_date') (datepart, date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.bigquery__date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.645128, "supported_languages": null}, "macro.dbt_date.default__date_part": {"name": "default__date_part", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "unique_id": "macro.dbt_date.default__date_part", "macro_sql": "{% macro default__date_part(datepart, date) -%}\n    date_part('{{ datepart }}', {{  date }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.64527, "supported_languages": null}, "macro.dbt_date.bigquery__date_part": {"name": "bigquery__date_part", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "unique_id": "macro.dbt_date.bigquery__date_part", "macro_sql": "{% macro bigquery__date_part(datepart, date) -%}\n    extract({{ datepart }} from {{ date }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6454, "supported_languages": null}, "macro.dbt_date.trino__date_part": {"name": "trino__date_part", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "unique_id": "macro.dbt_date.trino__date_part", "macro_sql": "{% macro trino__date_part(datepart, date) -%}\n    extract({{ datepart }} from {{ date }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.645534, "supported_languages": null}, "macro.dbt_date.n_weeks_away": {"name": "n_weeks_away", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_weeks_away.sql", "original_file_path": "macros/calendar_date/n_weeks_away.sql", "unique_id": "macro.dbt_date.n_weeks_away", "macro_sql": "{%- macro n_weeks_away(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt.date_trunc('week',\n    dbt.dateadd('week', n,\n        dbt_date.today(tz)\n        )\n    ) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.645885, "supported_languages": null}, "macro.dbt_date.day_of_month": {"name": "day_of_month", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_month.sql", "original_file_path": "macros/calendar_date/day_of_month.sql", "unique_id": "macro.dbt_date.day_of_month", "macro_sql": "{%- macro day_of_month(date) -%}\n{{ dbt_date.date_part('day', date) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.646098, "supported_languages": null}, "macro.dbt_date.redshift__day_of_month": {"name": "redshift__day_of_month", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_month.sql", "original_file_path": "macros/calendar_date/day_of_month.sql", "unique_id": "macro.dbt_date.redshift__day_of_month", "macro_sql": "\n\n{%- macro redshift__day_of_month(date) -%}\ncast({{ dbt_date.date_part('day', date) }} as {{ dbt.type_bigint() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.646281, "supported_languages": null}, "macro.dbt_date.yesterday": {"name": "yesterday", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/yesterday.sql", "original_file_path": "macros/calendar_date/yesterday.sql", "unique_id": "macro.dbt_date.yesterday", "macro_sql": "{%- macro yesterday(date=None, tz=None) -%}\n{{ dbt_date.n_days_ago(1, date, tz) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.n_days_ago"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.646496, "supported_languages": null}, "macro.dbt_date.day_of_week": {"name": "day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.day_of_week", "macro_sql": "{%- macro day_of_week(date, isoweek=true) -%}\n{{ adapter.dispatch('day_of_week', 'dbt_date') (date, isoweek) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.bigquery__day_of_week"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.649248, "supported_languages": null}, "macro.dbt_date.default__day_of_week": {"name": "default__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.default__day_of_week", "macro_sql": "\n\n{%- macro default__day_of_week(date, isoweek) -%}\n\n    {%- set dow = dbt_date.date_part('dayofweek', date) -%}\n\n    {%- if isoweek -%}\n    case\n        -- Shift start of week from Sunday (0) to Monday (1)\n        when {{ dow }} = 0 then 7\n        else {{ dow }}\n    end\n    {%- else -%}\n    {{ dow }} + 1\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.649604, "supported_languages": null}, "macro.dbt_date.snowflake__day_of_week": {"name": "snowflake__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.snowflake__day_of_week", "macro_sql": "\n\n{%- macro snowflake__day_of_week(date, isoweek) -%}\n\n    {%- if isoweek -%}\n        {%- set dow_part = 'dayofweekiso' -%}\n        {{ dbt_date.date_part(dow_part, date) }}\n    {%- else -%}\n        {%- set dow_part = 'dayofweek' -%}\n        case\n            when {{ dbt_date.date_part(dow_part, date) }} = 7 then 1\n            else {{ dbt_date.date_part(dow_part, date) }} + 1\n        end\n    {%- endif -%}\n\n\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6500149, "supported_languages": null}, "macro.dbt_date.bigquery__day_of_week": {"name": "bigquery__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.bigquery__day_of_week", "macro_sql": "\n\n{%- macro bigquery__day_of_week(date, isoweek) -%}\n\n    {%- set dow = dbt_date.date_part('dayofweek', date) -%}\n\n    {%- if isoweek -%}\n    case\n        -- Shift start of week from Sunday (1) to Monday (2)\n        when {{ dow }} = 1 then 7\n        else {{ dow }} - 1\n    end\n    {%- else -%}\n    {{ dow }}\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.650306, "supported_languages": null}, "macro.dbt_date.postgres__day_of_week": {"name": "postgres__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.postgres__day_of_week", "macro_sql": "\n\n\n{%- macro postgres__day_of_week(date, isoweek) -%}\n\n    {%- if isoweek -%}\n        {%- set dow_part = 'isodow' -%}\n        -- Monday(1) to Sunday (7)\n        cast({{ dbt_date.date_part(dow_part, date) }} as {{ dbt.type_int() }})\n    {%- else -%}\n        {%- set dow_part = 'dow' -%}\n        -- Sunday(1) to Saturday (7)\n        cast({{ dbt_date.date_part(dow_part, date) }} + 1 as {{ dbt.type_int() }})\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6507342, "supported_languages": null}, "macro.dbt_date.redshift__day_of_week": {"name": "redshift__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.redshift__day_of_week", "macro_sql": "\n\n\n{%- macro redshift__day_of_week(date, isoweek) -%}\n\n    {%- set dow = dbt_date.date_part('dayofweek', date) -%}\n\n    {%- if isoweek -%}\n    case\n        -- Shift start of week from Sunday (0) to Monday (1)\n        when {{ dow }} = 0 then 7\n        else cast({{ dow }} as {{ dbt.type_bigint() }})\n    end\n    {%- else -%}\n    cast({{ dow }} + 1 as {{ dbt.type_bigint() }})\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.65111, "supported_languages": null}, "macro.dbt_date.duckdb__day_of_week": {"name": "duckdb__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.duckdb__day_of_week", "macro_sql": "\n\n{%- macro duckdb__day_of_week(date, isoweek) -%}\n{{ return(dbt_date.postgres__day_of_week(date, isoweek)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__day_of_week"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.651289, "supported_languages": null}, "macro.dbt_date.spark__day_of_week": {"name": "spark__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.spark__day_of_week", "macro_sql": "\n\n\n{%- macro spark__day_of_week(date, isoweek) -%}\n\n    {%- set dow = \"dayofweek_iso\" if isoweek else \"dayofweek\" -%}\n\n    {{ dbt_date.date_part(dow, date) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.651504, "supported_languages": null}, "macro.dbt_date.trino__day_of_week": {"name": "trino__day_of_week", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "unique_id": "macro.dbt_date.trino__day_of_week", "macro_sql": "\n\n\n{%- macro trino__day_of_week(date, isoweek) -%}\n\n    {%- set dow = dbt_date.date_part('day_of_week', date) -%}\n\n    {%- if isoweek -%}\n        {{ dow }}\n    {%- else -%}\n        case\n            when {{ dow }} = 7 then 1\n            else {{ dow }} + 1\n        end\n    {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.651787, "supported_languages": null}, "macro.dbt_date.iso_week_end": {"name": "iso_week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "unique_id": "macro.dbt_date.iso_week_end", "macro_sql": "{%- macro iso_week_end(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('iso_week_end', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__iso_week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.652243, "supported_languages": null}, "macro.dbt_date._iso_week_end": {"name": "_iso_week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "unique_id": "macro.dbt_date._iso_week_end", "macro_sql": "{%- macro _iso_week_end(date, week_type) -%}\n{%- set dt = dbt_date.iso_week_start(date) -%}\n{{ dbt_date.n_days_away(6, dt) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.iso_week_start", "macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.652456, "supported_languages": null}, "macro.dbt_date.default__iso_week_end": {"name": "default__iso_week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "unique_id": "macro.dbt_date.default__iso_week_end", "macro_sql": "\n\n{%- macro default__iso_week_end(date) -%}\n{{ dbt_date._iso_week_end(date, 'isoweek') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.652601, "supported_languages": null}, "macro.dbt_date.snowflake__iso_week_end": {"name": "snowflake__iso_week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "unique_id": "macro.dbt_date.snowflake__iso_week_end", "macro_sql": "\n\n{%- macro snowflake__iso_week_end(date) -%}\n{{ dbt_date._iso_week_end(date, 'weekiso') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.652739, "supported_languages": null}, "macro.dbt_date.n_weeks_ago": {"name": "n_weeks_ago", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_weeks_ago.sql", "original_file_path": "macros/calendar_date/n_weeks_ago.sql", "unique_id": "macro.dbt_date.n_weeks_ago", "macro_sql": "{%- macro n_weeks_ago(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt.date_trunc('week',\n    dbt.dateadd('week', -1 * n,\n        dbt_date.today(tz)\n        )\n    ) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.653109, "supported_languages": null}, "macro.dbt_date.month_name": {"name": "month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.month_name", "macro_sql": "{%- macro month_name(date, short=True) -%}\n    {{ adapter.dispatch('month_name', 'dbt_date') (date, short) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.bigquery__month_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.653792, "supported_languages": null}, "macro.dbt_date.default__month_name": {"name": "default__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.default__month_name", "macro_sql": "\n\n{%- macro default__month_name(date, short) -%}\n{%- set f = 'MON' if short else 'MONTH' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.653995, "supported_languages": null}, "macro.dbt_date.bigquery__month_name": {"name": "bigquery__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.bigquery__month_name", "macro_sql": "\n\n{%- macro bigquery__month_name(date, short) -%}\n{%- set f = '%b' if short else '%B' -%}\n    format_date('{{ f }}', cast({{ date }} as date))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.654198, "supported_languages": null}, "macro.dbt_date.snowflake__month_name": {"name": "snowflake__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.snowflake__month_name", "macro_sql": "\n\n{%- macro snowflake__month_name(date, short) -%}\n{%- set f = 'MON' if short else 'MMMM' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.654397, "supported_languages": null}, "macro.dbt_date.postgres__month_name": {"name": "postgres__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.postgres__month_name", "macro_sql": "\n\n{%- macro postgres__month_name(date, short) -%}\n{# FM = Fill mode, which suppresses padding blanks #}\n{%- set f = 'FMMon' if short else 'FMMonth' -%}\n    to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.654606, "supported_languages": null}, "macro.dbt_date.duckdb__month_name": {"name": "duckdb__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.duckdb__month_name", "macro_sql": "\n\n\n{%- macro duckdb__month_name(date, short) -%}\n    {%- if short -%}\n    substr(monthname({{ date }}), 1, 3)\n    {%- else -%}\n    monthname({{ date }})\n    {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.654794, "supported_languages": null}, "macro.dbt_date.spark__month_name": {"name": "spark__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.spark__month_name", "macro_sql": "\n\n{%- macro spark__month_name(date, short) -%}\n{%- set f = 'LLL' if short else 'LLLL' -%}\n    date_format({{ date }}, '{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.654998, "supported_languages": null}, "macro.dbt_date.trino__month_name": {"name": "trino__month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "unique_id": "macro.dbt_date.trino__month_name", "macro_sql": "\n\n{%- macro trino__month_name(date, short) -%}\n{%- set f = 'b' if short else 'M' -%}\n    date_format({{ date }}, '%{{ f }}')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.655265, "supported_languages": null}, "macro.dbt_date.last_month_name": {"name": "last_month_name", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/last_month_name.sql", "original_file_path": "macros/calendar_date/last_month_name.sql", "unique_id": "macro.dbt_date.last_month_name", "macro_sql": "{%- macro last_month_name(short=True, tz=None) -%}\n{{ dbt_date.month_name(dbt_date.last_month(tz), short=short) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.month_name", "macro.dbt_date.last_month"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.655519, "supported_languages": null}, "macro.dbt_date.week_of_year": {"name": "week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "unique_id": "macro.dbt_date.week_of_year", "macro_sql": "{%- macro week_of_year(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('week_of_year', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.655971, "supported_languages": null}, "macro.dbt_date.default__week_of_year": {"name": "default__week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "unique_id": "macro.dbt_date.default__week_of_year", "macro_sql": "{%- macro default__week_of_year(date) -%}\ncast({{ dbt_date.date_part('week', date) }} as {{ dbt.type_int() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.656159, "supported_languages": null}, "macro.dbt_date.postgres__week_of_year": {"name": "postgres__week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "unique_id": "macro.dbt_date.postgres__week_of_year", "macro_sql": "\n\n{%- macro postgres__week_of_year(date) -%}\n{# postgresql 'week' returns isoweek. Use to_char instead.\n   WW = the first week starts on the first day of the year #}\ncast(to_char({{ date }}, 'WW') as {{ dbt.type_int() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.65631, "supported_languages": null}, "macro.dbt_date.duckdb__week_of_year": {"name": "duckdb__week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "unique_id": "macro.dbt_date.duckdb__week_of_year", "macro_sql": "\n\n{%- macro duckdb__week_of_year(date) -%}\ncast(ceil(dayofyear({{ date }}) / 7) as int)\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.656414, "supported_languages": null}, "macro.dbt_date.convert_timezone": {"name": "convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.convert_timezone", "macro_sql": "{%- macro convert_timezone(column, target_tz=None, source_tz=None) -%}\n{%- set source_tz = \"UTC\" if not source_tz else source_tz -%}\n{%- set target_tz = var(\"dbt_date:time_zone\") if not target_tz else target_tz -%}\n{{ adapter.dispatch('convert_timezone', 'dbt_date') (column, target_tz, source_tz) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.bigquery__convert_timezone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.657686, "supported_languages": null}, "macro.dbt_date.default__convert_timezone": {"name": "default__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.default__convert_timezone", "macro_sql": "{% macro default__convert_timezone(column, target_tz, source_tz) -%}\nconvert_timezone('{{ source_tz }}', '{{ target_tz }}',\n    cast({{ column }} as {{ dbt.type_timestamp() }})\n)\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.65789, "supported_languages": null}, "macro.dbt_date.bigquery__convert_timezone": {"name": "bigquery__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.bigquery__convert_timezone", "macro_sql": "{%- macro bigquery__convert_timezone(column, target_tz, source_tz=None) -%}\ntimestamp(datetime({{ column }}, '{{ target_tz}}'))\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.658047, "supported_languages": null}, "macro.dbt_date.postgres__convert_timezone": {"name": "postgres__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.postgres__convert_timezone", "macro_sql": "{% macro postgres__convert_timezone(column, target_tz, source_tz) -%}\ncast(\n    cast({{ column }} as {{ dbt.type_timestamp() }})\n        at time zone '{{ source_tz }}' at time zone '{{ target_tz }}' as {{ dbt.type_timestamp() }}\n)\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.658294, "supported_languages": null}, "macro.dbt_date.redshift__convert_timezone": {"name": "redshift__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.redshift__convert_timezone", "macro_sql": "{%- macro redshift__convert_timezone(column, target_tz, source_tz) -%}\n{{ return(dbt_date.default__convert_timezone(column, target_tz, source_tz)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.default__convert_timezone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.658498, "supported_languages": null}, "macro.dbt_date.duckdb__convert_timezone": {"name": "duckdb__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.duckdb__convert_timezone", "macro_sql": "{% macro duckdb__convert_timezone(column, target_tz, source_tz) -%}\n{{ return(dbt_date.postgres__convert_timezone(column, target_tz, source_tz)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.postgres__convert_timezone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.658686, "supported_languages": null}, "macro.dbt_date.spark__convert_timezone": {"name": "spark__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.spark__convert_timezone", "macro_sql": "{%- macro spark__convert_timezone(column, target_tz, source_tz) -%}\nfrom_utc_timestamp(\n        to_utc_timestamp({{ column }}, '{{ source_tz }}'),\n        '{{ target_tz }}'\n        )\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.658853, "supported_languages": null}, "macro.dbt_date.trino__convert_timezone": {"name": "trino__convert_timezone", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "unique_id": "macro.dbt_date.trino__convert_timezone", "macro_sql": "{%- macro trino__convert_timezone(column, target_tz, source_tz) -%}\n    cast((at_timezone(with_timezone(cast({{ column }} as {{ dbt.type_timestamp() }}), '{{ source_tz }}'), '{{ target_tz }}')) as {{ dbt.type_timestamp() }})\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.659093, "supported_languages": null}, "macro.dbt_date.n_months_away": {"name": "n_months_away", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/n_months_away.sql", "original_file_path": "macros/calendar_date/n_months_away.sql", "unique_id": "macro.dbt_date.n_months_away", "macro_sql": "{%- macro n_months_away(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt.date_trunc('month',\n    dbt.dateadd('month', n,\n        dbt_date.today(tz)\n        )\n    ) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6594439, "supported_languages": null}, "macro.dbt_date.iso_week_of_year": {"name": "iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.iso_week_of_year", "macro_sql": "{%- macro iso_week_of_year(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('iso_week_of_year', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6601658, "supported_languages": null}, "macro.dbt_date._iso_week_of_year": {"name": "_iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date._iso_week_of_year", "macro_sql": "{%- macro _iso_week_of_year(date, week_type) -%}\ncast({{ dbt_date.date_part(week_type, date) }} as {{ dbt.type_int() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.660367, "supported_languages": null}, "macro.dbt_date.default__iso_week_of_year": {"name": "default__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.default__iso_week_of_year", "macro_sql": "\n\n{%- macro default__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'isoweek') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.660507, "supported_languages": null}, "macro.dbt_date.snowflake__iso_week_of_year": {"name": "snowflake__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.snowflake__iso_week_of_year", "macro_sql": "\n\n{%- macro snowflake__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'weekiso') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6606479, "supported_languages": null}, "macro.dbt_date.postgres__iso_week_of_year": {"name": "postgres__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.postgres__iso_week_of_year", "macro_sql": "\n\n{%- macro postgres__iso_week_of_year(date) -%}\n-- postgresql week is isoweek, the first week of a year containing January 4 of that year.\n{{ dbt_date._iso_week_of_year(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.660856, "supported_languages": null}, "macro.dbt_date.duckdb__iso_week_of_year": {"name": "duckdb__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.duckdb__iso_week_of_year", "macro_sql": "\n\n{%- macro duckdb__iso_week_of_year(date) -%}\n{{ return(dbt_date.postgres__iso_week_of_year(date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.661003, "supported_languages": null}, "macro.dbt_date.spark__iso_week_of_year": {"name": "spark__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.spark__iso_week_of_year", "macro_sql": "\n\n{%- macro spark__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.661143, "supported_languages": null}, "macro.dbt_date.trino__iso_week_of_year": {"name": "trino__iso_week_of_year", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "unique_id": "macro.dbt_date.trino__iso_week_of_year", "macro_sql": "\n\n{%- macro trino__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6612842, "supported_languages": null}, "macro.dbt_date.week_end": {"name": "week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.week_end", "macro_sql": "{%- macro week_end(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('week_end', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.661793, "supported_languages": null}, "macro.dbt_date.default__week_end": {"name": "default__week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.default__week_end", "macro_sql": "{%- macro default__week_end(date) -%}\n{{ last_day(date, 'week') }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.66193, "supported_languages": null}, "macro.dbt_date.snowflake__week_end": {"name": "snowflake__week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.snowflake__week_end", "macro_sql": "\n\n{%- macro snowflake__week_end(date) -%}\n{%- set dt = dbt_date.week_start(date) -%}\n{{ dbt_date.n_days_away(6, dt) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.week_start", "macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.662132, "supported_languages": null}, "macro.dbt_date.postgres__week_end": {"name": "postgres__week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.postgres__week_end", "macro_sql": "\n\n{%- macro postgres__week_end(date) -%}\n{%- set dt = dbt_date.week_start(date) -%}\n{{ dbt_date.n_days_away(6, dt) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.week_start", "macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6623318, "supported_languages": null}, "macro.dbt_date.duckdb__week_end": {"name": "duckdb__week_end", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "unique_id": "macro.dbt_date.duckdb__week_end", "macro_sql": "\n\n{%- macro duckdb__week_end(date) -%}\n{{ return(dbt_date.postgres__week_end(date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_date.postgres__week_end"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6624799, "supported_languages": null}, "macro.dbt_date.next_month_number": {"name": "next_month_number", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/next_month_number.sql", "original_file_path": "macros/calendar_date/next_month_number.sql", "unique_id": "macro.dbt_date.next_month_number", "macro_sql": "{%- macro next_month_number(tz=None) -%}\n{{ dbt_date.date_part('month', dbt_date.next_month(tz)) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_date.next_month"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.662696, "supported_languages": null}, "macro.dbt_date.last_month_number": {"name": "last_month_number", "resource_type": "macro", "package_name": "dbt_date", "path": "macros/calendar_date/last_month_number.sql", "original_file_path": "macros/calendar_date/last_month_number.sql", "unique_id": "macro.dbt_date.last_month_number", "macro_sql": "{%- macro last_month_number(tz=None) -%}\n{{ dbt_date.date_part('month', dbt_date.last_month(tz)) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_date.last_month"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.662915, "supported_languages": null}, "macro.fivetran_utils.enabled_vars": {"name": "enabled_vars", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/enabled_vars.sql", "original_file_path": "macros/enabled_vars.sql", "unique_id": "macro.fivetran_utils.enabled_vars", "macro_sql": "{% macro enabled_vars(vars) %}\n\n{% for v in vars %}\n    \n    {% if var(v, True) == False %}\n    {{ return(False) }}\n    {% endif %}\n\n{% endfor %}\n\n{{ return(True) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.66331, "supported_languages": null}, "macro.fivetran_utils.percentile": {"name": "percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.percentile", "macro_sql": "{% macro percentile(percentile_field, partition_field, percent) -%}\n\n{{ adapter.dispatch('percentile', 'fivetran_utils') (percentile_field, partition_field, percent) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.bigquery__percentile"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.664257, "supported_languages": null}, "macro.fivetran_utils.default__percentile": {"name": "default__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.default__percentile", "macro_sql": "{% macro default__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile_cont( \n        {{ percent }} )\n        within group ( order by {{ percentile_field }} )\n        over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.664427, "supported_languages": null}, "macro.fivetran_utils.redshift__percentile": {"name": "redshift__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.redshift__percentile", "macro_sql": "{% macro redshift__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile_cont( \n        {{ percent }} )\n        within group ( order by {{ percentile_field }} )\n        over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.664595, "supported_languages": null}, "macro.fivetran_utils.bigquery__percentile": {"name": "bigquery__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.bigquery__percentile", "macro_sql": "{% macro bigquery__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile_cont( \n        {{ percentile_field }}, \n        {{ percent }}) \n        over (partition by {{ partition_field }}    \n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6647592, "supported_languages": null}, "macro.fivetran_utils.postgres__percentile": {"name": "postgres__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.postgres__percentile", "macro_sql": "{% macro postgres__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile_cont( \n        {{ percent }} )\n        within group ( order by {{ percentile_field }} )\n    /* have to group by partition field */\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6649091, "supported_languages": null}, "macro.fivetran_utils.spark__percentile": {"name": "spark__percentile", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "unique_id": "macro.fivetran_utils.spark__percentile", "macro_sql": "{% macro spark__percentile(percentile_field, partition_field, percent)  %}\n\n    percentile( \n        {{ percentile_field }}, \n        {{ percent }}) \n        over (partition by {{ partition_field }}    \n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6650681, "supported_languages": null}, "macro.fivetran_utils.pivot_json_extract": {"name": "pivot_json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/pivot_json_extract.sql", "original_file_path": "macros/pivot_json_extract.sql", "unique_id": "macro.fivetran_utils.pivot_json_extract", "macro_sql": "{% macro pivot_json_extract(string, list_of_properties) %}\n\n{%- for property in list_of_properties -%}\n{%- if property is mapping -%}\nreplace( {{ fivetran_utils.json_extract(string, property.name) }}, '\"', '') as {{ property.alias if property.alias else property.name | replace(' ', '_') | replace('.', '_') | lower }}\n\n{%- else -%}\nreplace( {{ fivetran_utils.json_extract(string, property) }}, '\"', '') as {{ property | replace(' ', '_') | lower }}\n\n{%- endif -%}\n{%- if not loop.last -%},{%- endif %}\n{% endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.json_extract"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6658711, "supported_languages": null}, "macro.fivetran_utils.persist_pass_through_columns": {"name": "persist_pass_through_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/persist_pass_through_columns.sql", "original_file_path": "macros/persist_pass_through_columns.sql", "unique_id": "macro.fivetran_utils.persist_pass_through_columns", "macro_sql": "{% macro persist_pass_through_columns(pass_through_variable, identifier=none, transform='') %}\n\n{% if var(pass_through_variable, none) %}\n    {% for field in var(pass_through_variable) %}\n        , {{ transform ~ '(' ~ (identifier ~ '.' if identifier else '') ~ (field.alias if field.alias else field.name) ~ ')' }} as {{ field.alias if field.alias else field.name }}\n    {% endfor %}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.666582, "supported_languages": null}, "macro.fivetran_utils.json_parse": {"name": "json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.json_parse", "macro_sql": "{% macro json_parse(string, string_path) -%}\n\n{{ adapter.dispatch('json_parse', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.bigquery__json_parse"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.667935, "supported_languages": null}, "macro.fivetran_utils.default__json_parse": {"name": "default__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.default__json_parse", "macro_sql": "{% macro default__json_parse(string, string_path) %}\n\n  json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6681821, "supported_languages": null}, "macro.fivetran_utils.redshift__json_parse": {"name": "redshift__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.redshift__json_parse", "macro_sql": "{% macro redshift__json_parse(string, string_path) %}\n\n  json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6684318, "supported_languages": null}, "macro.fivetran_utils.bigquery__json_parse": {"name": "bigquery__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.bigquery__json_parse", "macro_sql": "{% macro bigquery__json_parse(string, string_path) %}\n\n \n  json_extract_scalar({{string}}, '$.{%- for s in string_path -%}{{ s }}{%- if not loop.last -%}.{%- endif -%}{%- endfor -%} ')\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6686752, "supported_languages": null}, "macro.fivetran_utils.postgres__json_parse": {"name": "postgres__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.postgres__json_parse", "macro_sql": "{% macro postgres__json_parse(string, string_path) %}\n\n  {{string}}::json #>> '{ {%- for s in string_path -%}{{ s }}{%- if not loop.last -%},{%- endif -%}{%- endfor -%} }'\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.668928, "supported_languages": null}, "macro.fivetran_utils.snowflake__json_parse": {"name": "snowflake__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.snowflake__json_parse", "macro_sql": "{% macro snowflake__json_parse(string, string_path) %}\n\n  parse_json( {{string}} ) {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.669197, "supported_languages": null}, "macro.fivetran_utils.spark__json_parse": {"name": "spark__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.spark__json_parse", "macro_sql": "{% macro spark__json_parse(string, string_path) %}\n\n  {{string}} : {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.669466, "supported_languages": null}, "macro.fivetran_utils.sqlserver__json_parse": {"name": "sqlserver__json_parse", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "unique_id": "macro.fivetran_utils.sqlserver__json_parse", "macro_sql": "{% macro sqlserver__json_parse(string, string_path) %}\n\n  json_value({{string}}, '$.{%- for s in string_path -%}{{ s }}{%- if not loop.last -%}.{%- endif -%}{%- endfor -%} ')\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.669708, "supported_languages": null}, "macro.fivetran_utils.max_bool": {"name": "max_bool", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "unique_id": "macro.fivetran_utils.max_bool", "macro_sql": "{% macro max_bool(boolean_field) -%}\n\n{{ adapter.dispatch('max_bool', 'fivetran_utils') (boolean_field) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.bigquery__max_bool"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.670034, "supported_languages": null}, "macro.fivetran_utils.default__max_bool": {"name": "default__max_bool", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "unique_id": "macro.fivetran_utils.default__max_bool", "macro_sql": "{% macro default__max_bool(boolean_field)  %}\n\n    bool_or( {{ boolean_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6701388, "supported_languages": null}, "macro.fivetran_utils.snowflake__max_bool": {"name": "snowflake__max_bool", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "unique_id": "macro.fivetran_utils.snowflake__max_bool", "macro_sql": "{% macro snowflake__max_bool(boolean_field)  %}\n\n    max( {{ boolean_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.670241, "supported_languages": null}, "macro.fivetran_utils.bigquery__max_bool": {"name": "bigquery__max_bool", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "unique_id": "macro.fivetran_utils.bigquery__max_bool", "macro_sql": "{% macro bigquery__max_bool(boolean_field)  %}\n\n    max( {{ boolean_field }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.670348, "supported_languages": null}, "macro.fivetran_utils.calculated_fields": {"name": "calculated_fields", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/calculated_fields.sql", "original_file_path": "macros/calculated_fields.sql", "unique_id": "macro.fivetran_utils.calculated_fields", "macro_sql": "{% macro calculated_fields(variable) -%}\n\n{% if var(variable, none) %}\n    {% for field in var(variable) %}\n        , {{ field.transform_sql }} as {{ field.name }} \n    {% endfor %}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.67072, "supported_languages": null}, "macro.fivetran_utils.drop_schemas_automation": {"name": "drop_schemas_automation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/drop_schemas_automation.sql", "original_file_path": "macros/drop_schemas_automation.sql", "unique_id": "macro.fivetran_utils.drop_schemas_automation", "macro_sql": "{% macro drop_schemas_automation(drop_target_schema=true) %}\n    {{ return(adapter.dispatch('drop_schemas_automation', 'fivetran_utils')(drop_target_schema)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__drop_schemas_automation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.671415, "supported_languages": null}, "macro.fivetran_utils.default__drop_schemas_automation": {"name": "default__drop_schemas_automation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/drop_schemas_automation.sql", "original_file_path": "macros/drop_schemas_automation.sql", "unique_id": "macro.fivetran_utils.default__drop_schemas_automation", "macro_sql": "{% macro default__drop_schemas_automation(drop_target_schema=true) %}\n\n{% set fetch_list_sql %}\n    {% if target.type not in ('databricks', 'spark') %}\n        select schema_name\n        from \n        {{ wrap_in_quotes(target.database) }}.INFORMATION_SCHEMA.SCHEMATA\n        where lower(schema_name) like '{{ target.schema | lower }}{%- if not drop_target_schema -%}_{%- endif -%}%'\n    {% else %}\n        SHOW SCHEMAS LIKE '{{ target.schema }}{%- if not drop_target_schema -%}_{%- endif -%}*'\n    {% endif %}\n{% endset %}\n\n{% set results = run_query(fetch_list_sql) %}\n\n{% if execute %}\n    {% set results_list = results.columns[0].values() %}\n{% else %}\n    {% set results_list = [] %}\n{% endif %}\n\n{% for schema_to_drop in results_list %}\n    {% do adapter.drop_schema(api.Relation.create(database=target.database, schema=schema_to_drop)) %}\n    {{ print('Schema ' ~ schema_to_drop ~ ' successfully dropped from the ' ~ target.database ~ ' database.\\n')}}\n{% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.wrap_in_quotes", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.672493, "supported_languages": null}, "macro.fivetran_utils.seed_data_helper": {"name": "seed_data_helper", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/seed_data_helper.sql", "original_file_path": "macros/seed_data_helper.sql", "unique_id": "macro.fivetran_utils.seed_data_helper", "macro_sql": "{% macro seed_data_helper(seed_name, warehouses) %}\n\n{% if target.type in warehouses %}\n    {% for w in warehouses %}\n        {% if target.type == w %}\n            {{ return(ref(seed_name ~ \"_\" ~ w ~ \"\")) }}\n        {% endif %}\n    {% endfor %}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.673082, "supported_languages": null}, "macro.fivetran_utils.fill_pass_through_columns": {"name": "fill_pass_through_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fill_pass_through_columns.sql", "original_file_path": "macros/fill_pass_through_columns.sql", "unique_id": "macro.fivetran_utils.fill_pass_through_columns", "macro_sql": "{% macro fill_pass_through_columns(pass_through_variable) %}\n\n{% if var(pass_through_variable) %}\n    {% for field in var(pass_through_variable) %}\n        {% if field is mapping %}\n            {% if field.transform_sql %}\n                , {{ field.transform_sql }} as {{ field.alias if field.alias else field.name }}\n            {% else %}\n                , {{ field.alias if field.alias else field.name }}\n            {% endif %}\n        {% else %}\n        , {{ field }}\n        {% endif %}\n    {% endfor %}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6738791, "supported_languages": null}, "macro.fivetran_utils.string_agg": {"name": "string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.string_agg", "macro_sql": "{% macro string_agg(field_to_agg, delimiter) -%}\n\n{{ adapter.dispatch('string_agg', 'fivetran_utils') (field_to_agg, delimiter) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__string_agg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6743538, "supported_languages": null}, "macro.fivetran_utils.default__string_agg": {"name": "default__string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.default__string_agg", "macro_sql": "{% macro default__string_agg(field_to_agg, delimiter) %}\n    string_agg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.674489, "supported_languages": null}, "macro.fivetran_utils.snowflake__string_agg": {"name": "snowflake__string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.snowflake__string_agg", "macro_sql": "{% macro snowflake__string_agg(field_to_agg, delimiter) %}\n    listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6746209, "supported_languages": null}, "macro.fivetran_utils.redshift__string_agg": {"name": "redshift__string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.redshift__string_agg", "macro_sql": "{% macro redshift__string_agg(field_to_agg, delimiter) %}\n    listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.674756, "supported_languages": null}, "macro.fivetran_utils.spark__string_agg": {"name": "spark__string_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "unique_id": "macro.fivetran_utils.spark__string_agg", "macro_sql": "{% macro spark__string_agg(field_to_agg, delimiter) %}\n    -- collect set will remove duplicates\n    replace(replace(replace(cast( collect_set({{ field_to_agg }}) as string), '[', ''), ']', ''), ', ', {{ delimiter }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.674892, "supported_languages": null}, "macro.fivetran_utils.timestamp_diff": {"name": "timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.timestamp_diff", "macro_sql": "{% macro timestamp_diff(first_date, second_date, datepart) %}\n  {{ adapter.dispatch('timestamp_diff', 'fivetran_utils')(first_date, second_date, datepart) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.bigquery__timestamp_diff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.677896, "supported_languages": null}, "macro.fivetran_utils.default__timestamp_diff": {"name": "default__timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.default__timestamp_diff", "macro_sql": "{% macro default__timestamp_diff(first_date, second_date, datepart) %}\n\n    datediff(\n        {{ datepart }},\n        {{ first_date }},\n        {{ second_date }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.678058, "supported_languages": null}, "macro.fivetran_utils.redshift__timestamp_diff": {"name": "redshift__timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.redshift__timestamp_diff", "macro_sql": "{% macro redshift__timestamp_diff(first_date, second_date, datepart) %}\n\n    datediff(\n        {{ datepart }},\n        {{ first_date }},\n        {{ second_date }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6782222, "supported_languages": null}, "macro.fivetran_utils.bigquery__timestamp_diff": {"name": "bigquery__timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.bigquery__timestamp_diff", "macro_sql": "{% macro bigquery__timestamp_diff(first_date, second_date, datepart) %}\n\n    timestamp_diff(\n        {{second_date}},\n        {{first_date}},\n        {{datepart}}\n    )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.678375, "supported_languages": null}, "macro.fivetran_utils.postgres__timestamp_diff": {"name": "postgres__timestamp_diff", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "unique_id": "macro.fivetran_utils.postgres__timestamp_diff", "macro_sql": "{% macro postgres__timestamp_diff(first_date, second_date, datepart) %}\n\n    {% if datepart == 'year' %}\n        (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n    {% elif datepart == 'quarter' %}\n        ({{ dbt.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n    {% elif datepart == 'month' %}\n        ({{ dbt.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n    {% elif datepart == 'day' %}\n        (({{second_date}})::date - ({{first_date}})::date)\n    {% elif datepart == 'week' %}\n        ({{ dbt.datediff(first_date, second_date, 'day') }} / 7 + case\n            when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n                case when {{first_date}} <= {{second_date}} then 0 else -1 end\n            else\n                case when {{first_date}} <= {{second_date}} then 1 else 0 end\n        end)\n    {% elif datepart == 'hour' %}\n        ({{ dbt.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n    {% elif datepart == 'minute' %}\n        ({{ dbt.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n    {% elif datepart == 'second' %}\n        ({{ dbt.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n    {% elif datepart == 'millisecond' %}\n        ({{ dbt.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n    {% elif datepart == 'microsecond' %}\n        ({{ dbt.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n    {% else %}\n        {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n    {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6801522, "supported_languages": null}, "macro.fivetran_utils.try_cast": {"name": "try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.try_cast", "macro_sql": "{% macro try_cast(field, type) %}\n    {{ adapter.dispatch('try_cast', 'fivetran_utils') (field, type) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.bigquery__try_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.681108, "supported_languages": null}, "macro.fivetran_utils.default__try_cast": {"name": "default__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.default__try_cast", "macro_sql": "{% macro default__try_cast(field, type) %}\n    {# most databases don't support this function yet\n    so we just need to use cast #}\n    cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6812491, "supported_languages": null}, "macro.fivetran_utils.redshift__try_cast": {"name": "redshift__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.redshift__try_cast", "macro_sql": "{% macro redshift__try_cast(field, type) %}\n{%- if type == 'numeric' -%}\n\n    case\n        when trim({{field}}) ~ '^(0|[1-9][0-9]*)$' then trim({{field}})\n        else null\n    end::{{type}}\n\n{% else %}\n    {{ exceptions.raise_compiler_error(\n            \"non-numeric datatypes are not currently supported\") }}\n\n{% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.681526, "supported_languages": null}, "macro.fivetran_utils.postgres__try_cast": {"name": "postgres__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.postgres__try_cast", "macro_sql": "{% macro postgres__try_cast(field, type) %}\n{%- if type == 'numeric' -%}\n\n    case\n        when replace(cast({{field}} as varchar),cast(' ' as varchar),cast('' as varchar)) ~ '^(0|[1-9][0-9]*)$' \n        then replace(cast({{field}} as varchar),cast(' ' as varchar),cast('' as varchar))\n        else null\n    end::{{type}}\n\n{% else %}\n    {{ exceptions.raise_compiler_error(\n            \"non-numeric datatypes are not currently supported\") }}\n\n{% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.681817, "supported_languages": null}, "macro.fivetran_utils.snowflake__try_cast": {"name": "snowflake__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.snowflake__try_cast", "macro_sql": "{% macro snowflake__try_cast(field, type) %}\n    try_cast(cast({{field}} as varchar) as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.681947, "supported_languages": null}, "macro.fivetran_utils.bigquery__try_cast": {"name": "bigquery__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.bigquery__try_cast", "macro_sql": "{% macro bigquery__try_cast(field, type) %}\n    safe_cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6820722, "supported_languages": null}, "macro.fivetran_utils.spark__try_cast": {"name": "spark__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.spark__try_cast", "macro_sql": "{% macro spark__try_cast(field, type) %}\n    try_cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6822, "supported_languages": null}, "macro.fivetran_utils.sqlserver__try_cast": {"name": "sqlserver__try_cast", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "unique_id": "macro.fivetran_utils.sqlserver__try_cast", "macro_sql": "{% macro sqlserver__try_cast(field, type) %}\n    try_cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.682325, "supported_languages": null}, "macro.fivetran_utils.source_relation": {"name": "source_relation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "unique_id": "macro.fivetran_utils.source_relation", "macro_sql": "{% macro source_relation(union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('source_relation', 'fivetran_utils') (union_schema_variable, union_database_variable) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__source_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.68282, "supported_languages": null}, "macro.fivetran_utils.default__source_relation": {"name": "default__source_relation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "unique_id": "macro.fivetran_utils.default__source_relation", "macro_sql": "{% macro default__source_relation(union_schema_variable, union_database_variable) %}\n\n{% if var(union_schema_variable, none)  %}\n, case\n    {% for schema in var(union_schema_variable) %}\n    when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%.{{ schema|lower }}.%' then '{{ schema|lower }}'\n    {% endfor %}\n  end as source_relation\n{% elif var(union_database_variable, none) %}\n, case\n    {% for database in var(union_database_variable) %}\n    when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%{{ database|lower }}.%' then '{{ database|lower }}'\n    {% endfor %}\n  end as source_relation\n{% else %}\n, cast('' as {{ dbt.type_string() }}) as source_relation\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.683404, "supported_languages": null}, "macro.fivetran_utils.first_value": {"name": "first_value", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "unique_id": "macro.fivetran_utils.first_value", "macro_sql": "{% macro first_value(first_value_field, partition_field, order_by_field, order=\"asc\") -%}\n\n{{ adapter.dispatch('first_value', 'fivetran_utils') (first_value_field, partition_field, order_by_field, order) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__first_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.683908, "supported_languages": null}, "macro.fivetran_utils.default__first_value": {"name": "default__first_value", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "unique_id": "macro.fivetran_utils.default__first_value", "macro_sql": "{% macro default__first_value(first_value_field, partition_field, order_by_field, order=\"asc\")  %}\n\n    first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.684116, "supported_languages": null}, "macro.fivetran_utils.redshift__first_value": {"name": "redshift__first_value", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "unique_id": "macro.fivetran_utils.redshift__first_value", "macro_sql": "{% macro redshift__first_value(first_value_field, partition_field, order_by_field, order=\"asc\") %}\n\n    first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} , {{ partition_field }} rows unbounded preceding )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.684343, "supported_languages": null}, "macro.fivetran_utils.add_dbt_source_relation": {"name": "add_dbt_source_relation", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/add_dbt_source_relation.sql", "original_file_path": "macros/add_dbt_source_relation.sql", "unique_id": "macro.fivetran_utils.add_dbt_source_relation", "macro_sql": "{% macro add_dbt_source_relation() %}\n\n{% if var('union_schemas', none) or var('union_databases', none) %}\n, _dbt_source_relation\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.684602, "supported_languages": null}, "macro.fivetran_utils.add_pass_through_columns": {"name": "add_pass_through_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/add_pass_through_columns.sql", "original_file_path": "macros/add_pass_through_columns.sql", "unique_id": "macro.fivetran_utils.add_pass_through_columns", "macro_sql": "{% macro add_pass_through_columns(base_columns, pass_through_var) %}\n\n  {% if pass_through_var %}\n\n    {% for column in pass_through_var %}\n\n    {% if column is mapping %}\n\n      {% if column.alias %}\n\n        {% do base_columns.append({ \"name\": column.name, \"alias\": column.alias, \"datatype\": column.datatype if column.datatype else dbt.type_string()}) %}\n\n      {% else %}\n\n        {% do base_columns.append({ \"name\": column.name, \"datatype\": column.datatype if column.datatype else dbt.type_string()}) %}\n        \n      {% endif %}\n\n    {% else %}\n\n      {% do base_columns.append({ \"name\": column, \"datatype\": dbt.type_string()}) %}\n\n    {% endif %}\n\n    {% endfor %}\n\n  {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6858728, "supported_languages": null}, "macro.fivetran_utils.union_relations": {"name": "union_relations", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "unique_id": "macro.fivetran_utils.union_relations", "macro_sql": "{%- macro union_relations(relations, aliases=none, column_override=none, include=[], exclude=[], source_column_name=none) -%}\n\n    {%- if exclude and include -%}\n        {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n    {%- endif -%}\n\n    {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n    {%- if not execute %}\n        {{ return('') }}\n    {% endif -%}\n\n    {%- set column_override = column_override if column_override is not none else {} -%}\n    {%- set source_column_name = source_column_name if source_column_name is not none else '_dbt_source_relation' -%}\n\n    {%- set relation_columns = {} -%}\n    {%- set column_superset = {} -%}\n\n    {%- for relation in relations -%}\n\n        {%- do relation_columns.update({relation: []}) -%}\n\n        {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n        {%- set cols = adapter.get_columns_in_relation(relation) -%}\n        {%- for col in cols -%}\n\n        {#- If an exclude list was provided and the column is in the list, do nothing -#}\n        {%- if exclude and col.column in exclude -%}\n\n        {#- If an include list was provided and the column is not in the list, do nothing -#}\n        {%- elif include and col.column not in include -%}\n\n        {#- Otherwise add the column to the column superset -#}\n        {%- else -%}\n\n            {#- update the list of columns in this relation -#}\n            {%- do relation_columns[relation].append(col.column) -%}\n\n            {%- if col.column in column_superset -%}\n\n                {%- set stored = column_superset[col.column] -%}\n                {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n                    {%- do column_superset.update({col.column: col}) -%}\n\n                {%- endif %}\n\n            {%- else -%}\n\n                {%- do column_superset.update({col.column: col}) -%}\n\n            {%- endif -%}\n\n        {%- endif -%}\n\n        {%- endfor -%}\n    {%- endfor -%}\n\n    {%- set ordered_column_names = column_superset.keys() -%}\n\n    {%- for relation in relations %}\n\n        (\n            select\n\n                cast({{ dbt.string_literal(relation) }} as {{ dbt.type_string() }}) as {{ source_column_name }},\n                {% for col_name in ordered_column_names -%}\n\n                    {%- set col = column_superset[col_name] %}\n                    {%- set col_type = column_override.get(col.column, col.data_type) %}\n                    {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n                    cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n                {%- endfor %}\n\n            from {{ aliases[loop.index0] if aliases else relation }}\n        )\n\n        {% if not loop.last -%}\n            union all\n        {% endif -%}\n\n    {%- endfor -%}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt.string_literal", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.689881, "supported_languages": null}, "macro.fivetran_utils.union_tables": {"name": "union_tables", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "unique_id": "macro.fivetran_utils.union_tables", "macro_sql": "{%- macro union_tables(tables, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_table') -%}\n\n    {%- do exceptions.warn(\"Warning: the `union_tables` macro is no longer supported and will be deprecated in a future release of dbt-utils. Use the `union_relations` macro instead\") -%}\n\n    {{ return(dbt_utils.union_relations(tables, column_override, include, exclude, source_column_name)) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_utils.union_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6902468, "supported_languages": null}, "macro.fivetran_utils.snowflake_seed_data": {"name": "snowflake_seed_data", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/snowflake_seed_data.sql", "original_file_path": "macros/snowflake_seed_data.sql", "unique_id": "macro.fivetran_utils.snowflake_seed_data", "macro_sql": "{% macro snowflake_seed_data(seed_name) %}\n\n{% if target.type == 'snowflake' %}\n{{ return(ref(seed_name ~ '_snowflake')) }}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.690628, "supported_languages": null}, "macro.fivetran_utils.fill_staging_columns": {"name": "fill_staging_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "unique_id": "macro.fivetran_utils.fill_staging_columns", "macro_sql": "{% macro fill_staging_columns(source_columns, staging_columns) -%}\n\n{%- set source_column_names = source_columns|map(attribute='name')|map('lower')|list -%}\n\n{%- for column in staging_columns %}\n    {% if column.name|lower in source_column_names -%}\n        {{ fivetran_utils.quote_column(column) }} as \n        {%- if 'alias' in column %} {{ column.alias }} {% else %} {{ fivetran_utils.quote_column(column) }} {%- endif -%}\n    {%- else -%}\n        cast(null as {{ column.datatype }})\n        {%- if 'alias' in column %} as {{ column.alias }} {% else %} as {{ fivetran_utils.quote_column(column) }} {% endif -%}\n    {%- endif -%}\n    {%- if not loop.last -%} , {% endif -%}\n{% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.quote_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6922219, "supported_languages": null}, "macro.fivetran_utils.quote_column": {"name": "quote_column", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "unique_id": "macro.fivetran_utils.quote_column", "macro_sql": "{% macro quote_column(column) %}\n    {% if 'quote' in column %}\n        {% if column.quote %}\n            {% if target.type in ('bigquery', 'spark', 'databricks') %}\n            `{{ column.name }}`\n            {% elif target.type == 'snowflake' %}\n            \"{{ column.name | upper }}\"\n            {% else %}\n            \"{{ column.name }}\"\n            {% endif %}\n        {% else %}\n        {{ column.name }}\n        {% endif %}\n    {% else %}\n    {{ column.name }}\n    {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.692798, "supported_languages": null}, "macro.fivetran_utils.json_extract": {"name": "json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.json_extract", "macro_sql": "{% macro json_extract(string, string_path) -%}\n\n{{ adapter.dispatch('json_extract', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.bigquery__json_extract"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.693374, "supported_languages": null}, "macro.fivetran_utils.default__json_extract": {"name": "default__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.default__json_extract", "macro_sql": "{% macro default__json_extract(string, string_path) %}\n\n  json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} )\n \n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6935308, "supported_languages": null}, "macro.fivetran_utils.snowflake__json_extract": {"name": "snowflake__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.snowflake__json_extract", "macro_sql": "{% macro snowflake__json_extract(string, string_path) %}\n\n  json_extract_path_text(try_parse_json( {{string}} ), {{ \"'\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.69369, "supported_languages": null}, "macro.fivetran_utils.redshift__json_extract": {"name": "redshift__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.redshift__json_extract", "macro_sql": "{% macro redshift__json_extract(string, string_path) %}\n\n  case when is_valid_json( {{string}} ) then json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} ) else null end\n \n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.693861, "supported_languages": null}, "macro.fivetran_utils.bigquery__json_extract": {"name": "bigquery__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.bigquery__json_extract", "macro_sql": "{% macro bigquery__json_extract(string, string_path) %}\n\n  json_extract_scalar({{string}}, {{ \"'$.\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.694012, "supported_languages": null}, "macro.fivetran_utils.postgres__json_extract": {"name": "postgres__json_extract", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "unique_id": "macro.fivetran_utils.postgres__json_extract", "macro_sql": "{% macro postgres__json_extract(string, string_path) %}\n\n  {{string}}::json->>{{\"'\" ~ string_path ~ \"'\" }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.694162, "supported_languages": null}, "macro.fivetran_utils.collect_freshness": {"name": "collect_freshness", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "unique_id": "macro.fivetran_utils.collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n  {{ return(adapter.dispatch('collect_freshness')(source, loaded_at_field, filter))}}\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.695008, "supported_languages": null}, "macro.fivetran_utils.default__collect_freshness": {"name": "default__collect_freshness", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "unique_id": "macro.fivetran_utils.default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n  {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n\n  {%- set enabled_array = [] -%}\n  {% for node in graph.sources.values() %}\n    {% if node.identifier == source.identifier %}\n      {% if (node.meta['is_enabled'] | default(true)) %}\n        {%- do enabled_array.append(1) -%}\n      {% endif %}\n    {% endif %}\n  {% endfor %}\n  {% set is_enabled = (enabled_array != []) %}\n\n    select\n      {% if is_enabled %}\n      max({{ loaded_at_field }})\n      {% else %} \n      {{ current_timestamp() }} {% endif %} as max_loaded_at,\n      {{ current_timestamp() }} as snapshotted_at\n\n    {% if is_enabled %}\n    from {{ source }}\n      {% if filter %}\n      where {{ filter }}\n      {% endif %}\n    {% endif %}\n\n  {% endcall %}\n\n  {% if dbt_version.split('.') | map('int') | list >= [1, 5, 0]  %}\n    {{ return(load_result('collect_freshness')) }}\n  {% else %}\n    {{ return(load_result('collect_freshness').table) }}\n  {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6963022, "supported_languages": null}, "macro.fivetran_utils.timestamp_add": {"name": "timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.timestamp_add", "macro_sql": "{% macro timestamp_add(datepart, interval, from_timestamp) -%}\n\n{{ adapter.dispatch('timestamp_add', 'fivetran_utils') (datepart, interval, from_timestamp) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.bigquery__timestamp_add"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6970181, "supported_languages": null}, "macro.fivetran_utils.default__timestamp_add": {"name": "default__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.default__timestamp_add", "macro_sql": "{% macro default__timestamp_add(datepart, interval, from_timestamp) %}\n\n    timestampadd(\n        {{ datepart }},\n        {{ interval }},\n        {{ from_timestamp }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.697183, "supported_languages": null}, "macro.fivetran_utils.bigquery__timestamp_add": {"name": "bigquery__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.bigquery__timestamp_add", "macro_sql": "{% macro bigquery__timestamp_add(datepart, interval, from_timestamp) %}\n\n        timestamp_add({{ from_timestamp }}, interval  {{ interval }} {{ datepart }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6973472, "supported_languages": null}, "macro.fivetran_utils.redshift__timestamp_add": {"name": "redshift__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.redshift__timestamp_add", "macro_sql": "{% macro redshift__timestamp_add(datepart, interval, from_timestamp) %}\n\n        dateadd(\n        {{ datepart }},\n        {{ interval }},\n        {{ from_timestamp }}\n        )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.697509, "supported_languages": null}, "macro.fivetran_utils.postgres__timestamp_add": {"name": "postgres__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.postgres__timestamp_add", "macro_sql": "{% macro postgres__timestamp_add(datepart, interval, from_timestamp) %}\n\n    {{ from_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.697665, "supported_languages": null}, "macro.fivetran_utils.spark__timestamp_add": {"name": "spark__timestamp_add", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "unique_id": "macro.fivetran_utils.spark__timestamp_add", "macro_sql": "{% macro spark__timestamp_add(datepart, interval, from_timestamp) %}\n\n    {{ dbt.dateadd(datepart, interval, from_timestamp) }}\n        \n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6978428, "supported_languages": null}, "macro.fivetran_utils.ceiling": {"name": "ceiling", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "unique_id": "macro.fivetran_utils.ceiling", "macro_sql": "{% macro ceiling(num) -%}\n\n{{ adapter.dispatch('ceiling', 'fivetran_utils') (num) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__ceiling"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.698095, "supported_languages": null}, "macro.fivetran_utils.default__ceiling": {"name": "default__ceiling", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "unique_id": "macro.fivetran_utils.default__ceiling", "macro_sql": "{% macro default__ceiling(num) %}\n    ceiling({{ num }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6982012, "supported_languages": null}, "macro.fivetran_utils.snowflake__ceiling": {"name": "snowflake__ceiling", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "unique_id": "macro.fivetran_utils.snowflake__ceiling", "macro_sql": "{% macro snowflake__ceiling(num) %}\n    ceil({{ num }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.6983051, "supported_languages": null}, "macro.fivetran_utils.remove_prefix_from_columns": {"name": "remove_prefix_from_columns", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/remove_prefix_from_columns.sql", "original_file_path": "macros/remove_prefix_from_columns.sql", "unique_id": "macro.fivetran_utils.remove_prefix_from_columns", "macro_sql": "{% macro remove_prefix_from_columns(columns, prefix='', exclude=[]) %}\n\n        {%- for col in columns if col.name not in exclude -%}\n        {%- if col.name[:prefix|length]|lower == prefix -%}\n        {{ col.name }} as {{ col.name[prefix|length:] }}\n        {%- else -%}\n        {{ col.name }}\n        {%- endif -%}\n        {%- if not loop.last -%},{%- endif %}\n        {% endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.698943, "supported_languages": null}, "macro.fivetran_utils.fivetran_date_spine": {"name": "fivetran_date_spine", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fivetran_date_spine.sql", "original_file_path": "macros/fivetran_date_spine.sql", "unique_id": "macro.fivetran_utils.fivetran_date_spine", "macro_sql": "{% macro fivetran_date_spine(datepart, start_date, end_date) -%}\n\n{{ return(adapter.dispatch('fivetran_date_spine', 'fivetran_utils') (datepart, start_date, end_date)) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__fivetran_date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.7003222, "supported_languages": null}, "macro.fivetran_utils.default__fivetran_date_spine": {"name": "default__fivetran_date_spine", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fivetran_date_spine.sql", "original_file_path": "macros/fivetran_date_spine.sql", "unique_id": "macro.fivetran_utils.default__fivetran_date_spine", "macro_sql": "{% macro default__fivetran_date_spine(datepart, start_date, end_date) %}\n\n    {{ dbt_utils.date_spine(datepart, start_date, end_date) }}\n        \n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.700504, "supported_languages": null}, "macro.fivetran_utils.sqlserver__fivetran_date_spine": {"name": "sqlserver__fivetran_date_spine", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/fivetran_date_spine.sql", "original_file_path": "macros/fivetran_date_spine.sql", "unique_id": "macro.fivetran_utils.sqlserver__fivetran_date_spine", "macro_sql": "{% macro sqlserver__fivetran_date_spine(datepart, start_date, end_date) -%}\n\n    {% set date_spine_query %}\n        with\n\n        l0 as (\n\n            select c\n            from (select 1 union all select 1) as d(c)\n\n        ),\n        l1 as (\n\n            select\n                1 as c\n            from l0 as a\n            cross join l0 as b\n\n        ),\n\n        l2 as (\n\n            select 1 as c\n            from l1 as a\n            cross join l1 as b\n        ),\n\n        l3 as (\n\n            select 1 as c\n            from l2 as a\n            cross join l2 as b\n        ),\n\n        l4 as (\n\n            select 1 as c\n            from l3 as a\n            cross join l3 as b\n        ),\n\n        l5 as (\n\n            select 1 as c\n            from l4 as a\n            cross join l4 as b\n        ),\n\n        nums as (\n\n            select row_number() over (order by (select null)) as rownum\n            from l5\n        ),\n\n        rawdata as (\n\n            select top ({{dbt.datediff(start_date, end_date, datepart)}}) rownum -1 as n\n            from nums\n            order by rownum\n        ),\n\n        all_periods as (\n\n            select (\n                {{\n                    dbt.dateadd(\n                        datepart,\n                        'n',\n                        start_date\n                    )\n                }}\n            ) as date_{{datepart}}\n            from rawdata\n        ),\n\n        filtered as (\n\n            select *\n            from all_periods\n            where date_{{datepart}} <= {{ end_date }}\n\n        )\n\n        select * from filtered\n        order by 1\n\n    {% endset %}\n\n    {% set results = run_query(date_spine_query) %}\n\n    {% if execute %}\n\n        {% set results_list = results.columns[0].values() %}\n    \n    {% else %}\n\n        {% set results_list = [] %}\n\n    {% endif %}\n\n    {%- for date_field in results_list %}\n        select cast('{{ date_field }}' as date) as date_{{datepart}} {{ 'union all ' if not loop.last else '' }}\n    {% endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt.dateadd", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.7013571, "supported_languages": null}, "macro.fivetran_utils.union_data": {"name": "union_data", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "unique_id": "macro.fivetran_utils.union_data", "macro_sql": "{%- macro union_data(table_identifier, database_variable, schema_variable, default_database, default_schema, default_variable, union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('union_data', 'fivetran_utils') (\n    table_identifier, \n    database_variable, \n    schema_variable, \n    default_database, \n    default_schema, \n    default_variable,\n    union_schema_variable,\n    union_database_variable\n    ) }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.fivetran_utils.default__union_data"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.7050009, "supported_languages": null}, "macro.fivetran_utils.default__union_data": {"name": "default__union_data", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "unique_id": "macro.fivetran_utils.default__union_data", "macro_sql": "{%- macro default__union_data(\n    table_identifier, \n    database_variable, \n    schema_variable, \n    default_database, \n    default_schema, \n    default_variable,\n    union_schema_variable,\n    union_database_variable\n    ) -%}\n\n{%- if var(union_schema_variable, none) -%}\n\n    {%- set relations = [] -%}\n    \n    {%- if var(union_schema_variable) is string -%}\n    {%- set trimmed = var(union_schema_variable)|trim('[')|trim(']') -%}\n    {%- set schemas = trimmed.split(',')|map('trim',\" \")|map('trim','\"')|map('trim',\"'\") -%}\n    {%- else -%}\n    {%- set schemas = var(union_schema_variable) -%}\n    {%- endif -%}\n\n    {%- for schema in var(union_schema_variable) -%}\n    {%- set relation=adapter.get_relation(\n        database=source(schema, table_identifier).database if var('has_defined_sources', false) else var(database_variable, default_database),\n        schema=source(schema, table_identifier).schema if var('has_defined_sources', false) else schema,\n        identifier=source(schema, table_identifier).identifier if var('has_defined_sources', false) else table_identifier\n    ) -%}\n    \n    {%- set relation_exists=relation is not none -%}\n\n    {%- if relation_exists -%}\n        {%- do relations.append(relation) -%}\n    {%- endif -%}\n\n    {%- endfor -%}\n    \n    {%- if relations != [] -%}\n        {{ dbt_utils.union_relations(relations) }}\n    {%- else -%}\n    {% if execute and not var('fivetran__remove_empty_table_warnings', false) -%}\n    {{ exceptions.warn(\"\\n\\nPlease be aware: The \" ~ table_identifier|upper ~ \" table was not found in your \" ~ default_schema|upper ~ \" schema(s). The Fivetran dbt package will create a completely empty \" ~ table_identifier|upper ~ \" staging model as to not break downstream transformations. To turn off these warnings, set the `fivetran__remove_empty_table_warnings` variable to TRUE (see https://github.com/fivetran/dbt_fivetran_utils/tree/releases/v0.4.latest#union_data-source for details).\\n\") }}\n    {% endif -%}\n    select \n        cast(null as {{ dbt.type_string() }}) as _dbt_source_relation\n    limit 0\n    {%- endif -%}\n\n{%- elif var(union_database_variable, none) -%}\n\n    {%- set relations = [] -%}\n\n    {%- for database in var(union_database_variable) -%}\n    {%- set relation=adapter.get_relation(\n        database=source(schema, table_identifier).database if var('has_defined_sources', false) else database,\n        schema=source(schema, table_identifier).schema if var('has_defined_sources', false) else var(schema_variable, default_schema),\n        identifier=source(schema, table_identifier).identifier if var('has_defined_sources', false) else table_identifier\n    ) -%}\n\n    {%- set relation_exists=relation is not none -%}\n\n    {%- if relation_exists -%}\n        {%- do relations.append(relation) -%}\n    {%- endif -%}\n\n    {%- endfor -%}\n\n    {%- if relations != [] -%}\n        {{ dbt_utils.union_relations(relations) }}\n    {%- else -%}\n    {% if execute and not var('fivetran__remove_empty_table_warnings', false) -%}\n    {{ exceptions.warn(\"\\n\\nPlease be aware: The \" ~ table_identifier|upper ~ \" table was not found in your \" ~ default_schema|upper ~ \" schema(s). The Fivetran dbt package will create a completely empty \" ~ table_identifier|upper ~ \" staging model as to not break downstream transformations. To turn off these warnings, set the `fivetran__remove_empty_table_warnings` variable to TRUE (see https://github.com/fivetran/dbt_fivetran_utils/tree/releases/v0.4.latest#union_data-source for details).\\n\") }}\n    {% endif -%}\n    select \n        cast(null as {{ dbt.type_string() }}) as _dbt_source_relation\n    limit 0\n    {%- endif -%}\n\n{%- else -%}\n    {% set exception_schemas = {\"linkedin_company_pages\": \"linkedin_pages\", \"instagram_business_pages\": \"instagram_business\"} %}\n    {% set relation = namespace(value=\"\") %}\n    {% if default_schema in exception_schemas.keys() %}\n        {% for corrected_schema_name in exception_schemas.items() %}   \n            {% if default_schema in corrected_schema_name %}\n                {# In order for this macro to effectively work within upstream integration tests (mainly used by the Fivetran dbt package maintainers), this identifier variable selection is required to use the macro with different identifier names. #}\n                {% set identifier_var = corrected_schema_name[1] + \"_\" + table_identifier + \"_identifier\"  %}\n                {%- set relation.value=adapter.get_relation(\n                    database=source(corrected_schema_name[1], table_identifier).database,\n                    schema=source(corrected_schema_name[1], table_identifier).schema,\n                    identifier=var(identifier_var, table_identifier)\n                ) -%}\n            {% endif %}\n        {% endfor %}\n    {% else %}\n        {# In order for this macro to effectively work within upstream integration tests (mainly used by the Fivetran dbt package maintainers), this identifier variable selection is required to use the macro with different identifier names. #}\n        {% set identifier_var = default_schema + \"_\" + table_identifier + \"_identifier\"  %}\n        {# Unfortunately the Twitter Organic identifiers were misspelled. As such, we will need to account for this in the model. This will be adjusted in the Twitter Organic package, but to ensure backwards compatibility, this needs to be included. #}\n        {% if var(identifier_var, none) is none %} \n            {% set identifier_var = default_schema + \"_\" + table_identifier + \"_identifer\"  %}\n        {% endif %}\n        {%- set relation.value=adapter.get_relation(\n            database=source(default_schema, table_identifier).database,\n            schema=source(default_schema, table_identifier).schema,\n            identifier=var(identifier_var, table_identifier)\n        ) -%}\n    {% endif %}\n{%- set table_exists=relation.value is not none -%}\n\n{%- if table_exists -%}\n    select * \n    from {{ relation.value }}\n{%- else -%}\n    {% if execute and not var('fivetran__remove_empty_table_warnings', false) -%}\n    {{ exceptions.warn(\"\\n\\nPlease be aware: The \" ~ table_identifier|upper ~ \" table was not found in your \" ~ default_schema|upper ~ \" schema(s). The Fivetran dbt package will create a completely empty \" ~ table_identifier|upper ~ \" staging model as to not break downstream transformations. To turn off these warnings, set the `fivetran__remove_empty_table_warnings` variable to TRUE (see https://github.com/fivetran/dbt_fivetran_utils/tree/releases/v0.4.latest#union_data-source for details).\\n\") }}\n    {% endif -%}\n    select \n        cast(null as {{ dbt.type_string() }}) as _dbt_source_relation\n    limit 0\n{%- endif -%}\n{%- endif -%}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_utils.union_relations", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.709742, "supported_languages": null}, "macro.fivetran_utils.dummy_coalesce_value": {"name": "dummy_coalesce_value", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/dummy_coalesce_value.sql", "original_file_path": "macros/dummy_coalesce_value.sql", "unique_id": "macro.fivetran_utils.dummy_coalesce_value", "macro_sql": "{% macro dummy_coalesce_value(column) %}\n\n{% set coalesce_value = {\n 'STRING': \"'DUMMY_STRING'\",\n 'BOOLEAN': 'null',\n 'INT': 999999999,\n 'FLOAT': 999999999.99,\n 'TIMESTAMP': 'cast(\"2099-12-31\" as timestamp)',\n 'DATE': 'cast(\"2099-12-31\" as date)',\n} %}\n\n{% if column.is_float() %}\n{{ return(coalesce_value['FLOAT']) }}\n\n{% elif column.is_numeric() %}\n{{ return(coalesce_value['INT']) }}\n\n{% elif column.is_string() %}\n{{ return(coalesce_value['STRING']) }}\n\n{% elif column.data_type|lower == 'boolean' %}\n{{ return(coalesce_value['BOOLEAN']) }}\n\n{% elif 'timestamp' in column.data_type|lower %}\n{{ return(coalesce_value['TIMESTAMP']) }}\n\n{% elif 'date' in column.data_type|lower %}\n{{ return(coalesce_value['DATE']) }}\n\n{% elif 'int' in column.data_type|lower %}\n{{ return(coalesce_value['INT']) }}\n\n{% endif %}\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.7111921, "supported_languages": null}, "macro.fivetran_utils.extract_url_parameter": {"name": "extract_url_parameter", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/extract_url_parameter.sql", "original_file_path": "macros/extract_url_parameter.sql", "unique_id": "macro.fivetran_utils.extract_url_parameter", "macro_sql": "{% macro extract_url_parameter(field, url_parameter) -%}\n\n{{ adapter.dispatch('extract_url_parameter', 'fivetran_utils') (field, url_parameter) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__extract_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.711541, "supported_languages": null}, "macro.fivetran_utils.default__extract_url_parameter": {"name": "default__extract_url_parameter", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/extract_url_parameter.sql", "original_file_path": "macros/extract_url_parameter.sql", "unique_id": "macro.fivetran_utils.default__extract_url_parameter", "macro_sql": "{% macro default__extract_url_parameter(field, url_parameter) -%}\n\n{{ dbt_utils.get_url_parameter(field, url_parameter) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.711696, "supported_languages": null}, "macro.fivetran_utils.spark__extract_url_parameter": {"name": "spark__extract_url_parameter", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/extract_url_parameter.sql", "original_file_path": "macros/extract_url_parameter.sql", "unique_id": "macro.fivetran_utils.spark__extract_url_parameter", "macro_sql": "{% macro spark__extract_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"=([^&]+)'\" -%}\nnullif(regexp_extract({{ field }}, {{ formatted_url_parameter }}, 1), '')\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.7118988, "supported_languages": null}, "macro.fivetran_utils.wrap_in_quotes": {"name": "wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.wrap_in_quotes", "macro_sql": "{%- macro wrap_in_quotes(object_to_quote) -%}\n\n{{ return(adapter.dispatch('wrap_in_quotes', 'fivetran_utils')(object_to_quote)) }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.fivetran_utils.default__wrap_in_quotes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.712246, "supported_languages": null}, "macro.fivetran_utils.default__wrap_in_quotes": {"name": "default__wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.default__wrap_in_quotes", "macro_sql": "{%- macro default__wrap_in_quotes(object_to_quote)  -%}\n{# bigquery, spark, databricks #}\n    `{{ object_to_quote }}`\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.7123609, "supported_languages": null}, "macro.fivetran_utils.snowflake__wrap_in_quotes": {"name": "snowflake__wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.snowflake__wrap_in_quotes", "macro_sql": "{%- macro snowflake__wrap_in_quotes(object_to_quote)  -%}\n    \"{{ object_to_quote | upper }}\"\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.712477, "supported_languages": null}, "macro.fivetran_utils.redshift__wrap_in_quotes": {"name": "redshift__wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.redshift__wrap_in_quotes", "macro_sql": "{%- macro redshift__wrap_in_quotes(object_to_quote)  -%}\n    \"{{ object_to_quote }}\"\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.712578, "supported_languages": null}, "macro.fivetran_utils.postgres__wrap_in_quotes": {"name": "postgres__wrap_in_quotes", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/wrap_in_quotes.sql", "original_file_path": "macros/wrap_in_quotes.sql", "unique_id": "macro.fivetran_utils.postgres__wrap_in_quotes", "macro_sql": "{%- macro postgres__wrap_in_quotes(object_to_quote)  -%}\n    \"{{ object_to_quote }}\"\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.712681, "supported_languages": null}, "macro.fivetran_utils.array_agg": {"name": "array_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "unique_id": "macro.fivetran_utils.array_agg", "macro_sql": "{% macro array_agg(field_to_agg) -%}\n\n{{ adapter.dispatch('array_agg', 'fivetran_utils') (field_to_agg) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.fivetran_utils.default__array_agg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.7129421, "supported_languages": null}, "macro.fivetran_utils.default__array_agg": {"name": "default__array_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "unique_id": "macro.fivetran_utils.default__array_agg", "macro_sql": "{% macro default__array_agg(field_to_agg) %}\n    array_agg({{ field_to_agg }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.7130492, "supported_languages": null}, "macro.fivetran_utils.redshift__array_agg": {"name": "redshift__array_agg", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "unique_id": "macro.fivetran_utils.redshift__array_agg", "macro_sql": "{% macro redshift__array_agg(field_to_agg) %}\n    listagg({{ field_to_agg }}, ',')\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.713152, "supported_languages": null}, "macro.fivetran_utils.empty_variable_warning": {"name": "empty_variable_warning", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/empty_variable_warning.sql", "original_file_path": "macros/empty_variable_warning.sql", "unique_id": "macro.fivetran_utils.empty_variable_warning", "macro_sql": "{% macro empty_variable_warning(variable, downstream_model) %}\n\n{% if not var(variable) %}\n{{ log(\n    \"\"\"\n    Warning: You have passed an empty list to the \"\"\" ~ variable ~ \"\"\".\n    As a result, you won't see the history of any columns in the \"\"\" ~ downstream_model ~ \"\"\" model.\n    \"\"\",\n    info=True\n) }}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.713553, "supported_languages": null}, "macro.fivetran_utils.enabled_vars_one_true": {"name": "enabled_vars_one_true", "resource_type": "macro", "package_name": "fivetran_utils", "path": "macros/enabled_vars_one_true.sql", "original_file_path": "macros/enabled_vars_one_true.sql", "unique_id": "macro.fivetran_utils.enabled_vars_one_true", "macro_sql": "{% macro enabled_vars_one_true(vars) %}\n\n{% for v in vars %}\n    \n    {% if var(v, False) == True %}\n    {{ return(True) }}\n    {% endif %}\n\n{% endfor %}\n\n{{ return(False) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.713949, "supported_languages": null}, "macro.fivetran_log.get_log_columns": {"name": "get_log_columns", "resource_type": "macro", "package_name": "fivetran_log", "path": "macros/get_log_columns.sql", "original_file_path": "macros/get_log_columns.sql", "unique_id": "macro.fivetran_log.get_log_columns", "macro_sql": "{% macro get_log_columns() %}\n\n{% set columns = [\n    {\"name\": \"_fivetran_synced\", \"datatype\": dbt.type_timestamp()},\n    {\"name\": \"connector_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"event\", \"datatype\": dbt.type_string()},\n    {\"name\": \"id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"message_data\", \"datatype\": dbt.type_string()},\n    {\"name\": \"message_event\", \"datatype\": dbt.type_string()},\n    {\"name\": \"sync_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"time_stamp\", \"datatype\": dbt.type_timestamp()},\n    {\"name\": \"transformation_id\", \"datatype\": dbt.type_string()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.715096, "supported_languages": null}, "macro.fivetran_log.does_table_exist": {"name": "does_table_exist", "resource_type": "macro", "package_name": "fivetran_log", "path": "macros/does_table_exist.sql", "original_file_path": "macros/does_table_exist.sql", "unique_id": "macro.fivetran_log.does_table_exist", "macro_sql": "{%- macro does_table_exist(table_name) -%}\n    {%- if execute -%} -- returns true when dbt is in execute mode\n    {%- set ns = namespace(has_table=false) -%} -- declare boolean namespace and default value \n        {%- for node in graph.sources.values() -%} -- grab sources from the dictionary of nodes \n        -- call the database for the matching table\n            {%- if node.name | lower == table_name | lower -%} \n                {%- set source_relation = adapter.get_relation(\n                        database=node.database,\n                        schema=node.schema,\n                        identifier=node.identifier ) -%} \n            {% endif %}\n            {%- if source_relation == None -%} \n                {{ return(False) }} -- return false if relation identified by the database.schema.identifier does not exist for the given table name\n            {% endif %}\n        {%- endfor -%}\n        {{ return(True) }}\n    {%- endif -%} \n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.716056, "supported_languages": null}, "macro.fivetran_log.get_connector_columns": {"name": "get_connector_columns", "resource_type": "macro", "package_name": "fivetran_log", "path": "macros/get_brand_columns.sql", "original_file_path": "macros/get_brand_columns.sql", "unique_id": "macro.fivetran_log.get_connector_columns", "macro_sql": "{% macro get_connector_columns() %}\n\n{% set columns = [\n    {\"name\": \"_fivetran_deleted\", \"datatype\": dbt.type_boolean()},\n    {\"name\": \"_fivetran_synced\", \"datatype\": dbt.type_timestamp()},\n    {\"name\": \"connecting_user_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"connector_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"connector_name\", \"datatype\": dbt.type_string()},\n    {\"name\": \"connector_type\", \"datatype\": dbt.type_string()},\n    {\"name\": \"connector_type_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"destination_id\", \"datatype\": dbt.type_string()},\n    {\"name\": \"paused\", \"datatype\": dbt.type_boolean()},\n    {\"name\": \"service_version\", \"datatype\": dbt.type_int()},\n    {\"name\": \"signed_up\", \"datatype\": dbt.type_timestamp()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_boolean", "macro.dbt.type_timestamp", "macro.dbt.type_string", "macro.dbt.type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1702500738.71735, "supported_languages": null}}, "docs": {"doc.dbt.__overview__": {"name": "__overview__", "resource_type": "doc", "package_name": "dbt", "path": "overview.md", "original_file_path": "docs/overview.md", "unique_id": "doc.dbt.__overview__", "block_contents": "### Welcome!\n\nWelcome to the auto-generated documentation for your dbt project!\n\n### Navigation\n\nYou can use the `Project` and `Database` navigation tabs on the left side of the window to explore the models\nin your project.\n\n#### Project Tab\nThe `Project` tab mirrors the directory structure of your dbt project. In this tab, you can see all of the\nmodels defined in your dbt project, as well as models imported from dbt packages.\n\n#### Database Tab\nThe `Database` tab also exposes your models, but in a format that looks more like a database explorer. This view\nshows relations (tables and views) grouped into database schemas. Note that ephemeral models are _not_ shown\nin this interface, as they do not exist in the database.\n\n### Graph Exploration\nYou can click the blue icon on the bottom-right corner of the page to view the lineage graph of your models.\n\nOn model pages, you'll see the immediate parents and children of the model you're exploring. By clicking the `Expand`\nbutton at the top-right of this lineage pane, you'll be able to see all of the models that are used to build,\nor are built from, the model you're exploring.\n\nOnce expanded, you'll be able to use the `--select` and `--exclude` model selection syntax to filter the\nmodels in the graph. For more information on model selection, check out the [dbt docs](https://docs.getdbt.com/docs/model-selection-syntax).\n\nNote that you can also right-click on models to interactively filter and explore the graph.\n\n---\n\n### More information\n\n- [What is dbt](https://docs.getdbt.com/docs/introduction)?\n- Read the [dbt viewpoint](https://docs.getdbt.com/docs/viewpoint)\n- [Installation](https://docs.getdbt.com/docs/installation)\n- Join the [dbt Community](https://www.getdbt.com/community/) for questions and discussion"}}, "exposures": {}, "metrics": {}, "groups": {}, "selectors": {}, "disabled": {}, "parent_map": {"seed.fivetran_log_integration_tests.log": [], "seed.fivetran_log_integration_tests.destination_membership": [], "seed.fivetran_log_integration_tests.credits_used": [], "seed.fivetran_log_integration_tests.destination": [], "seed.fivetran_log_integration_tests.connector": [], "seed.fivetran_log_integration_tests.user": [], "seed.fivetran_log_integration_tests.account": [], "seed.fivetran_log_integration_tests.usage_cost": [], "seed.fivetran_log_integration_tests.incremental_mar": [], "model.fivetran_log.fivetran_platform__schema_changelog": ["model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.stg_fivetran_platform__log"], "model.fivetran_log.fivetran_platform__connector_daily_events": ["model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.stg_fivetran_platform__log", "source.fivetran_log.fivetran_platform.connector"], "model.fivetran_log.fivetran_platform__audit_user_activity": ["model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination", "model.fivetran_log.stg_fivetran_platform__destination_membership", "model.fivetran_log.stg_fivetran_platform__log", "model.fivetran_log.stg_fivetran_platform__user"], "model.fivetran_log.fivetran_platform__connector_status": ["model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination", "model.fivetran_log.stg_fivetran_platform__log"], "model.fivetran_log.fivetran_platform__usage_mar_destination_history": ["model.fivetran_log.fivetran_platform__mar_table_history", "model.fivetran_log.stg_fivetran_platform__credits_used", "model.fivetran_log.stg_fivetran_platform__usage_cost"], "model.fivetran_log.fivetran_platform__audit_table": ["model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.stg_fivetran_platform__log"], "model.fivetran_log.fivetran_platform__mar_table_history": ["model.fivetran_log.stg_fivetran_platform__connector", "model.fivetran_log.stg_fivetran_platform__destination", "model.fivetran_log.stg_fivetran_platform__incremental_mar"], "model.fivetran_log.stg_fivetran_platform__user": ["source.fivetran_log.fivetran_platform.user"], "model.fivetran_log.stg_fivetran_platform__destination_membership": ["source.fivetran_log.fivetran_platform.destination_membership"], "model.fivetran_log.stg_fivetran_platform__credits_used": [], "model.fivetran_log.stg_fivetran_platform__usage_cost": [], "model.fivetran_log.stg_fivetran_platform__destination": ["source.fivetran_log.fivetran_platform.destination"], "model.fivetran_log.stg_fivetran_platform__log": ["model.fivetran_log.stg_fivetran_platform__log_tmp"], "model.fivetran_log.stg_fivetran_platform__incremental_mar": ["source.fivetran_log.fivetran_platform.incremental_mar"], "model.fivetran_log.stg_fivetran_platform__connector": ["model.fivetran_log.stg_fivetran_platform__connector_tmp"], "model.fivetran_log.stg_fivetran_platform__account": ["source.fivetran_log.fivetran_platform.account"], "model.fivetran_log.stg_fivetran_platform__connector_tmp": ["source.fivetran_log.fivetran_platform.connector"], "model.fivetran_log.stg_fivetran_platform__log_tmp": ["source.fivetran_log.fivetran_platform.log"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89": ["model.fivetran_log.fivetran_platform__connector_status"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441": ["model.fivetran_log.fivetran_platform__mar_table_history"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f": ["model.fivetran_log.fivetran_platform__connector_daily_events"], "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7": ["model.fivetran_log.fivetran_platform__audit_table"], "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af": ["model.fivetran_log.fivetran_platform__audit_table"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493": ["model.fivetran_log.fivetran_platform__schema_changelog"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at.be572689a3": ["model.fivetran_log.fivetran_platform__audit_user_activity"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a": ["model.fivetran_log.stg_fivetran_platform__connector"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38": ["model.fivetran_log.stg_fivetran_platform__credits_used"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f": ["model.fivetran_log.stg_fivetran_platform__usage_cost"], "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed": ["model.fivetran_log.stg_fivetran_platform__destination"], "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780": ["model.fivetran_log.stg_fivetran_platform__destination"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d": ["model.fivetran_log.stg_fivetran_platform__log"], "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc": ["model.fivetran_log.stg_fivetran_platform__account"], "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e": ["model.fivetran_log.stg_fivetran_platform__account"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a": ["model.fivetran_log.stg_fivetran_platform__destination_membership"], "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9": ["model.fivetran_log.stg_fivetran_platform__user"], "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0": ["model.fivetran_log.stg_fivetran_platform__user"], "source.fivetran_log.fivetran_platform.incremental_mar": [], "source.fivetran_log.fivetran_platform.connector": [], "source.fivetran_log.fivetran_platform.credits_used": [], "source.fivetran_log.fivetran_platform.usage_cost": [], "source.fivetran_log.fivetran_platform.destination": [], "source.fivetran_log.fivetran_platform.log": [], "source.fivetran_log.fivetran_platform.account": [], "source.fivetran_log.fivetran_platform.destination_membership": [], "source.fivetran_log.fivetran_platform.user": []}, "child_map": {"seed.fivetran_log_integration_tests.log": [], "seed.fivetran_log_integration_tests.destination_membership": [], "seed.fivetran_log_integration_tests.credits_used": [], "seed.fivetran_log_integration_tests.destination": [], "seed.fivetran_log_integration_tests.connector": [], "seed.fivetran_log_integration_tests.user": [], "seed.fivetran_log_integration_tests.account": [], "seed.fivetran_log_integration_tests.usage_cost": [], "seed.fivetran_log_integration_tests.incremental_mar": [], "model.fivetran_log.fivetran_platform__schema_changelog": ["test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493"], "model.fivetran_log.fivetran_platform__connector_daily_events": ["test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f"], "model.fivetran_log.fivetran_platform__audit_user_activity": ["test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at.be572689a3"], "model.fivetran_log.fivetran_platform__connector_status": ["model.fivetran_log.fivetran_platform__audit_table", "model.fivetran_log.fivetran_platform__connector_daily_events", "model.fivetran_log.fivetran_platform__schema_changelog", "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89"], "model.fivetran_log.fivetran_platform__usage_mar_destination_history": ["test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd"], "model.fivetran_log.fivetran_platform__audit_table": ["test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af", "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7"], "model.fivetran_log.fivetran_platform__mar_table_history": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history", "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441"], "model.fivetran_log.stg_fivetran_platform__user": ["model.fivetran_log.fivetran_platform__audit_user_activity", "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0", "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9"], "model.fivetran_log.stg_fivetran_platform__destination_membership": ["model.fivetran_log.fivetran_platform__audit_user_activity", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a"], "model.fivetran_log.stg_fivetran_platform__credits_used": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38"], "model.fivetran_log.stg_fivetran_platform__usage_cost": ["model.fivetran_log.fivetran_platform__usage_mar_destination_history", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f"], "model.fivetran_log.stg_fivetran_platform__destination": ["model.fivetran_log.fivetran_platform__audit_user_activity", "model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.fivetran_platform__mar_table_history", "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780", "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed"], "model.fivetran_log.stg_fivetran_platform__log": ["model.fivetran_log.fivetran_platform__audit_table", "model.fivetran_log.fivetran_platform__audit_user_activity", "model.fivetran_log.fivetran_platform__connector_daily_events", "model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.fivetran_platform__schema_changelog", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d"], "model.fivetran_log.stg_fivetran_platform__incremental_mar": ["model.fivetran_log.fivetran_platform__mar_table_history"], "model.fivetran_log.stg_fivetran_platform__connector": ["model.fivetran_log.fivetran_platform__audit_user_activity", "model.fivetran_log.fivetran_platform__connector_status", "model.fivetran_log.fivetran_platform__mar_table_history", "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a"], "model.fivetran_log.stg_fivetran_platform__account": ["test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e", "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc"], "model.fivetran_log.stg_fivetran_platform__connector_tmp": ["model.fivetran_log.stg_fivetran_platform__connector"], "model.fivetran_log.stg_fivetran_platform__log_tmp": ["model.fivetran_log.stg_fivetran_platform__log"], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f": [], "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7": [], "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at.be572689a3": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f": [], "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed": [], "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d": [], "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc": [], "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e": [], "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a": [], "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9": [], "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0": [], "source.fivetran_log.fivetran_platform.incremental_mar": ["model.fivetran_log.stg_fivetran_platform__incremental_mar"], "source.fivetran_log.fivetran_platform.connector": ["model.fivetran_log.fivetran_platform__connector_daily_events", "model.fivetran_log.stg_fivetran_platform__connector_tmp"], "source.fivetran_log.fivetran_platform.credits_used": [], "source.fivetran_log.fivetran_platform.usage_cost": [], "source.fivetran_log.fivetran_platform.destination": ["model.fivetran_log.stg_fivetran_platform__destination"], "source.fivetran_log.fivetran_platform.log": ["model.fivetran_log.stg_fivetran_platform__log_tmp"], "source.fivetran_log.fivetran_platform.account": ["model.fivetran_log.stg_fivetran_platform__account"], "source.fivetran_log.fivetran_platform.destination_membership": ["model.fivetran_log.stg_fivetran_platform__destination_membership"], "source.fivetran_log.fivetran_platform.user": ["model.fivetran_log.stg_fivetran_platform__user"]}, "group_map": {}, "saved_queries": {}, "semantic_models": {}}
\ No newline at end of file
diff --git a/docs/run_results.json b/docs/run_results.json
index eca4082b..4e85f128 100644
--- a/docs/run_results.json
+++ b/docs/run_results.json
@@ -1 +1 @@
-{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v5.json", "dbt_version": "1.7.3", "generated_at": "2023-12-12T19:08:32.891443Z", "invocation_id": "c0fa594b-cab7-478a-aeb0-a325788070ef", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.583275Z", "completed_at": "2023-12-12T19:08:29.596288Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.597120Z", "completed_at": "2023-12-12T19:08:29.597133Z"}], "thread_id": "Thread-1", "execution_time": 0.016467809677124023, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__account", "compiled": true, "compiled_code": "with base as (\n    \n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.account\n),\n\nfields as (\n\n    select\n        id as account_id,\n        country,\n        cast(created_at as timestamp) as created_at,\n        name as account_name,\n        status\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__account"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.599824Z", "completed_at": "2023-12-12T19:08:29.604343Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.605132Z", "completed_at": "2023-12-12T19:08:29.605138Z"}], "thread_id": "Thread-1", "execution_time": 0.0069370269775390625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__connector_tmp", "compiled": true, "compiled_code": "select *\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.connector", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.607589Z", "completed_at": "2023-12-12T19:08:29.615707Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.616388Z", "completed_at": "2023-12-12T19:08:29.616395Z"}], "thread_id": "Thread-1", "execution_time": 0.010297775268554688, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__credits_used", "compiled": true, "compiled_code": "\n\nwith base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.credits_used\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        credits_consumed as credits_spent\n    from base\n)\n\nselect * \nfrom fields\n\n", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__credits_used"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.618679Z", "completed_at": "2023-12-12T19:08:29.622466Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.623073Z", "completed_at": "2023-12-12T19:08:29.623078Z"}], "thread_id": "Thread-1", "execution_time": 0.005653858184814453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__destination", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.destination\n),\n\nfields as (\n\n    select\n        id as destination_id,\n        account_id,\n        cast(created_at as timestamp) as created_at,\n        name as destination_name,\n        region\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.625052Z", "completed_at": "2023-12-12T19:08:29.629175Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.629747Z", "completed_at": "2023-12-12T19:08:29.629751Z"}], "thread_id": "Thread-1", "execution_time": 0.005950212478637695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__destination_membership", "compiled": true, "compiled_code": "\n\nwith base as (\n    \n    select * from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.destination_membership\n),\n\nfields as (\n\n    select\n        destination_id,\n        user_id,\n        cast(activated_at as timestamp) as activated_at,\n        cast(joined_at as timestamp) as joined_at,\n        role as destination_role\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination_membership"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.631597Z", "completed_at": "2023-12-12T19:08:29.635190Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.635757Z", "completed_at": "2023-12-12T19:08:29.635762Z"}], "thread_id": "Thread-1", "execution_time": 0.005378007888793945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__incremental_mar", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.incremental_mar\n),\n\nfields as (\n\n    select\n        connector_id as connector_name,\n        destination_id,\n        free_type,\n        cast(measured_date as timestamp) as measured_date,\n        schema_name,\n        sync_type,\n        table_name,\n        updated_at,\n        _fivetran_synced,\n        incremental_rows\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__incremental_mar"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.637571Z", "completed_at": "2023-12-12T19:08:29.640593Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.641133Z", "completed_at": "2023-12-12T19:08:29.641139Z"}], "thread_id": "Thread-1", "execution_time": 0.004690885543823242, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__log_tmp", "compiled": true, "compiled_code": "select *\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.log", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.642917Z", "completed_at": "2023-12-12T19:08:29.647520Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.648054Z", "completed_at": "2023-12-12T19:08:29.648059Z"}], "thread_id": "Thread-1", "execution_time": 0.006251096725463867, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__usage_cost", "compiled": true, "compiled_code": "\nwith base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.usage_cost\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        amount as dollars_spent\n    from base\n)\n\nselect * \nfrom fields\n\n", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__usage_cost"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.649748Z", "completed_at": "2023-12-12T19:08:29.653285Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.653815Z", "completed_at": "2023-12-12T19:08:29.653820Z"}], "thread_id": "Thread-1", "execution_time": 0.00515294075012207, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__user", "compiled": true, "compiled_code": "\n\nwith base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.user\n),\n\nfields as (\n\n    select\n        id as user_id,\n        cast(created_at as timestamp) as created_at,\n        email,\n        email_disabled as has_disabled_email_notifications,\n        family_name as last_name,\n        given_name as first_name,\n        phone,\n        verified as is_verified\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__user"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.655632Z", "completed_at": "2023-12-12T19:08:29.657197Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.657937Z", "completed_at": "2023-12-12T19:08:29.657946Z"}], "thread_id": "Thread-1", "execution_time": 0.0037610530853271484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.account", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.659975Z", "completed_at": "2023-12-12T19:08:29.661369Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.661999Z", "completed_at": "2023-12-12T19:08:29.662005Z"}], "thread_id": "Thread-1", "execution_time": 0.003264904022216797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.connector", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.663981Z", "completed_at": "2023-12-12T19:08:29.665987Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.666537Z", "completed_at": "2023-12-12T19:08:29.666542Z"}], "thread_id": "Thread-1", "execution_time": 0.0037810802459716797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.credits_used", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.668142Z", "completed_at": "2023-12-12T19:08:29.669323Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.669837Z", "completed_at": "2023-12-12T19:08:29.669841Z"}], "thread_id": "Thread-1", "execution_time": 0.0027382373809814453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.destination", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.671560Z", "completed_at": "2023-12-12T19:08:29.672852Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.673431Z", "completed_at": "2023-12-12T19:08:29.673435Z"}], "thread_id": "Thread-1", "execution_time": 0.0030248165130615234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.destination_membership", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.675410Z", "completed_at": "2023-12-12T19:08:29.676786Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.677317Z", "completed_at": "2023-12-12T19:08:29.677322Z"}], "thread_id": "Thread-1", "execution_time": 0.0032188892364501953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.incremental_mar", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.678940Z", "completed_at": "2023-12-12T19:08:29.680184Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.680661Z", "completed_at": "2023-12-12T19:08:29.680665Z"}], "thread_id": "Thread-1", "execution_time": 0.00272369384765625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.log", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.682192Z", "completed_at": "2023-12-12T19:08:29.684052Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.684555Z", "completed_at": "2023-12-12T19:08:29.684561Z"}], "thread_id": "Thread-1", "execution_time": 0.0034568309783935547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.usage_cost", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.686240Z", "completed_at": "2023-12-12T19:08:29.687484Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.688000Z", "completed_at": "2023-12-12T19:08:29.688004Z"}], "thread_id": "Thread-1", "execution_time": 0.002780914306640625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.user", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.689570Z", "completed_at": "2023-12-12T19:08:29.697474Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.697983Z", "completed_at": "2023-12-12T19:08:29.697987Z"}], "thread_id": "Thread-1", "execution_time": 0.009428024291992188, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect account_id\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__account\nwhere account_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.699648Z", "completed_at": "2023-12-12T19:08:29.703938Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:29.704438Z", "completed_at": "2023-12-12T19:08:29.704442Z"}], "thread_id": "Thread-1", "execution_time": 0.00582122802734375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc", "compiled": true, "compiled_code": "\n    \n    \n\nselect\n    account_id as unique_field,\n    count(*) as n_records\n\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__account\nwhere account_id is not null\ngroup by account_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:29.706035Z", "completed_at": "2023-12-12T19:08:30.181914Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:30.182785Z", "completed_at": "2023-12-12T19:08:30.182793Z"}], "thread_id": "Thread-1", "execution_time": 0.5884549617767334, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__connector", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector_tmp\n),\n\nfields as (\n    select\n        \n    cast(null as boolean) as \n    \n    _fivetran_deleted\n    \n , \n    \n    \n    _fivetran_synced\n    \n as \n    \n    _fivetran_synced\n    \n, \n    \n    \n    connecting_user_id\n    \n as \n    \n    connecting_user_id\n    \n, \n    \n    \n    connector_id\n    \n as \n    \n    connector_id\n    \n, \n    \n    \n    connector_name\n    \n as \n    \n    connector_name\n    \n, \n    \n    \n    connector_type\n    \n as \n    \n    connector_type\n    \n, \n    cast(null as TEXT) as \n    \n    connector_type_id\n    \n , \n    \n    \n    destination_id\n    \n as \n    \n    destination_id\n    \n, \n    \n    \n    paused\n    \n as \n    \n    paused\n    \n, \n    cast(null as integer) as \n    \n    service_version\n    \n , \n    \n    \n    signed_up\n    \n as \n    \n    signed_up\n    \n\n\n\n        ,row_number() over ( partition by connector_name, destination_id order by _fivetran_synced desc ) as nth_last_record\n    from base\n),\n\nfinal as (\n\n    select \n        connector_id,\n        connector_name,\n        coalesce(connector_type_id, connector_type) as connector_type,\n        destination_id,\n        connecting_user_id,\n        paused as is_paused,\n        signed_up as set_up_at\n    from fields\n\n    -- Only look at the most recent one\n    where nth_last_record = 1\n)\n\nselect * \nfrom final", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:30.297083Z", "completed_at": "2023-12-12T19:08:30.309610Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:30.310462Z", "completed_at": "2023-12-12T19:08:30.310469Z"}], "thread_id": "Thread-1", "execution_time": 0.01565098762512207, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        measured_month, destination_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__credits_used\n    group by measured_month, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:30.313185Z", "completed_at": "2023-12-12T19:08:30.318491Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:30.319211Z", "completed_at": "2023-12-12T19:08:30.319216Z"}], "thread_id": "Thread-1", "execution_time": 0.007678031921386719, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect destination_id\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\nwhere destination_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:30.321551Z", "completed_at": "2023-12-12T19:08:30.325638Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:30.326315Z", "completed_at": "2023-12-12T19:08:30.326321Z"}], "thread_id": "Thread-1", "execution_time": 0.006234884262084961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed", "compiled": true, "compiled_code": "\n    \n    \n\nselect\n    destination_id as unique_field,\n    count(*) as n_records\n\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\nwhere destination_id is not null\ngroup by destination_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:30.328476Z", "completed_at": "2023-12-12T19:08:30.332995Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:30.333612Z", "completed_at": "2023-12-12T19:08:30.333617Z"}], "thread_id": "Thread-1", "execution_time": 0.006437778472900391, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        destination_id, user_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination_membership\n    group by destination_id, user_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:30.335526Z", "completed_at": "2023-12-12T19:08:30.852282Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:30.853331Z", "completed_at": "2023-12-12T19:08:30.853348Z"}], "thread_id": "Thread-1", "execution_time": 0.6241931915283203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__log", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log_tmp\n),\n\nfields as (\n    select\n        \n    \n    \n    _fivetran_synced\n    \n as \n    \n    _fivetran_synced\n    \n, \n    \n    \n    connector_id\n    \n as \n    \n    connector_id\n    \n, \n    \n    \n    event\n    \n as \n    \n    event\n    \n, \n    \n    \n    id\n    \n as \n    \n    id\n    \n, \n    \n    \n    message_data\n    \n as \n    \n    message_data\n    \n, \n    \n    \n    message_event\n    \n as \n    \n    message_event\n    \n, \n    \n    \n    sync_id\n    \n as \n    \n    sync_id\n    \n, \n    \n    \n    time_stamp\n    \n as \n    \n    time_stamp\n    \n, \n    \n    \n    transformation_id\n    \n as \n    \n    transformation_id\n    \n\n\n\n    from base\n),\n\nfinal as (\n\n    select\n        id as log_id, \n        sync_id,\n        cast(time_stamp as timestamp) as created_at,\n        connector_id, -- Note: the connector_id column used to erroneously equal the connector_name, NOT its id.\n        case when transformation_id is not null and event is null then 'TRANSFORMATION'\n        else event end as event_type, \n        message_data,\n        case \n        when transformation_id is not null and message_data like '%has succeeded%' then 'transformation run success'\n        when transformation_id is not null and message_data like '%has failed%' then 'transformation run failed'\n        else message_event end as event_subtype,\n        transformation_id\n    from fields\n)\n\nselect * \nfrom final", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:30.963549Z", "completed_at": "2023-12-12T19:08:30.972244Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:30.973344Z", "completed_at": "2023-12-12T19:08:30.973353Z"}], "thread_id": "Thread-1", "execution_time": 0.012953042984008789, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        measured_month, destination_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__usage_cost\n    group by measured_month, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:30.976632Z", "completed_at": "2023-12-12T19:08:30.982543Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:30.983388Z", "completed_at": "2023-12-12T19:08:30.983394Z"}], "thread_id": "Thread-1", "execution_time": 0.008631229400634766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect user_id\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__user\nwhere user_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:30.985990Z", "completed_at": "2023-12-12T19:08:30.990905Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:30.991611Z", "completed_at": "2023-12-12T19:08:30.991617Z"}], "thread_id": "Thread-1", "execution_time": 0.0071811676025390625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9", "compiled": true, "compiled_code": "\n    \n    \n\nselect\n    user_id as unique_field,\n    count(*) as n_records\n\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__user\nwhere user_id is not null\ngroup by user_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:30.993932Z", "completed_at": "2023-12-12T19:08:31.000774Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:31.001429Z", "completed_at": "2023-12-12T19:08:31.001435Z"}], "thread_id": "Thread-1", "execution_time": 0.008944988250732422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__mar_table_history", "compiled": true, "compiled_code": "with incremental_mar as (\n\n    select\n        *,\n        date_trunc('month', measured_date) as measured_month\n\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__incremental_mar\n),\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector\n),\n\ndestination as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\n),\n\nordered_mar as (\n\n    select\n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        max(measured_date) as last_measured_at,\n        sum(incremental_rows) as incremental_rows,\n        sum(coalesce(case when lower(free_type) = 'paid'\n            then incremental_rows\n        end, 0)) as paid_monthly_active_rows,\n        sum(coalesce(case when lower(free_type) != 'paid'\n            then incremental_rows\n        end, 0)) as free_monthly_active_rows\n\n    from incremental_mar\n    group by connector_name, schema_name, table_name, destination_id, measured_month\n),\n\nlatest_mar as (\n    select \n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        cast(last_measured_at as date) as last_measured_at,\n        free_monthly_active_rows,\n        paid_monthly_active_rows,\n        (free_monthly_active_rows + paid_monthly_active_rows) as total_monthly_active_rows\n\n    from ordered_mar\n),\n\nmar_join as (\n\n    select\n        latest_mar.*,\n        connector.connector_type,\n        connector.connector_id,\n        destination.destination_name\n\n    from latest_mar\n    join connector\n        on latest_mar.connector_name = connector.connector_name\n        and latest_mar.destination_id = connector.destination_id\n    join destination on latest_mar.destination_id = destination.destination_id\n)\n\nselect * from mar_join\n -- can't order CTEs in sqlserver\norder by measured_month desc, destination_id, connector_name\n", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__mar_table_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:31.003631Z", "completed_at": "2023-12-12T19:08:31.008119Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:31.008761Z", "completed_at": "2023-12-12T19:08:31.008766Z"}], "thread_id": "Thread-1", "execution_time": 0.0064868927001953125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_name, destination_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector\n    group by connector_name, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:31.010675Z", "completed_at": "2023-12-12T19:08:31.022245Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:31.022815Z", "completed_at": "2023-12-12T19:08:31.022820Z"}], "thread_id": "Thread-1", "execution_time": 0.01335287094116211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__audit_user_activity", "compiled": true, "compiled_code": "with logs as (\n\n    select \n        *,\n        \n\n  parse_json( message_data )['actor'] as actor_email\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n),\n\nuser_logs as (\n\n    select *\n    from logs\n    where actor_email is not null \n        and lower(actor_email) != 'fivetran'\n),\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector\n),\n\ndestination as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\n),\nusers as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__user\n),\n    destination_membership as (\n\n        select *\n        from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination_membership\n    ),\n    final as (\n\n    select\n        date_trunc('day', user_logs.created_at) as date_day,\n        \n        dayname(user_logs.created_at) as day_name,\n            date_part('day', user_logs.created_at) as day_of_month,\n        user_logs.created_at as occurred_at,\n        destination.destination_name,\n        destination.destination_id,\n        connector.connector_name,\n        connector.connector_id,\n        user_logs.actor_email as email,\n        users.first_name,\n        users.last_name,\n        users.user_id,\n        destination_membership.destination_role,\n    user_logs.event_type, -- should always be INFO for user-triggered actions but include just in case\n        user_logs.event_subtype,\n        user_logs.message_data,\n        user_logs.log_id\n\n    from user_logs\n    left join connector\n        on user_logs.connector_id = connector.connector_id\n    left join destination\n        on connector.destination_id = destination.destination_id\n    left join users \n        on lower(users.email) = lower(user_logs.actor_email)\n    left join destination_membership\n        on destination.destination_id = destination_membership.destination_id\n        and users.user_id = destination_membership.user_id\n\n    )\n\nselect *\nfrom final", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_user_activity"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:31.024698Z", "completed_at": "2023-12-12T19:08:31.037061Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:31.037576Z", "completed_at": "2023-12-12T19:08:31.037581Z"}], "thread_id": "Thread-1", "execution_time": 0.014023780822753906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__connector_status", "compiled": true, "compiled_code": "with transformation_removal as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n    where transformation_id is null\n\n),\n\nconnector_log as (\n    select \n        *,\n        sum( case when event_subtype in ('sync_start') then 1 else 0 end) over ( partition by connector_id \n            order by created_at rows unbounded preceding) as sync_batch_id\n    from transformation_removal\n    -- only looking at errors, warnings, and syncs here\n    where event_type = 'SEVERE'\n        or event_type = 'WARNING'\n        or event_subtype like 'sync%'\n        or (event_subtype = 'status' \n            and \n\n  parse_json( message_data )['status'] = 'RESCHEDULED'\n            \n            and \n\n  parse_json( message_data )['reason'] like '%intended behavior%'\n            ) -- for priority-first syncs. these should be captured by event_type = 'WARNING' but let's make sure\n        or (event_subtype = 'status' \n            and \n\n  parse_json( message_data )['status'] = 'SUCCESSFUL'\n        )\n        -- whole reason is \"We have rescheduled the connector to force flush data from the forward sync into your destination. This is intended behavior and means that the connector is working as expected.\"\n),\n\nschema_changes as (\n\n    select\n        connector_id,\n        count(*) as number_of_schema_changes_last_month\n\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n\n    where \n        datediff(\n        day,\n        created_at,\n        \n  current_timestamp::timestamp\n\n        ) <= 30\n        and event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n\n    group by connector_id\n\n),\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__connector\n\n),\n\ndestination as (\n\n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__destination\n),\n\nconnector_metrics as (\n\n    select\n        connector.connector_id,\n        connector.connector_name,\n        connector.connector_type,\n        connector.destination_id,\n        connector.is_paused,\n        connector.set_up_at,\n        max(case when connector_log.event_subtype = 'sync_start' then connector_log.created_at else null end) as last_sync_started_at,\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.created_at else null end) as last_sync_completed_at,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and \n\n  parse_json( connector_log.message_data )['status'] ='SUCCESSFUL'\n            then connector_log.created_at else null end) as last_successful_sync_completed_at,\n\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.sync_batch_id else null end) as last_sync_batch_id,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and \n\n  parse_json( connector_log.message_data )['status'] ='RESCHEDULED'\n                and \n\n  parse_json( connector_log.message_data )['reason'] like '%intended behavior%'\n            then connector_log.created_at else null end) as last_priority_first_sync_completed_at,\n                \n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.created_at else null end) as last_error_at,\n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.sync_batch_id else null end) as last_error_batch,\n        max(case when event_type = 'WARNING' then connector_log.created_at else null end) as last_warning_at\n\n    from connector \n    left join connector_log \n        on connector_log.connector_id = connector.connector_id\n    group by connector.connector_id, connector.connector_name, connector.connector_type, connector.destination_id, connector.is_paused, connector.set_up_at\n),\n\nconnector_health_status as (\n\n    select\n        *,\n        case \n            -- connector is paused\n            when is_paused  then 'paused'\n\n            -- a sync has never been attempted\n            when last_sync_started_at is null then 'incomplete'\n\n            -- a priority-first sync has occurred, but a normal sync has not\n            when last_priority_first_sync_completed_at is not null and last_sync_completed_at is null then 'priority first sync'\n\n            -- a priority sync has occurred more recently than a normal one (may occurr if the connector has been paused and resumed)\n            when last_priority_first_sync_completed_at > last_sync_completed_at then 'priority first sync'\n\n            -- a sync has been attempted, but not completed, and it's not due to errors. also a priority-first sync hasn't\n            when last_sync_completed_at is null and last_error_at is null then 'initial sync in progress'\n\n            -- the last attempted sync had an error\n            when last_sync_batch_id = last_error_batch then 'broken'\n\n            -- there's never been a successful sync and there have been errors\n            when last_sync_completed_at is null and last_error_at is not null then 'broken'\n\n        else 'connected' end as connector_health\n\n    from connector_metrics\n),\n\n-- Joining with log to grab pertinent error/warning messagees\nconnector_recent_logs as (\n\n    select \n        connector_health_status.connector_id,\n        connector_health_status.connector_name,\n        connector_health_status.connector_type,\n        connector_health_status.destination_id,\n        connector_health_status.connector_health,\n        connector_health_status.last_successful_sync_completed_at,\n        connector_health_status.last_sync_started_at,\n        connector_health_status.last_sync_completed_at,\n        connector_health_status.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n    from connector_health_status \n    left join connector_log \n        on connector_log.connector_id = connector_health_status.connector_id\n        -- limiting relevance to since the last successful sync completion (if there has been one)\n        and connector_log.created_at > coalesce(connector_health_status.last_sync_completed_at, connector_health_status.last_priority_first_sync_completed_at, '2000-01-01') \n        -- only looking at errors and warnings (excluding syncs - both normal and priority first)\n        and connector_log.event_type != 'INFO' \n        -- need to explicitly avoid priority first statuses because they are of event_type WARNING\n        and not (connector_log.event_subtype = 'status' \n            and \n\n  parse_json( connector_log.message_data )['status'] ='RESCHEDULED'\n            and \n\n  parse_json( connector_log.message_data )['reason'] like '%intended behavior%')\n\n    group by -- remove duplicates\n        connector_health_status.connector_id,\n        connector_health_status.connector_name,\n        connector_health_status.connector_type,\n        connector_health_status.destination_id,\n        connector_health_status.connector_health,\n        connector_health_status.last_successful_sync_completed_at,\n        connector_health_status.last_sync_started_at,\n        connector_health_status.last_sync_completed_at,\n        connector_health_status.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n),\n\nfinal as (\n\n    select\n        connector_recent_logs.connector_id,\n        connector_recent_logs.connector_name,\n        connector_recent_logs.connector_type,\n        connector_recent_logs.destination_id,\n        destination.destination_name,\n        connector_recent_logs.connector_health,\n        connector_recent_logs.last_successful_sync_completed_at,\n        connector_recent_logs.last_sync_started_at,\n        connector_recent_logs.last_sync_completed_at,\n        connector_recent_logs.set_up_at,\n        coalesce(schema_changes.number_of_schema_changes_last_month, 0) as number_of_schema_changes_last_month\n        \n        \n        , \n    listagg(case when connector_recent_logs.event_type = 'SEVERE' then connector_recent_logs.message_data else null end, '\\n')\n\n as errors_since_last_completed_sync\n        , \n    listagg(case when connector_recent_logs.event_type = 'WARNING' then connector_recent_logs.message_data else null end, '\\n')\n\n as warnings_since_last_completed_sync\n        \n\n    from connector_recent_logs\n    left join schema_changes \n        on connector_recent_logs.connector_id = schema_changes.connector_id \n\n    join destination on destination.destination_id = connector_recent_logs.destination_id\n    group by \n        connector_recent_logs.connector_id, \n        connector_recent_logs.connector_name, \n        connector_recent_logs.connector_type, \n        connector_recent_logs.destination_id, \n        destination.destination_name, \n        connector_recent_logs.connector_health, \n        connector_recent_logs.last_successful_sync_completed_at, \n        connector_recent_logs.last_sync_started_at, \n        connector_recent_logs.last_sync_completed_at, \n        connector_recent_logs.set_up_at, \n        number_of_schema_changes_last_month\n)\n\nselect * from final", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:31.039340Z", "completed_at": "2023-12-12T19:08:31.043914Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:31.044436Z", "completed_at": "2023-12-12T19:08:31.044440Z"}], "thread_id": "Thread-1", "execution_time": 0.006209135055541992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        log_id, created_at\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n    group by log_id, created_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:31.046068Z", "completed_at": "2023-12-12T19:08:31.052140Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:31.052644Z", "completed_at": "2023-12-12T19:08:31.052648Z"}], "thread_id": "Thread-1", "execution_time": 0.007603883743286133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__usage_mar_destination_history", "compiled": true, "compiled_code": "with table_mar as (\n    \n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__mar_table_history\n),\n\ncredits_used as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__credits_used\n),\n\nuseage_cost as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__usage_cost\n),\n\ndestination_mar as (\n\n    select \n        cast(measured_month as date) as measured_month,\n        destination_id,\n        destination_name,\n        sum(free_monthly_active_rows) as free_monthly_active_rows,\n        sum(paid_monthly_active_rows) as paid_monthly_active_rows,\n        sum(total_monthly_active_rows) as total_monthly_active_rows\n    from table_mar\n    group by measured_month, destination_id, destination_name\n),\n\nusage as (\n\n    select \n        coalesce(credits_used.destination_id, useage_cost.destination_id) as destination_id,\n        credits_used.credits_spent,\n        useage_cost.dollars_spent,\n        cast(concat(coalesce(credits_used.measured_month,useage_cost.measured_month), '-01') as date) as measured_month -- match date format to join with MAR table\n    from credits_used\n    full outer join useage_cost\n        on useage_cost.measured_month = credits_used.measured_month\n        and useage_cost.destination_id = credits_used.destination_id\n),\n\njoin_usage_mar as (\n\n    select \n        destination_mar.measured_month,\n        destination_mar.destination_id,\n        destination_mar.destination_name,\n        usage.credits_spent,\n        usage.dollars_spent,\n        destination_mar.free_monthly_active_rows,\n        destination_mar.paid_monthly_active_rows,\n        destination_mar.total_monthly_active_rows,\n\n        -- credit and usage mar calculations\n        round( cast(nullif(usage.credits_spent,0) * 1000000.0 as numeric(28,6)) / cast(nullif(destination_mar.total_monthly_active_rows,0) as numeric(28,6)), 2) as credits_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as numeric(28,6)) / cast(nullif(usage.credits_spent,0) as numeric(28,6)), 0) as mar_per_credit_spent,\n        round( cast(nullif(usage.dollars_spent,0) * 1000000.0 as numeric(28,6)) / cast(nullif(destination_mar.total_monthly_active_rows,0) as numeric(28,6)), 2) as amount_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as numeric(28,6)) / cast(nullif(usage.dollars_spent,0) as numeric(28,6)), 0) as mar_per_amount_spent\n    from destination_mar \n    left join usage \n        on destination_mar.measured_month = cast(usage.measured_month as date)\n        and destination_mar.destination_id = usage.destination_id\n)\n\nselect * \nfrom join_usage_mar\n -- sql server doesn't support ordering CTEs\norder by measured_month desc\n", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__usage_mar_destination_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:31.054317Z", "completed_at": "2023-12-12T19:08:31.058350Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:31.058877Z", "completed_at": "2023-12-12T19:08:31.058881Z"}], "thread_id": "Thread-1", "execution_time": 0.005629301071166992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, schema_name, table_name, measured_month\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__mar_table_history\n    group by connector_id, destination_id, schema_name, table_name, measured_month\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:31.060509Z", "completed_at": "2023-12-12T19:08:31.063954Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:31.064462Z", "completed_at": "2023-12-12T19:08:31.064465Z"}], "thread_id": "Thread-1", "execution_time": 0.004993915557861328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at.be572689a3", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        log_id, occurred_at\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_user_activity\n    group by log_id, occurred_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:31.066082Z", "completed_at": "2023-12-12T19:08:31.569824Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:31.570586Z", "completed_at": "2023-12-12T19:08:31.570594Z"}], "thread_id": "Thread-1", "execution_time": 0.613135814666748, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__audit_table", "compiled": true, "compiled_code": "\n\nwith sync_log as (\n    \n    select \n        *,\n        \n\n  parse_json( message_data )['table'] as table_name\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n    where event_subtype in ('sync_start', 'sync_end', 'write_to_table_start', 'write_to_table_end', 'records_modified')\n\n    \n\n    -- Capture the latest timestamp in a call statement instead of a subquery for optimizing BQ costs on incremental runs-- load the result from the above query into a new variable-- the query_result is stored as a dataframe. Therefore, we want to now store it as a singular value.-- compare the new batch of data to the latest sync already stored in this model\n    and cast(created_at as date) > '2021-12-10'\n\n    \n),\n\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status\n),\n\nadd_connector_info as (\n\n    select \n        sync_log.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n    from sync_log \n    left join connector\n        on connector.connector_id = sync_log.connector_id\n),\n\nsync_timestamps as (\n\n    select\n        connector_id,\n        connector_name,\n        table_name,\n        event_subtype,\n        destination_id,\n        destination_name,\n        created_at as write_to_table_start,\n        min(case when event_subtype = 'write_to_table_end' then created_at else null end) \n            over (partition by connector_id, table_name order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as write_to_table_end,\n\n        max(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between UNBOUNDED PRECEDING and CURRENT ROW) as sync_start,\n\n        min(case when event_subtype = 'sync_end' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as sync_end, -- coalesce with next_sync_start\n\n        min(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as next_sync_start\n    from add_connector_info\n),\n\n-- this will be the base for every record in the final CTE\nlimit_to_table_starts as (\n\n    select *\n    from sync_timestamps \n    where event_subtype = 'write_to_table_start'\n),\n\nrecords_modified_log as (\n\n    select \n        connector_id,\n        created_at,\n        \n\n  parse_json( message_data )['table'] as table_name,\n        \n\n  parse_json( message_data )['schema'] as schema_name,\n        \n\n  parse_json( message_data )['operationType'] as operation_type,\n        cast (\n\n  parse_json( message_data )['count'] as integer) as row_count\n    from sync_log \n    where event_subtype = 'records_modified'\n\n),\n\nsum_records_modified as (\n\n    select\n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name) as schema_name,\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end as sync_end,\n        sum(case when records_modified_log.operation_type = 'REPLACED_OR_INSERTED' then records_modified_log.row_count else 0 end) as sum_rows_replaced_or_inserted,\n        sum(case when records_modified_log.operation_type = 'UPDATED' then records_modified_log.row_count else 0 end) as sum_rows_updated,\n        sum(case when records_modified_log.operation_type = 'DELETED' then records_modified_log.row_count else 0 end) as sum_rows_deleted\n    from limit_to_table_starts\n    left join records_modified_log on \n        limit_to_table_starts.connector_id = records_modified_log.connector_id\n        and limit_to_table_starts.table_name = records_modified_log.table_name\n\n        -- confine it to one sync\n        and records_modified_log.created_at > limit_to_table_starts.sync_start \n        and records_modified_log.created_at < coalesce(limit_to_table_starts.sync_end, limit_to_table_starts.next_sync_start) \n\n    group by \n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name),\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end\n),\n\nfinal as (\n\n    select \n        *,\n        md5(cast(coalesce(cast(schema_name as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(connector_id as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(destination_id as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(table_name as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(write_to_table_start as TEXT), '_dbt_utils_surrogate_key_null_') as TEXT)) as unique_table_sync_key, -- for incremental materialization \n        date_trunc('day', sync_start) as sync_start_day -- for partitioning in databricks\n    from sum_records_modified\n)\n\nselect *\nfrom final", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_table"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:31.681914Z", "completed_at": "2023-12-12T19:08:32.711767Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:32.712553Z", "completed_at": "2023-12-12T19:08:32.712562Z"}], "thread_id": "Thread-1", "execution_time": 1.146045207977295, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__connector_daily_events", "compiled": true, "compiled_code": "-- depends_on: DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1.connector\n\nwith connector as (\n    \n    select * \n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status\n),\n\n-- grab api calls, schema changes, and record modifications\nlog_events as (\n\n    select \n        connector_id,\n        cast( date_trunc('day', created_at) as date) as date_day,\n        case \n            when event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config') then 'schema_change' \n            else event_subtype end as event_subtype,\n\n        sum(case when event_subtype = 'records_modified' then cast( \n\n  parse_json( message_data )['count'] as integer )\n        else 1 end) as count_events \n\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n\n    where event_subtype in ('api_call', \n                            'records_modified', \n                            'create_table', 'alter_table', 'create_schema', 'change_schema_config') -- all schema changes\n                            \n        and connector_id is not null\n\n    group by connector_id, cast( date_trunc('day', created_at) as date), event_subtype\n),\n\npivot_out_events as (\n\n    select\n        connector_id,\n        date_day,\n        max(case when event_subtype = 'api_call' then count_events else 0 end) as count_api_calls,\n        max(case when event_subtype = 'records_modified' then count_events else 0 end) as count_record_modifications,\n        max(case when event_subtype = 'schema_change' then count_events else 0 end) as count_schema_changes\n\n    from log_events\n    group by connector_id, date_day\n), \n\nconnector_event_counts as (\n\n    select\n        pivot_out_events.date_day,\n        pivot_out_events.count_api_calls,\n        pivot_out_events.count_record_modifications,\n        pivot_out_events.count_schema_changes,\n        connector.connector_name,\n        connector.connector_id,\n        connector.connector_type,\n        connector.destination_name,\n        connector.destination_id,\n        connector.set_up_at\n    from\n    connector left join pivot_out_events \n        on pivot_out_events.connector_id = connector.connector_id\n),\n\nspine as (\n\n    \n    \n    \n    \n    \n\n    select cast(date_day as date) as date_day\n    from (\n        \n\n    \n\n\n\n\n\nwith rawdata as (\n\n    \n\n    \n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    \n    p0.generated_number * power(2, 0)\n     + \n    \n    p1.generated_number * power(2, 1)\n     + \n    \n    p2.generated_number * power(2, 2)\n     + \n    \n    p3.generated_number * power(2, 3)\n     + \n    \n    p4.generated_number * power(2, 4)\n     + \n    \n    p5.generated_number * power(2, 5)\n     + \n    \n    p6.generated_number * power(2, 6)\n     + \n    \n    p7.generated_number * power(2, 7)\n     + \n    \n    p8.generated_number * power(2, 8)\n     + \n    \n    p9.generated_number * power(2, 9)\n     + \n    \n    p10.generated_number * power(2, 10)\n    \n    \n    + 1\n    as generated_number\n\n    from\n\n    \n    p as p0\n     cross join \n    \n    p as p1\n     cross join \n    \n    p as p2\n     cross join \n    \n    p as p3\n     cross join \n    \n    p as p4\n     cross join \n    \n    p as p5\n     cross join \n    \n    p as p6\n     cross join \n    \n    p as p7\n     cross join \n    \n    p as p8\n     cross join \n    \n    p as p9\n     cross join \n    \n    p as p10\n    \n    \n\n    )\n\n    select *\n    from unioned\n    where generated_number <= 1733\n    order by generated_number\n\n\n\n),\n\nall_periods as (\n\n    select (\n        \n\n    dateadd(\n        day,\n        row_number() over (order by 1) - 1,\n        cast('2019-03-22' as date)\n        )\n\n\n    ) as date_day\n    from rawdata\n\n),\n\nfiltered as (\n\n    select *\n    from all_periods\n    where date_day <= \n\n    dateadd(\n        week,\n        1,\n        date_trunc('day', \n  current_timestamp::timestamp\n)\n        )\n\n\n\n)\n\nselect * from filtered\n\n\n        \n \n    ) as date_spine\n),\n\nconnector_event_history as (\n\n    select\n        spine.date_day,\n        connector_event_counts.connector_name,\n        connector_event_counts.connector_id,\n        connector_event_counts.connector_type,\n        connector_event_counts.destination_name,\n        connector_event_counts.destination_id,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_api_calls\n            else 0\n        end) as count_api_calls,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_record_modifications\n            else 0\n        end) as count_record_modifications,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_schema_changes\n            else 0\n        end) as count_schema_changes\n    from\n    spine join connector_event_counts\n        on spine.date_day  >= cast(date_trunc('day', cast(connector_event_counts.set_up_at as date)) as date)\n\n    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id\n),\n\n-- now rejoin spine to get a complete calendar\njoin_event_history as (\n    \n    select\n        spine.date_day,\n        connector_event_history.connector_name,\n        connector_event_history.connector_id,\n        connector_event_history.connector_type,\n        connector_event_history.destination_name,\n        connector_event_history.destination_id,\n        max(connector_event_history.count_api_calls) as count_api_calls,\n        max(connector_event_history.count_record_modifications) as count_record_modifications,\n        max(connector_event_history.count_schema_changes) as count_schema_changes\n\n    from\n    spine left join connector_event_history\n        on spine.date_day = connector_event_history.date_day\n\n    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id\n),\n\nfinal as (\n\n    select *\n    from join_event_history\n\n    where date_day <= cast(\n  current_timestamp::timestamp\n as date)\n\n     -- sql server cant order CTEs\n    order by date_day desc\n    \n)\n\nselect *\nfrom final", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_daily_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:32.830750Z", "completed_at": "2023-12-12T19:08:32.841876Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:32.842997Z", "completed_at": "2023-12-12T19:08:32.843007Z"}], "thread_id": "Thread-1", "execution_time": 0.01489114761352539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__schema_changelog", "compiled": true, "compiled_code": "with schema_changes as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.stg_fivetran_platform__log\n\n    where event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n),\n\nconnector as (\n\n    select *\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status\n),\n\nadd_connector_info as (\n\n    select \n        schema_changes.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n\n    from schema_changes join connector \n        on schema_changes.connector_id = connector.connector_id\n),\n\nfinal as (\n\n    select\n        connector_id,\n        connector_name,\n        destination_id,\n        destination_name,\n        created_at,\n        event_subtype,\n        message_data,\n\n        case \n        when event_subtype = 'alter_table' then \n\n  parse_json( message_data )['table'] \n        when event_subtype = 'create_table' then \n\n  parse_json( message_data )['name'] \n        else null end as table_name,\n\n        case \n        when event_subtype = 'create_schema' or event_subtype = 'create_table' then \n\n  parse_json( message_data )['schema'] \n        else null end as schema_name\n    \n    from add_connector_info\n)\n\nselect * from final\n\norder by created_at desc, connector_id\n", "relation_name": "DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__schema_changelog"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:32.846299Z", "completed_at": "2023-12-12T19:08:32.852753Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:32.853624Z", "completed_at": "2023-12-12T19:08:32.853632Z"}], "thread_id": "Thread-1", "execution_time": 0.00932002067565918, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_status\n    group by connector_id, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:32.856304Z", "completed_at": "2023-12-12T19:08:32.860984Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:32.861731Z", "completed_at": "2023-12-12T19:08:32.861736Z"}], "thread_id": "Thread-1", "execution_time": 0.007028341293334961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        destination_id, measured_month\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__usage_mar_destination_history\n    group by destination_id, measured_month\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:32.864088Z", "completed_at": "2023-12-12T19:08:32.868334Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:32.868984Z", "completed_at": "2023-12-12T19:08:32.868989Z"}], "thread_id": "Thread-1", "execution_time": 0.006339073181152344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect unique_table_sync_key\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_table\nwhere unique_table_sync_key is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:32.871083Z", "completed_at": "2023-12-12T19:08:32.875008Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:32.875652Z", "completed_at": "2023-12-12T19:08:32.875657Z"}], "thread_id": "Thread-1", "execution_time": 0.005892753601074219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7", "compiled": true, "compiled_code": "\n    \n    \n\nselect\n    unique_table_sync_key as unique_field,\n    count(*) as n_records\n\nfrom DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__audit_table\nwhere unique_table_sync_key is not null\ngroup by unique_table_sync_key\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:32.877634Z", "completed_at": "2023-12-12T19:08:32.882772Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:32.883389Z", "completed_at": "2023-12-12T19:08:32.883393Z"}], "thread_id": "Thread-1", "execution_time": 0.00697779655456543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, date_day\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__connector_daily_events\n    group by connector_id, destination_id, date_day\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-12T19:08:32.885322Z", "completed_at": "2023-12-12T19:08:32.889225Z"}, {"name": "execute", "started_at": "2023-12-12T19:08:32.889780Z", "completed_at": "2023-12-12T19:08:32.889784Z"}], "thread_id": "Thread-1", "execution_time": 0.005650997161865234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, message_data, created_at\n    from DBT_PACKAGE_TESTING.fivetran_platform_integration_tests_1_fivetran_platform.fivetran_platform__schema_changelog\n    group by connector_id, destination_id, message_data, created_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}], "elapsed_time": 4.609646797180176, "args": {"use_colors_file": true, "defer": false, "indirect_selection": "eager", "partial_parse_file_diff": true, "log_format_file": "debug", "empty_catalog": false, "strict_mode": false, "log_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests/logs", "log_format": "default", "macro_debugging": false, "enable_legacy_logger": false, "introspect": true, "project_dir": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "vars": {}, "write_json": true, "static_parser": true, "use_colors": true, "warn_error_options": {"include": [], "exclude": []}, "exclude": [], "printer_width": 80, "print": true, "log_level_file": "debug", "log_file_max_bytes": 10485760, "invocation_command": "dbt docs generate", "version_check": true, "log_level": "info", "populate_cache": true, "cache_selected_only": false, "quiet": false, "compile": true, "select": [], "profiles_dir": "/Users/jamie.rodriguez/.dbt", "show_resource_report": false, "favor_state": false, "static": false, "partial_parse": true, "which": "generate", "send_anonymous_usage_stats": true}}
\ No newline at end of file
+{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v5.json", "dbt_version": "1.7.3", "generated_at": "2023-12-13T20:53:25.644650Z", "invocation_id": "577df33a-3268-4af6-b091-fe0bceede99b", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.661307Z", "completed_at": "2023-12-13T20:53:22.683991Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.684588Z", "completed_at": "2023-12-13T20:53:22.684609Z"}], "thread_id": "Thread-1", "execution_time": 0.0288388729095459, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__account", "compiled": true, "compiled_code": "with base as (\n    \n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests`.`account`\n),\n\nfields as (\n\n    select\n        id as account_id,\n        country,\n        cast(created_at as timestamp) as created_at,\n        name as account_name,\n        status\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__account`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.674551Z", "completed_at": "2023-12-13T20:53:22.697124Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.702778Z", "completed_at": "2023-12-13T20:53:22.702785Z"}], "thread_id": "Thread-2", "execution_time": 0.0457148551940918, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__connector_tmp", "compiled": true, "compiled_code": "select *\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests`.`connector`", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__connector_tmp`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.679052Z", "completed_at": "2023-12-13T20:53:22.697536Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.703085Z", "completed_at": "2023-12-13T20:53:22.703089Z"}], "thread_id": "Thread-4", "execution_time": 0.044267892837524414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__destination", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests`.`destination`\n),\n\nfields as (\n\n    select\n        id as destination_id,\n        account_id,\n        cast(created_at as timestamp) as created_at,\n        name as destination_name,\n        region\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__destination`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.678302Z", "completed_at": "2023-12-13T20:53:22.698682Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.704870Z", "completed_at": "2023-12-13T20:53:22.704874Z"}], "thread_id": "Thread-3", "execution_time": 0.046846866607666016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__credits_used", "compiled": true, "compiled_code": "\n\nwith base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests`.`credits_used`\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        credits_consumed as credits_spent\n    from base\n)\n\nselect * \nfrom fields\n\n", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__credits_used`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.698956Z", "completed_at": "2023-12-13T20:53:22.705499Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.708774Z", "completed_at": "2023-12-13T20:53:22.708779Z"}], "thread_id": "Thread-1", "execution_time": 0.0169069766998291, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__destination_membership", "compiled": true, "compiled_code": "\n\nwith base as (\n    \n    select * from `dbt-package-testing`.`fivetran_platform_integration_tests`.`destination_membership`\n),\n\nfields as (\n\n    select\n        destination_id,\n        user_id,\n        cast(activated_at as timestamp) as activated_at,\n        cast(joined_at as timestamp) as joined_at,\n        role as destination_role\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__destination_membership`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.713786Z", "completed_at": "2023-12-13T20:53:22.722126Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.724965Z", "completed_at": "2023-12-13T20:53:22.724971Z"}], "thread_id": "Thread-4", "execution_time": 0.022498130798339844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__log_tmp", "compiled": true, "compiled_code": "select *\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests`.`log`", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log_tmp`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.709825Z", "completed_at": "2023-12-13T20:53:22.723074Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.728924Z", "completed_at": "2023-12-13T20:53:22.728930Z"}], "thread_id": "Thread-2", "execution_time": 0.023854970932006836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__incremental_mar", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests`.`incremental_mar`\n),\n\nfields as (\n\n    select\n        connector_id as connector_name,\n        destination_id,\n        free_type,\n        cast(measured_date as timestamp) as measured_date,\n        schema_name,\n        sync_type,\n        table_name,\n        updated_at,\n        _fivetran_synced,\n        incremental_rows\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__incremental_mar`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.717518Z", "completed_at": "2023-12-13T20:53:22.724579Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.730978Z", "completed_at": "2023-12-13T20:53:22.730983Z"}], "thread_id": "Thread-3", "execution_time": 0.02350616455078125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__usage_cost", "compiled": true, "compiled_code": "\nwith base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests`.`usage_cost`\n),\n\nfields as (\n    \n    select \n        destination_id,\n        measured_month,\n        amount as dollars_spent\n    from base\n)\n\nselect * \nfrom fields\n\n", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__usage_cost`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.725281Z", "completed_at": "2023-12-13T20:53:22.731686Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.735083Z", "completed_at": "2023-12-13T20:53:22.735087Z"}], "thread_id": "Thread-1", "execution_time": 0.015694141387939453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__user", "compiled": true, "compiled_code": "\n\nwith base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests`.`user`\n),\n\nfields as (\n\n    select\n        id as user_id,\n        cast(created_at as timestamp) as created_at,\n        email,\n        email_disabled as has_disabled_email_notifications,\n        family_name as last_name,\n        given_name as first_name,\n        phone,\n        verified as is_verified\n    from base\n)\n\nselect * \nfrom fields", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__user`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.736036Z", "completed_at": "2023-12-13T20:53:22.737593Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.742908Z", "completed_at": "2023-12-13T20:53:22.742913Z"}], "thread_id": "Thread-4", "execution_time": 0.010959148406982422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.account", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.738606Z", "completed_at": "2023-12-13T20:53:22.739929Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.743617Z", "completed_at": "2023-12-13T20:53:22.743620Z"}], "thread_id": "Thread-2", "execution_time": 0.010962963104248047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.connector", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.741339Z", "completed_at": "2023-12-13T20:53:22.742593Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.745334Z", "completed_at": "2023-12-13T20:53:22.745337Z"}], "thread_id": "Thread-3", "execution_time": 0.013117074966430664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.credits_used", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.745834Z", "completed_at": "2023-12-13T20:53:22.747881Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.750562Z", "completed_at": "2023-12-13T20:53:22.750567Z"}], "thread_id": "Thread-1", "execution_time": 0.01028585433959961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.destination", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.751439Z", "completed_at": "2023-12-13T20:53:22.752840Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.757856Z", "completed_at": "2023-12-13T20:53:22.757861Z"}], "thread_id": "Thread-4", "execution_time": 0.010261058807373047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.destination_membership", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.753850Z", "completed_at": "2023-12-13T20:53:22.755144Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.758547Z", "completed_at": "2023-12-13T20:53:22.758550Z"}], "thread_id": "Thread-2", "execution_time": 0.010386943817138672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.incremental_mar", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.756385Z", "completed_at": "2023-12-13T20:53:22.757580Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.760398Z", "completed_at": "2023-12-13T20:53:22.760401Z"}], "thread_id": "Thread-3", "execution_time": 0.012506246566772461, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.log", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.760911Z", "completed_at": "2023-12-13T20:53:22.762787Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.765298Z", "completed_at": "2023-12-13T20:53:22.765301Z"}], "thread_id": "Thread-1", "execution_time": 0.00977468490600586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.usage_cost", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.766150Z", "completed_at": "2023-12-13T20:53:22.767425Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.781026Z", "completed_at": "2023-12-13T20:53:22.781032Z"}], "thread_id": "Thread-4", "execution_time": 0.01836705207824707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.fivetran_log_integration_tests.user", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.768231Z", "completed_at": "2023-12-13T20:53:22.781778Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.786231Z", "completed_at": "2023-12-13T20:53:22.786235Z"}], "thread_id": "Thread-2", "execution_time": 0.02415776252746582, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__account_account_id.d09ebf1a1e", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect account_id\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__account`\nwhere account_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.776860Z", "completed_at": "2023-12-13T20:53:22.783051Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.788954Z", "completed_at": "2023-12-13T20:53:22.788958Z"}], "thread_id": "Thread-3", "execution_time": 0.024449825286865234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__account_account_id.114e181adc", "compiled": true, "compiled_code": "\n    \n    \n\nwith dbt_test__target as (\n\n  select account_id as unique_field\n  from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__account`\n  where account_id is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.790575Z", "completed_at": "2023-12-13T20:53:22.798261Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.805543Z", "completed_at": "2023-12-13T20:53:22.805549Z"}], "thread_id": "Thread-4", "execution_time": 0.018848657608032227, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__destination_destination_id.0cdbe6b780", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect destination_id\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__destination`\nwhere destination_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.795332Z", "completed_at": "2023-12-13T20:53:22.805842Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.807487Z", "completed_at": "2023-12-13T20:53:22.807491Z"}], "thread_id": "Thread-2", "execution_time": 0.014811992645263672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__destination_destination_id.582a1280ed", "compiled": true, "compiled_code": "\n    \n    \n\nwith dbt_test__target as (\n\n  select destination_id as unique_field\n  from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__destination`\n  where destination_id is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.799091Z", "completed_at": "2023-12-13T20:53:22.807211Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.809189Z", "completed_at": "2023-12-13T20:53:22.809192Z"}], "thread_id": "Thread-3", "execution_time": 0.018507003784179688, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__credits_used_measured_month__destination_id.bea8f20c38", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        measured_month, destination_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__credits_used`\n    group by measured_month, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.809735Z", "completed_at": "2023-12-13T20:53:22.818764Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.823187Z", "completed_at": "2023-12-13T20:53:22.823193Z"}], "thread_id": "Thread-4", "execution_time": 0.016106128692626953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__destination_membership_destination_id__user_id.82ac27c35a", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        destination_id, user_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__destination_membership`\n    group by destination_id, user_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.820147Z", "completed_at": "2023-12-13T20:53:22.828445Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.828946Z", "completed_at": "2023-12-13T20:53:22.828951Z"}], "thread_id": "Thread-3", "execution_time": 0.014642000198364258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__usage_cost_measured_month__destination_id.d6d997525f", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        measured_month, destination_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__usage_cost`\n    group by measured_month, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.825327Z", "completed_at": "2023-12-13T20:53:22.833585Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.834102Z", "completed_at": "2023-12-13T20:53:22.834106Z"}], "thread_id": "Thread-4", "execution_time": 0.010055780410766602, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.not_null_stg_fivetran_platform__user_user_id.eb17e92ff0", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect user_id\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__user`\nwhere user_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.830528Z", "completed_at": "2023-12-13T20:53:22.834989Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:22.835509Z", "completed_at": "2023-12-13T20:53:22.835512Z"}], "thread_id": "Thread-3", "execution_time": 0.006011962890625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.unique_stg_fivetran_platform__user_user_id.86a1a3afb9", "compiled": true, "compiled_code": "\n    \n    \n\nwith dbt_test__target as (\n\n  select user_id as unique_field\n  from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__user`\n  where user_id is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.783568Z", "completed_at": "2023-12-13T20:53:23.151427Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:23.152788Z", "completed_at": "2023-12-13T20:53:23.152794Z"}], "thread_id": "Thread-1", "execution_time": 0.3723881244659424, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__connector", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__connector_tmp`\n),\n\nfields as (\n    select\n        \n    cast(null as boolean) as \n    \n    _fivetran_deleted\n    \n , \n    \n    \n    _fivetran_synced\n    \n as \n    \n    _fivetran_synced\n    \n, \n    \n    \n    connecting_user_id\n    \n as \n    \n    connecting_user_id\n    \n, \n    \n    \n    connector_id\n    \n as \n    \n    connector_id\n    \n, \n    \n    \n    connector_name\n    \n as \n    \n    connector_name\n    \n, \n    \n    \n    connector_type\n    \n as \n    \n    connector_type\n    \n, \n    cast(null as string) as \n    \n    connector_type_id\n    \n , \n    \n    \n    destination_id\n    \n as \n    \n    destination_id\n    \n, \n    \n    \n    paused\n    \n as \n    \n    paused\n    \n, \n    cast(null as INT64) as \n    \n    service_version\n    \n , \n    \n    \n    signed_up\n    \n as \n    \n    signed_up\n    \n\n\n\n        ,row_number() over ( partition by connector_name, destination_id order by _fivetran_synced desc ) as nth_last_record\n    from base\n),\n\nfinal as (\n\n    select \n        connector_id,\n        connector_name,\n        coalesce(connector_type_id, connector_type) as connector_type,\n        destination_id,\n        connecting_user_id,\n        paused as is_paused,\n        signed_up as set_up_at\n    from fields\n\n    -- Only look at the most recent one\n    where nth_last_record = 1\n)\n\nselect * \nfrom final", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__connector`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:22.815175Z", "completed_at": "2023-12-13T20:53:23.151800Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:23.153134Z", "completed_at": "2023-12-13T20:53:23.153137Z"}], "thread_id": "Thread-2", "execution_time": 0.3406860828399658, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.stg_fivetran_platform__log", "compiled": true, "compiled_code": "with base as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log_tmp`\n),\n\nfields as (\n    select\n        \n    \n    \n    _fivetran_synced\n    \n as \n    \n    _fivetran_synced\n    \n, \n    \n    \n    connector_id\n    \n as \n    \n    connector_id\n    \n, \n    \n    \n    event\n    \n as \n    \n    event\n    \n, \n    \n    \n    id\n    \n as \n    \n    id\n    \n, \n    \n    \n    message_data\n    \n as \n    \n    message_data\n    \n, \n    \n    \n    message_event\n    \n as \n    \n    message_event\n    \n, \n    \n    \n    sync_id\n    \n as \n    \n    sync_id\n    \n, \n    \n    \n    time_stamp\n    \n as \n    \n    time_stamp\n    \n, \n    \n    \n    transformation_id\n    \n as \n    \n    transformation_id\n    \n\n\n\n    from base\n),\n\nfinal as (\n\n    select\n        id as log_id, \n        sync_id,\n        cast(time_stamp as timestamp) as created_at,\n        connector_id, -- Note: the connector_id column used to erroneously equal the connector_name, NOT its id.\n        case when transformation_id is not null and event is null then 'TRANSFORMATION'\n        else event end as event_type, \n        message_data,\n        case \n        when transformation_id is not null and message_data like '%has succeeded%' then 'transformation run success'\n        when transformation_id is not null and message_data like '%has failed%' then 'transformation run failed'\n        else message_event end as event_subtype,\n        transformation_id\n    from fields\n)\n\nselect * \nfrom final", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:23.158892Z", "completed_at": "2023-12-13T20:53:23.238874Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:23.239414Z", "completed_at": "2023-12-13T20:53:23.239420Z"}], "thread_id": "Thread-4", "execution_time": 0.08411407470703125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__audit_user_activity", "compiled": true, "compiled_code": "with logs as (\n\n    select \n        *,\n        \n\n \n  json_extract_scalar(message_data, '$.actor')\n\n as actor_email\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log`\n),\n\nuser_logs as (\n\n    select *\n    from logs\n    where actor_email is not null \n        and lower(actor_email) != 'fivetran'\n),\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__connector`\n),\n\ndestination as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__destination`\n),\nusers as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__user`\n),\n    destination_membership as (\n\n        select *\n        from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__destination_membership`\n    ),\n    final as (\n\n    select\n        timestamp_trunc(\n        cast(user_logs.created_at as timestamp),\n        day\n    ) as date_day,\n        \n        format_date('%a', cast(user_logs.created_at as date)) as day_name,\n            extract(day from user_logs.created_at) as day_of_month,\n        user_logs.created_at as occurred_at,\n        destination.destination_name,\n        destination.destination_id,\n        connector.connector_name,\n        connector.connector_id,\n        user_logs.actor_email as email,\n        users.first_name,\n        users.last_name,\n        users.user_id,\n        destination_membership.destination_role,\n    user_logs.event_type, -- should always be INFO for user-triggered actions but include just in case\n        user_logs.event_subtype,\n        user_logs.message_data,\n        user_logs.log_id\n\n    from user_logs\n    left join connector\n        on user_logs.connector_id = connector.connector_id\n    left join destination\n        on connector.destination_id = destination.destination_id\n    left join users \n        on lower(users.email) = lower(user_logs.actor_email)\n    left join destination_membership\n        on destination.destination_id = destination_membership.destination_id\n        and users.user_id = destination_membership.user_id\n\n    )\n\nselect *\nfrom final", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__audit_user_activity`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:23.178185Z", "completed_at": "2023-12-13T20:53:23.245090Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:23.246614Z", "completed_at": "2023-12-13T20:53:23.246619Z"}], "thread_id": "Thread-1", "execution_time": 0.09021592140197754, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__mar_table_history", "compiled": true, "compiled_code": "with incremental_mar as (\n\n    select\n        *,\n        timestamp_trunc(\n        cast(measured_date as timestamp),\n        month\n    ) as measured_month\n\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__incremental_mar`\n),\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__connector`\n),\n\ndestination as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__destination`\n),\n\nordered_mar as (\n\n    select\n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        max(measured_date) as last_measured_at,\n        sum(incremental_rows) as incremental_rows,\n        sum(coalesce(case when lower(free_type) = 'paid'\n            then incremental_rows\n        end, 0)) as paid_monthly_active_rows,\n        sum(coalesce(case when lower(free_type) != 'paid'\n            then incremental_rows\n        end, 0)) as free_monthly_active_rows\n\n    from incremental_mar\n    group by connector_name, schema_name, table_name, destination_id, measured_month\n),\n\nlatest_mar as (\n    select \n        connector_name,\n        schema_name,\n        table_name,\n        destination_id,\n        measured_month,\n        cast(last_measured_at as date) as last_measured_at,\n        free_monthly_active_rows,\n        paid_monthly_active_rows,\n        (free_monthly_active_rows + paid_monthly_active_rows) as total_monthly_active_rows\n\n    from ordered_mar\n),\n\nmar_join as (\n\n    select\n        latest_mar.*,\n        connector.connector_type,\n        connector.connector_id,\n        destination.destination_name\n\n    from latest_mar\n    join connector\n        on latest_mar.connector_name = connector.connector_name\n        and latest_mar.destination_id = connector.destination_id\n    join destination on latest_mar.destination_id = destination.destination_id\n)\n\nselect * from mar_join", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__mar_table_history`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:23.172197Z", "completed_at": "2023-12-13T20:53:23.245441Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:23.247168Z", "completed_at": "2023-12-13T20:53:23.247172Z"}], "thread_id": "Thread-3", "execution_time": 0.09174013137817383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__connector_status", "compiled": true, "compiled_code": "with transformation_removal as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log`\n    where transformation_id is null\n\n),\n\nconnector_log as (\n    select \n        *,\n        sum( case when event_subtype in ('sync_start') then 1 else 0 end) over ( partition by connector_id \n            order by created_at rows unbounded preceding) as sync_batch_id\n    from transformation_removal\n    -- only looking at errors, warnings, and syncs here\n    where event_type = 'SEVERE'\n        or event_type = 'WARNING'\n        or event_subtype like 'sync%'\n        or (event_subtype = 'status' \n            and \n\n \n  json_extract_scalar(message_data, '$.status')\n\n = 'RESCHEDULED'\n            \n            and \n\n \n  json_extract_scalar(message_data, '$.reason')\n\n like '%intended behavior%'\n            ) -- for priority-first syncs. these should be captured by event_type = 'WARNING' but let's make sure\n        or (event_subtype = 'status' \n            and \n\n \n  json_extract_scalar(message_data, '$.status')\n\n = 'SUCCESSFUL'\n        )\n        -- whole reason is \"We have rescheduled the connector to force flush data from the forward sync into your destination. This is intended behavior and means that the connector is working as expected.\"\n),\n\nschema_changes as (\n\n    select\n        connector_id,\n        count(*) as number_of_schema_changes_last_month\n\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log`\n\n    where \n        \n\n    datetime_diff(\n        cast(current_timestamp as datetime),\n        cast(created_at as datetime),\n        day\n    )\n\n   <= 30\n        and event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n\n    group by connector_id\n\n),\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__connector`\n\n),\n\ndestination as (\n\n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__destination`\n),\n\nconnector_metrics as (\n\n    select\n        connector.connector_id,\n        connector.connector_name,\n        connector.connector_type,\n        connector.destination_id,\n        connector.is_paused,\n        connector.set_up_at,\n        max(case when connector_log.event_subtype = 'sync_start' then connector_log.created_at else null end) as last_sync_started_at,\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.created_at else null end) as last_sync_completed_at,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and \n\n \n  json_extract_scalar(connector_log.message_data, '$.status')\n\n ='SUCCESSFUL'\n            then connector_log.created_at else null end) as last_successful_sync_completed_at,\n\n\n        max(case when connector_log.event_subtype = 'sync_end' \n            then connector_log.sync_batch_id else null end) as last_sync_batch_id,\n\n        max(case when connector_log.event_subtype in ('status', 'sync_end')\n                and \n\n \n  json_extract_scalar(connector_log.message_data, '$.status')\n\n ='RESCHEDULED'\n                and \n\n \n  json_extract_scalar(connector_log.message_data, '$.reason')\n\n like '%intended behavior%'\n            then connector_log.created_at else null end) as last_priority_first_sync_completed_at,\n                \n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.created_at else null end) as last_error_at,\n\n        max(case when connector_log.event_type = 'SEVERE' then connector_log.sync_batch_id else null end) as last_error_batch,\n        max(case when event_type = 'WARNING' then connector_log.created_at else null end) as last_warning_at\n\n    from connector \n    left join connector_log \n        on connector_log.connector_id = connector.connector_id\n    group by connector.connector_id, connector.connector_name, connector.connector_type, connector.destination_id, connector.is_paused, connector.set_up_at\n),\n\nconnector_health_status as (\n\n    select\n        *,\n        case \n            -- connector is paused\n            when is_paused  then 'paused'\n\n            -- a sync has never been attempted\n            when last_sync_started_at is null then 'incomplete'\n\n            -- a priority-first sync has occurred, but a normal sync has not\n            when last_priority_first_sync_completed_at is not null and last_sync_completed_at is null then 'priority first sync'\n\n            -- a priority sync has occurred more recently than a normal one (may occurr if the connector has been paused and resumed)\n            when last_priority_first_sync_completed_at > last_sync_completed_at then 'priority first sync'\n\n            -- a sync has been attempted, but not completed, and it's not due to errors. also a priority-first sync hasn't\n            when last_sync_completed_at is null and last_error_at is null then 'initial sync in progress'\n\n            -- the last attempted sync had an error\n            when last_sync_batch_id = last_error_batch then 'broken'\n\n            -- there's never been a successful sync and there have been errors\n            when last_sync_completed_at is null and last_error_at is not null then 'broken'\n\n        else 'connected' end as connector_health\n\n    from connector_metrics\n),\n\n-- Joining with log to grab pertinent error/warning messagees\nconnector_recent_logs as (\n\n    select \n        connector_health_status.connector_id,\n        connector_health_status.connector_name,\n        connector_health_status.connector_type,\n        connector_health_status.destination_id,\n        connector_health_status.connector_health,\n        connector_health_status.last_successful_sync_completed_at,\n        connector_health_status.last_sync_started_at,\n        connector_health_status.last_sync_completed_at,\n        connector_health_status.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n    from connector_health_status \n    left join connector_log \n        on connector_log.connector_id = connector_health_status.connector_id\n        -- limiting relevance to since the last successful sync completion (if there has been one)\n        and connector_log.created_at > coalesce(connector_health_status.last_sync_completed_at, connector_health_status.last_priority_first_sync_completed_at, '2000-01-01') \n        -- only looking at errors and warnings (excluding syncs - both normal and priority first)\n        and connector_log.event_type != 'INFO' \n        -- need to explicitly avoid priority first statuses because they are of event_type WARNING\n        and not (connector_log.event_subtype = 'status' \n            and \n\n \n  json_extract_scalar(connector_log.message_data, '$.status')\n\n ='RESCHEDULED'\n            and \n\n \n  json_extract_scalar(connector_log.message_data, '$.reason')\n\n like '%intended behavior%')\n\n    group by -- remove duplicates, need explicit group by for SQL Server\n        connector_health_status.connector_id,\n        connector_health_status.connector_name,\n        connector_health_status.connector_type,\n        connector_health_status.destination_id,\n        connector_health_status.connector_health,\n        connector_health_status.last_successful_sync_completed_at,\n        connector_health_status.last_sync_started_at,\n        connector_health_status.last_sync_completed_at,\n        connector_health_status.set_up_at,\n        connector_log.event_subtype,\n        connector_log.event_type,\n        connector_log.message_data\n\n),\n\nfinal as (\n\n    select\n        connector_recent_logs.connector_id,\n        connector_recent_logs.connector_name,\n        connector_recent_logs.connector_type,\n        connector_recent_logs.destination_id,\n        destination.destination_name,\n        connector_recent_logs.connector_health,\n        connector_recent_logs.last_successful_sync_completed_at,\n        connector_recent_logs.last_sync_started_at,\n        connector_recent_logs.last_sync_completed_at,\n        connector_recent_logs.set_up_at,\n        coalesce(schema_changes.number_of_schema_changes_last_month, 0) as number_of_schema_changes_last_month\n        \n        \n        , \n    string_agg(distinct case when connector_recent_logs.event_type = 'SEVERE' then connector_recent_logs.message_data else null end, '\\n')\n\n as errors_since_last_completed_sync\n        , \n    string_agg(distinct case when connector_recent_logs.event_type = 'WARNING' then connector_recent_logs.message_data else null end, '\\n')\n\n as warnings_since_last_completed_sync\n        \n\n    from connector_recent_logs\n    left join schema_changes \n        on connector_recent_logs.connector_id = schema_changes.connector_id \n\n    join destination on destination.destination_id = connector_recent_logs.destination_id\n\n    -- need explicit group bys for SQL Server\n    group by \n        connector_recent_logs.connector_id, \n        connector_recent_logs.connector_name, \n        connector_recent_logs.connector_type, \n        connector_recent_logs.destination_id, \n        destination.destination_name, \n        connector_recent_logs.connector_health, \n        connector_recent_logs.last_successful_sync_completed_at, \n        connector_recent_logs.last_sync_started_at, \n        connector_recent_logs.last_sync_completed_at, \n        connector_recent_logs.set_up_at, \n        number_of_schema_changes_last_month\n)\n\nselect * from final", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__connector_status`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:23.188598Z", "completed_at": "2023-12-13T20:53:23.246320Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:23.248965Z", "completed_at": "2023-12-13T20:53:23.248968Z"}], "thread_id": "Thread-2", "execution_time": 0.09216690063476562, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__connector_connector_name__destination_id.38a4da659a", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_name, destination_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__connector`\n    group by connector_name, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:23.241274Z", "completed_at": "2023-12-13T20:53:23.246907Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:23.249534Z", "completed_at": "2023-12-13T20:53:23.249537Z"}], "thread_id": "Thread-4", "execution_time": 0.010752201080322266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_stg_fivetran_platform__log_log_id__created_at.c406abd91d", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        log_id, created_at\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log`\n    group by log_id, created_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:23.253382Z", "completed_at": "2023-12-13T20:53:23.281381Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:23.281960Z", "completed_at": "2023-12-13T20:53:23.281967Z"}], "thread_id": "Thread-1", "execution_time": 0.03177189826965332, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__audit_user_activity_log_id__occurred_at.be572689a3", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        log_id, occurred_at\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__audit_user_activity`\n    group by log_id, occurred_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:23.257209Z", "completed_at": "2023-12-13T20:53:23.283093Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:23.285202Z", "completed_at": "2023-12-13T20:53:23.285206Z"}], "thread_id": "Thread-3", "execution_time": 0.04067111015319824, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__usage_mar_destination_history", "compiled": true, "compiled_code": "with table_mar as (\n    \n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__mar_table_history`\n),\n\ncredits_used as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__credits_used`\n),\n\nuseage_cost as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__usage_cost`\n),\n\ndestination_mar as (\n\n    select \n        cast(measured_month as date) as measured_month,\n        destination_id,\n        destination_name,\n        sum(free_monthly_active_rows) as free_monthly_active_rows,\n        sum(paid_monthly_active_rows) as paid_monthly_active_rows,\n        sum(total_monthly_active_rows) as total_monthly_active_rows\n    from table_mar\n    group by measured_month, destination_id, destination_name\n),\n\nusage as (\n\n    select \n        coalesce(credits_used.destination_id, useage_cost.destination_id) as destination_id,\n        credits_used.credits_spent,\n        useage_cost.dollars_spent,\n        cast(concat(coalesce(credits_used.measured_month,useage_cost.measured_month), '-01') as date) as measured_month -- match date format to join with MAR table\n    from credits_used\n    full outer join useage_cost\n        on useage_cost.measured_month = credits_used.measured_month\n        and useage_cost.destination_id = credits_used.destination_id\n),\n\njoin_usage_mar as (\n\n    select \n        destination_mar.measured_month,\n        destination_mar.destination_id,\n        destination_mar.destination_name,\n        usage.credits_spent,\n        usage.dollars_spent,\n        destination_mar.free_monthly_active_rows,\n        destination_mar.paid_monthly_active_rows,\n        destination_mar.total_monthly_active_rows,\n\n        -- credit and usage mar calculations\n        round( cast(nullif(usage.credits_spent,0) * 1000000.0 as numeric) / cast(nullif(destination_mar.total_monthly_active_rows,0) as numeric), 2) as credits_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as numeric) / cast(nullif(usage.credits_spent,0) as numeric), 0) as mar_per_credit_spent,\n        round( cast(nullif(usage.dollars_spent,0) * 1000000.0 as numeric) / cast(nullif(destination_mar.total_monthly_active_rows,0) as numeric), 2) as amount_spent_per_million_mar,\n        round( cast(nullif(destination_mar.total_monthly_active_rows,0) * 1.0 as numeric) / cast(nullif(usage.dollars_spent,0) as numeric), 0) as mar_per_amount_spent\n    from destination_mar \n    left join usage \n        on destination_mar.measured_month = cast(usage.measured_month as date)\n        and destination_mar.destination_id = usage.destination_id\n)\n\nselect * \nfrom join_usage_mar", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__usage_mar_destination_history`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:23.263618Z", "completed_at": "2023-12-13T20:53:23.283578Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:23.285496Z", "completed_at": "2023-12-13T20:53:23.285499Z"}], "thread_id": "Thread-2", "execution_time": 0.042359113693237305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__mar_table_history_connector_id__destination_id__schema_name__table_name__measured_month.b7babb1441", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, schema_name, table_name, measured_month\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__mar_table_history`\n    group by connector_id, destination_id, schema_name, table_name, measured_month\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:23.303422Z", "completed_at": "2023-12-13T20:53:23.307102Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:23.307647Z", "completed_at": "2023-12-13T20:53:23.307654Z"}], "thread_id": "Thread-2", "execution_time": 0.01038813591003418, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_status_connector_id__destination_id.1d83a6dd89", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__connector_status`\n    group by connector_id, destination_id\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:23.298811Z", "completed_at": "2023-12-13T20:53:23.312426Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:23.313026Z", "completed_at": "2023-12-13T20:53:23.313030Z"}], "thread_id": "Thread-3", "execution_time": 0.016872882843017578, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__schema_changelog", "compiled": true, "compiled_code": "with schema_changes as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log`\n\n    where event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config')\n),\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__connector_status`\n),\n\nadd_connector_info as (\n\n    select \n        schema_changes.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n\n    from schema_changes join connector \n        on schema_changes.connector_id = connector.connector_id\n),\n\nfinal as (\n\n    select\n        connector_id,\n        connector_name,\n        destination_id,\n        destination_name,\n        created_at,\n        event_subtype,\n        message_data,\n\n        case \n        when event_subtype = 'alter_table' then \n\n \n  json_extract_scalar(message_data, '$.table')\n\n \n        when event_subtype = 'create_table' then \n\n \n  json_extract_scalar(message_data, '$.name')\n\n \n        else null end as table_name,\n\n        case \n        when event_subtype = 'create_schema' or event_subtype = 'create_table' then \n\n \n  json_extract_scalar(message_data, '$.schema')\n\n \n        else null end as schema_name\n    \n    from add_connector_info\n)\n\nselect * from final", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__schema_changelog`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:23.309340Z", "completed_at": "2023-12-13T20:53:23.313924Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:23.315248Z", "completed_at": "2023-12-13T20:53:23.315252Z"}], "thread_id": "Thread-2", "execution_time": 0.007226228713989258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__usage_mar_destination_history_destination_id__measured_month.05f6419efd", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        destination_id, measured_month\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__usage_mar_destination_history`\n    group by destination_id, measured_month\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:23.316286Z", "completed_at": "2023-12-13T20:53:23.319895Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:23.320451Z", "completed_at": "2023-12-13T20:53:23.320455Z"}], "thread_id": "Thread-3", "execution_time": 0.006176948547363281, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__schema_changelog_connector_id__destination_id__message_data__created_at.cc39f64493", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, message_data, created_at\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__schema_changelog`\n    group by connector_id, destination_id, message_data, created_at\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:23.268227Z", "completed_at": "2023-12-13T20:53:24.703133Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:24.704175Z", "completed_at": "2023-12-13T20:53:24.704187Z"}], "thread_id": "Thread-4", "execution_time": 1.4482529163360596, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__audit_table", "compiled": true, "compiled_code": "\n\nwith sync_log as (\n    \n    select \n        *,\n        \n\n \n  json_extract_scalar(message_data, '$.table')\n\n as table_name\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log`\n    where event_subtype in ('sync_start', 'sync_end', 'write_to_table_start', 'write_to_table_end', 'records_modified')\n\n    \n\n    -- Capture the latest timestamp in a call statement instead of a subquery for optimizing BQ costs on incremental runs-- load the result from the above query into a new variable-- the query_result is stored as a dataframe. Therefore, we want to now store it as a singular value.-- compare the new batch of data to the latest sync already stored in this model\n    and cast(created_at as date) > '2021-12-10'\n\n    \n),\n\n\nconnector as (\n\n    select *\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__connector_status`\n),\n\nadd_connector_info as (\n\n    select \n        sync_log.*,\n        connector.connector_name,\n        connector.destination_id,\n        connector.destination_name\n    from sync_log \n    left join connector\n        on connector.connector_id = sync_log.connector_id\n),\n\nsync_timestamps as (\n\n    select\n        connector_id,\n        connector_name,\n        table_name,\n        event_subtype,\n        destination_id,\n        destination_name,\n        created_at as write_to_table_start,\n        min(case when event_subtype = 'write_to_table_end' then created_at else null end) \n            over (partition by connector_id, table_name order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as write_to_table_end,\n\n        max(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between UNBOUNDED PRECEDING and CURRENT ROW) as sync_start,\n\n        min(case when event_subtype = 'sync_end' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as sync_end, -- coalesce with next_sync_start\n\n        min(case when event_subtype = 'sync_start' then created_at else null end) \n            over (partition by connector_id order by created_at ROWS between CURRENT ROW AND UNBOUNDED FOLLOWING) as next_sync_start\n    from add_connector_info\n),\n\n-- this will be the base for every record in the final CTE\nlimit_to_table_starts as (\n\n    select *\n    from sync_timestamps \n    where event_subtype = 'write_to_table_start'\n),\n\nrecords_modified_log as (\n\n    select \n        connector_id,\n        created_at,\n        \n\n \n  json_extract_scalar(message_data, '$.table')\n\n as table_name,\n        \n\n \n  json_extract_scalar(message_data, '$.schema')\n\n as schema_name,\n        \n\n \n  json_extract_scalar(message_data, '$.operationType')\n\n as operation_type,\n        cast (\n\n \n  json_extract_scalar(message_data, '$.count')\n\n as INT64) as row_count\n    from sync_log \n    where event_subtype = 'records_modified'\n\n),\n\nsum_records_modified as (\n\n    select\n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name) as schema_name,\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end as sync_end,\n        sum(case when records_modified_log.operation_type = 'REPLACED_OR_INSERTED' then records_modified_log.row_count else 0 end) as sum_rows_replaced_or_inserted,\n        sum(case when records_modified_log.operation_type = 'UPDATED' then records_modified_log.row_count else 0 end) as sum_rows_updated,\n        sum(case when records_modified_log.operation_type = 'DELETED' then records_modified_log.row_count else 0 end) as sum_rows_deleted\n    from limit_to_table_starts\n    left join records_modified_log on \n        limit_to_table_starts.connector_id = records_modified_log.connector_id\n        and limit_to_table_starts.table_name = records_modified_log.table_name\n\n        -- confine it to one sync\n        and records_modified_log.created_at > limit_to_table_starts.sync_start \n        and records_modified_log.created_at < coalesce(limit_to_table_starts.sync_end, limit_to_table_starts.next_sync_start) \n\n    -- explicit group by needed for SQL Server\n    group by \n        limit_to_table_starts.connector_id,\n        limit_to_table_starts.connector_name,\n        coalesce(records_modified_log.schema_name, limit_to_table_starts.connector_name),\n        limit_to_table_starts.table_name,\n        limit_to_table_starts.destination_id,\n        limit_to_table_starts.destination_name,\n        limit_to_table_starts.write_to_table_start,\n        limit_to_table_starts.write_to_table_end,\n        limit_to_table_starts.sync_start,\n        case when limit_to_table_starts.sync_end > limit_to_table_starts.next_sync_start then null else limit_to_table_starts.sync_end end\n),\n\nfinal as (\n\n    select \n        *,\n        to_hex(md5(cast(coalesce(cast(schema_name as string), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(connector_id as string), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(destination_id as string), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(table_name as string), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(write_to_table_start as string), '_dbt_utils_surrogate_key_null_') as string))) as unique_table_sync_key, -- for incremental materialization \n        timestamp_trunc(\n        cast(sync_start as timestamp),\n        day\n    ) as sync_start_day -- for partitioning in databricks\n    from sum_records_modified\n)\n\nselect *\nfrom final", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__audit_table`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:24.708763Z", "completed_at": "2023-12-13T20:53:24.720735Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:24.722495Z", "completed_at": "2023-12-13T20:53:24.722504Z"}], "thread_id": "Thread-2", "execution_time": 0.017176151275634766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.not_null_fivetran_platform__audit_table_unique_table_sync_key.d6c37e48af", "compiled": true, "compiled_code": "\n    \n    \n\n\n\nselect unique_table_sync_key\nfrom `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__audit_table`\nwhere unique_table_sync_key is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:24.714974Z", "completed_at": "2023-12-13T20:53:24.721259Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:24.722916Z", "completed_at": "2023-12-13T20:53:24.722920Z"}], "thread_id": "Thread-3", "execution_time": 0.016366004943847656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.unique_fivetran_platform__audit_table_unique_table_sync_key.308ad058f7", "compiled": true, "compiled_code": "\n    \n    \n\nwith dbt_test__target as (\n\n  select unique_table_sync_key as unique_field\n  from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__audit_table`\n  where unique_table_sync_key is not null\n\n)\n\nselect\n    unique_field,\n    count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:23.285777Z", "completed_at": "2023-12-13T20:53:25.628385Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:25.629547Z", "completed_at": "2023-12-13T20:53:25.629562Z"}], "thread_id": "Thread-1", "execution_time": 2.3465681076049805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.fivetran_log.fivetran_platform__connector_daily_events", "compiled": true, "compiled_code": "-- depends_on: `dbt-package-testing`.`fivetran_platform_integration_tests`.`connector`\n\nwith connector as (\n    \n    select * \n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__connector_status`\n),\n\n-- grab api calls, schema changes, and record modifications\nlog_events as (\n\n    select \n        connector_id,\n        cast( timestamp_trunc(\n        cast(created_at as timestamp),\n        day\n    ) as date) as date_day,\n        case \n            when event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config') then 'schema_change' \n            else event_subtype end as event_subtype,\n\n        sum(case when event_subtype = 'records_modified' then cast( \n\n \n  json_extract_scalar(message_data, '$.count')\n\n as INT64 )\n        else 1 end) as count_events \n\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`stg_fivetran_platform__log`\n\n    where event_subtype in ('api_call', \n                            'records_modified', \n                            'create_table', 'alter_table', 'create_schema', 'change_schema_config') -- all schema changes\n                            \n        and connector_id is not null\n\n    group by connector_id, cast( timestamp_trunc(\n        cast(created_at as timestamp),\n        day\n    ) as date), event_subtype\n),\n\npivot_out_events as (\n\n    select\n        connector_id,\n        date_day,\n        max(case when event_subtype = 'api_call' then count_events else 0 end) as count_api_calls,\n        max(case when event_subtype = 'records_modified' then count_events else 0 end) as count_record_modifications,\n        max(case when event_subtype = 'schema_change' then count_events else 0 end) as count_schema_changes\n\n    from log_events\n    group by connector_id, date_day\n), \n\nconnector_event_counts as (\n\n    select\n        pivot_out_events.date_day,\n        pivot_out_events.count_api_calls,\n        pivot_out_events.count_record_modifications,\n        pivot_out_events.count_schema_changes,\n        connector.connector_name,\n        connector.connector_id,\n        connector.connector_type,\n        connector.destination_name,\n        connector.destination_id,\n        connector.set_up_at\n    from\n    connector left join pivot_out_events \n        on pivot_out_events.connector_id = connector.connector_id\n),\n\nspine as (\n\n    \n    \n    \n    \n    \n\n    select \n        cast(date_day as date) as date_day\n    from (\n        \n\n    \n\n\n\n\n\nwith rawdata as (\n\n    \n\n    \n\n    with p as (\n        select 0 as generated_number union all select 1\n    ), unioned as (\n\n    select\n\n    \n    p0.generated_number * power(2, 0)\n     + \n    \n    p1.generated_number * power(2, 1)\n     + \n    \n    p2.generated_number * power(2, 2)\n     + \n    \n    p3.generated_number * power(2, 3)\n     + \n    \n    p4.generated_number * power(2, 4)\n     + \n    \n    p5.generated_number * power(2, 5)\n     + \n    \n    p6.generated_number * power(2, 6)\n     + \n    \n    p7.generated_number * power(2, 7)\n     + \n    \n    p8.generated_number * power(2, 8)\n     + \n    \n    p9.generated_number * power(2, 9)\n     + \n    \n    p10.generated_number * power(2, 10)\n    \n    \n    + 1\n    as generated_number\n\n    from\n\n    \n    p as p0\n     cross join \n    \n    p as p1\n     cross join \n    \n    p as p2\n     cross join \n    \n    p as p3\n     cross join \n    \n    p as p4\n     cross join \n    \n    p as p5\n     cross join \n    \n    p as p6\n     cross join \n    \n    p as p7\n     cross join \n    \n    p as p8\n     cross join \n    \n    p as p9\n     cross join \n    \n    p as p10\n    \n    \n\n    )\n\n    select *\n    from unioned\n    where generated_number <= 1734\n    order by generated_number\n\n\n\n),\n\nall_periods as (\n\n    select (\n        \n\n        datetime_add(\n            cast( cast('2019-03-22' as date) as datetime),\n        interval row_number() over (order by 1) - 1 day\n        )\n\n\n    ) as date_day\n    from rawdata\n\n),\n\nfiltered as (\n\n    select *\n    from all_periods\n    where date_day <= \n\n        datetime_add(\n            cast( timestamp_trunc(\n        cast(current_timestamp as timestamp),\n        day\n    ) as datetime),\n        interval 1 week\n        )\n\n\n\n)\n\nselect * from filtered\n\n\n        \n \n    ) as date_spine\n),\n\nconnector_event_history as (\n\n    select\n        spine.date_day,\n        connector_event_counts.connector_name,\n        connector_event_counts.connector_id,\n        connector_event_counts.connector_type,\n        connector_event_counts.destination_name,\n        connector_event_counts.destination_id,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_api_calls\n            else 0\n        end) as count_api_calls,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_record_modifications\n            else 0\n        end) as count_record_modifications,\n        max(case \n            when spine.date_day = connector_event_counts.date_day then connector_event_counts.count_schema_changes\n            else 0\n        end) as count_schema_changes\n    from\n    spine join connector_event_counts\n        on spine.date_day  >= cast(timestamp_trunc(\n        cast(cast(connector_event_counts.set_up_at as date) as timestamp),\n        day\n    ) as date)\n\n    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id\n),\n\n-- now rejoin spine to get a complete calendar\njoin_event_history as (\n    \n    select\n        spine.date_day,\n        connector_event_history.connector_name,\n        connector_event_history.connector_id,\n        connector_event_history.connector_type,\n        connector_event_history.destination_name,\n        connector_event_history.destination_id,\n        max(connector_event_history.count_api_calls) as count_api_calls,\n        max(connector_event_history.count_record_modifications) as count_record_modifications,\n        max(connector_event_history.count_schema_changes) as count_schema_changes\n\n    from\n    spine left join connector_event_history\n        on spine.date_day = connector_event_history.date_day\n\n    group by spine.date_day, connector_name, connector_id, connector_type, destination_name, destination_id\n),\n\nfinal as (\n\n    select *\n    from join_event_history\n\n    where date_day <= cast(current_timestamp as date)\n)\n\nselect *\nfrom final", "relation_name": "`dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__connector_daily_events`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-13T20:53:25.633410Z", "completed_at": "2023-12-13T20:53:25.640587Z"}, {"name": "execute", "started_at": "2023-12-13T20:53:25.641436Z", "completed_at": "2023-12-13T20:53:25.641443Z"}], "thread_id": "Thread-4", "execution_time": 0.009959936141967773, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.fivetran_log.dbt_utils_unique_combination_of_columns_fivetran_platform__connector_daily_events_connector_id__destination_id__date_day.a279340e8f", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n    select\n        connector_id, destination_id, date_day\n    from `dbt-package-testing`.`fivetran_platform_integration_tests_fivetran_platform`.`fivetran_platform__connector_daily_events`\n    group by connector_id, destination_id, date_day\n    having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}], "elapsed_time": 4.027635097503662, "args": {"profiles_dir": "/Users/jamie.rodriguez/.dbt", "log_format_file": "debug", "quiet": false, "version_check": true, "which": "generate", "write_json": true, "send_anonymous_usage_stats": true, "use_colors": true, "compile": true, "favor_state": false, "partial_parse": true, "printer_width": 80, "static_parser": true, "log_path": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests/logs", "strict_mode": false, "project_dir": "/Users/jamie.rodriguez/Desktop/dbt_repos/Fivetran_platform/dbt_fivetran_log/integration_tests", "vars": {}, "select": [], "static": false, "populate_cache": true, "warn_error_options": {"include": [], "exclude": []}, "empty_catalog": false, "exclude": [], "macro_debugging": false, "defer": false, "show_resource_report": false, "log_level_file": "debug", "introspect": true, "log_format": "default", "indirect_selection": "eager", "cache_selected_only": false, "log_level": "info", "partial_parse_file_diff": true, "use_colors_file": true, "invocation_command": "dbt docs generate", "enable_legacy_logger": false, "print": true, "log_file_max_bytes": 10485760}}
\ No newline at end of file