From 15b9af7af5fafeb4b8868270bf65fb424f4a3cdf Mon Sep 17 00:00:00 2001 From: Dan Snow Date: Thu, 2 May 2024 14:39:50 +0000 Subject: [PATCH] Rename vw_ratio_stats to ratio_stats_input --- .../reporting-ratio_stats_input.sql} | 2 +- dbt/models/reporting/docs.md | 18 +++++++++--------- dbt/models/reporting/reporting.ratio_stats.py | 2 +- .../reporting/reporting.ratio_stats_input.sql | 1 + .../reporting/reporting.vw_ratio_stats.sql | 1 - dbt/models/reporting/schema.yml | 12 ++++++------ 6 files changed, 18 insertions(+), 18 deletions(-) rename aws-athena/{views/reporting-vw_ratio_stats.sql => ctas/reporting-ratio_stats_input.sql} (98%) create mode 120000 dbt/models/reporting/reporting.ratio_stats_input.sql delete mode 120000 dbt/models/reporting/reporting.vw_ratio_stats.sql diff --git a/aws-athena/views/reporting-vw_ratio_stats.sql b/aws-athena/ctas/reporting-ratio_stats_input.sql similarity index 98% rename from aws-athena/views/reporting-vw_ratio_stats.sql rename to aws-athena/ctas/reporting-ratio_stats_input.sql index cedb918bd..03fa2e49b 100644 --- a/aws-athena/views/reporting-vw_ratio_stats.sql +++ b/aws-athena/ctas/reporting-ratio_stats_input.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.ratio_stats_input.sql b/dbt/models/reporting/reporting.ratio_stats_input.sql new file mode 120000 index 000000000..109698b5d --- /dev/null +++ b/dbt/models/reporting/reporting.ratio_stats_input.sql @@ -0,0 +1 @@ +../../../aws-athena/ctas/reporting-ratio_stats_input.sql \ No newline at end of file diff --git a/dbt/models/reporting/reporting.vw_ratio_stats.sql b/dbt/models/reporting/reporting.vw_ratio_stats.sql deleted file mode 120000 index f50270b1a..000000000 --- a/dbt/models/reporting/reporting.vw_ratio_stats.sql +++ /dev/null @@ -1 +0,0 @@ -../../../aws-athena/views/reporting-vw_ratio_stats.sql \ No newline at end of file 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