From b043a3ced6c8f1731ce68d2f627fa9d536580f35 Mon Sep 17 00:00:00 2001 From: Sweaty Handshake Date: Fri, 8 Mar 2024 16:28:29 +0000 Subject: [PATCH 1/2] Adjust joining for calculated number of parcels per sale --- aws-athena/views/default-vw_pin_sale.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aws-athena/views/default-vw_pin_sale.sql b/aws-athena/views/default-vw_pin_sale.sql index f017ff744..bdf1b7833 100644 --- a/aws-athena/views/default-vw_pin_sale.sql +++ b/aws-athena/views/default-vw_pin_sale.sql @@ -130,7 +130,8 @@ unique_sales AS ( ) AS sale_filter_deed_type FROM {{ source('iasworld', 'sales') }} AS sales LEFT JOIN calculated - ON sales.instruno = calculated.instruno + ON NULLIF(REPLACE(sales.instruno, 'D', ''), '') + = calculated.instruno LEFT JOIN town_class AS tc ON sales.parid = tc.parid From b70eab5a5d9f0fafaea66b0b88b9b5ecfb1f736f Mon Sep 17 00:00:00 2001 From: Sweaty Handshake Date: Fri, 8 Mar 2024 17:19:20 +0000 Subject: [PATCH 2/2] Add dbt test to detect NULL values for num_parcels_sale --- dbt/models/default/schema/default.vw_pin_sale.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dbt/models/default/schema/default.vw_pin_sale.yml b/dbt/models/default/schema/default.vw_pin_sale.yml index dc83c129d..bf295de4d 100644 --- a/dbt/models/default/schema/default.vw_pin_sale.yml +++ b/dbt/models/default/schema/default.vw_pin_sale.yml @@ -77,6 +77,9 @@ models: - row_count: name: default_vw_pin_sale_row_count above: 2477674 # as of 2023-11-22 + - not_null: + name: default_vw_pin_sale_num_parcels_sale_not_null + column_name: num_parcels_sale # TODO: Sale is validated (after sales validation has been added to # iasworld) # TODO: Validation is catching obvious outliers