diff --git a/.changes/unreleased/Features-20240609-173247.yaml b/.changes/unreleased/Features-20240609-173247.yaml new file mode 100644 index 0000000..d03008c --- /dev/null +++ b/.changes/unreleased/Features-20240609-173247.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Remove warehouse_cluster_status model +time: 2024-06-09T17:32:47.794928-07:00 +custom: + Author: NiallRees + PR: "158" diff --git a/models/warehouse_cluster_status.sql b/models/warehouse_cluster_status.sql deleted file mode 100644 index a12da68..0000000 --- a/models/warehouse_cluster_status.sql +++ /dev/null @@ -1,37 +0,0 @@ -{{ config(materialized='table') }} - -with -stop_threshold as ( - select max(timestamp) as timestamp - from {{ ref('stg_warehouse_events_history') }} -), - -warehouse_cluster_status_base as ( - select - warehouse_id, - warehouse_name, - cluster_number, - timestamp as valid_from, - lead(timestamp) over (partition by warehouse_id, cluster_number order by timestamp asc) as valid_to, - event_name = 'RESUME_CLUSTER' as is_active - from {{ ref('stg_warehouse_events_history') }} - where - event_name in ('RESUME_CLUSTER', 'SUSPEND_CLUSTER') - and event_state = 'COMPLETED' -), - -warehouse_cluster_status as ( - select - warehouse_cluster_status_base.warehouse_id, - warehouse_cluster_status_base.warehouse_name, - warehouse_cluster_status_base.cluster_number, - warehouse_cluster_status_base.is_active, - warehouse_cluster_status_base.valid_from, - coalesce(warehouse_cluster_status_base.valid_to, stop_threshold.timestamp) as valid_to - from warehouse_cluster_status_base - cross join stop_threshold -) - -select * -from warehouse_cluster_status -order by valid_from diff --git a/models/warehouse_cluster_status.yml b/models/warehouse_cluster_status.yml deleted file mode 100644 index 61c1a95..0000000 --- a/models/warehouse_cluster_status.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: 2 - -models: - - name: warehouse_cluster_status - description: This model tracks active periods for each cluster in a warehouse. It contains 1 row per warehouse-cluster period. - columns: - - name: warehouse_id - description: The unique warehouse ID (assigned by Snowflake) that corresponds to the warehouse name in your account. - - name: warehouse_name - description: The name of the warehouse in your account. - - name: cluster_number - description: The number of the cluster. For a single-cluster warehouse, this will always be 1. - - name: is_active - description: True if the cluster was running during the time period, otherwise False. - - name: valid_from - description: Timestamp for the beginning of the period. - - name: valid_to - description: Timestamp for the end of the period.