diff --git a/aws-athena/views/reporting-vw_ratio_stats.sql b/aws-athena/views/reporting-vw_ratio_stats.sql index cedb918bd..03fa2e49b 100644 --- a/aws-athena/views/reporting-vw_ratio_stats.sql +++ b/aws-athena/views/reporting-vw_ratio_stats.sql @@ -1,5 +1,5 @@ -- View containing ratios by pin, intended to feed the --- glue job 'reporting-ratio_stats'. +-- ratio_stats dbt python model {{ config( materialized='table' diff --git a/dbt/models/reporting/docs.md b/dbt/models/reporting/docs.md index 57330d4ba..ede496ab8 100644 --- a/dbt/models/reporting/docs.md +++ b/dbt/models/reporting/docs.md @@ -10,6 +10,15 @@ reporting Tableau dashboards. `property_group` {% enddocs %} +# ratio_stats_input + +{% docs table_ratio_stats_input %} +View to feed the Python dbt job that creates the `reporting.ratio_stats` table. +Feeds public reporting assets. + +**Primary Key**: `year`, `pin`, `assessment_stage` +{% enddocs %} + # res_report_summary {% docs table_res_report_summary %} @@ -79,15 +88,6 @@ The assessment stages are: **Primary Key**: `year`, `pin`, `stage_name` {% enddocs %} -# vw_ratio_stats - -{% docs view_vw_ratio_stats %} -View to feed the `reporting.ratio_stats` table and Glue job. -Feeds public reporting assets. - -**Primary Key**: `year`, `pin`, `assessment_stage` -{% enddocs %} - # vw_res_report_summary {% docs view_vw_res_report_summary %} diff --git a/dbt/models/reporting/reporting.ratio_stats.py b/dbt/models/reporting/reporting.ratio_stats.py index 191513d82..8956d3f19 100644 --- a/dbt/models/reporting/reporting.ratio_stats.py +++ b/dbt/models/reporting/reporting.ratio_stats.py @@ -234,7 +234,7 @@ def report_summarise(df, geography_id, geography_type): def model(dbt, spark_session): dbt.config(materialized="table") - input = dbt.ref("reporting.vw_ratio_stats") + input = dbt.ref("reporting.ratio_stats_input") df = pd.concat( [ diff --git a/dbt/models/reporting/reporting.vw_ratio_stats.sql b/dbt/models/reporting/reporting.ratio_stats_input.sql similarity index 100% rename from dbt/models/reporting/reporting.vw_ratio_stats.sql rename to dbt/models/reporting/reporting.ratio_stats_input.sql diff --git a/dbt/models/reporting/schema.yml b/dbt/models/reporting/schema.yml index b433dc2b9..1dada74b7 100644 --- a/dbt/models/reporting/schema.yml +++ b/dbt/models/reporting/schema.yml @@ -165,31 +165,31 @@ models: where: CAST(year AS int) < {{ var('test_qc_year_start') }} error_if: ">21" # as of 2024-04-01 - - name: reporting.vw_ratio_stats - description: '{{ doc("view_vw_ratio_stats") }}' + - name: reporting.ratio_stats_input + description: '{{ doc("table_ratio_stats_input") }}' tests: - unique_combination_of_columns: - name: reporting_vw_ratio_stats_unique_by_keys + name: reporting_ratio_stats_input_unique_by_keys combination_of_columns: - pin - year - assessment_stage - sale_price - expression_is_true: - name: reporting_vw_ratio_stats_no_nulls + name: reporting_ratio_stats_input_no_nulls expression: | property_group IS NOT NULL AND assessment_stage IS NOT NULL AND triad IS NOT NULL AND township_code IS NOT NULL - expression_is_true: - name: reporting_vw_ratio_stats_sale_year_equals_year_minus_one + name: reporting_ratio_stats_input_sale_year_equals_year_minus_one expression: CAST(sale_year AS INTEGER) = CAST(year AS INTEGER) - 1 additional_select_columns: - sale_year - year - expression_is_true: - name: reporting_vw_ratio_stats_ratio_greater_than_zero + name: reporting_ratio_stats_input_ratio_greater_than_zero expression: ratio >= 0 additional_select_columns: - ratio