Skip to content

Commit

Permalink
Correctly join calculated number of parcels per sale to sales view (#…
Browse files Browse the repository at this point in the history
…334)

* Adjust joining for calculated number of parcels per sale

* Add dbt test to detect NULL values for num_parcels_sale
  • Loading branch information
wrridgeway authored Mar 8, 2024
1 parent f24716d commit 899090a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion aws-athena/views/default-vw_pin_sale.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions dbt/models/default/schema/default.vw_pin_sale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 899090a

Please sign in to comment.