From 19f35d4eb5305d0506966e15812baeb48b0031c9 Mon Sep 17 00:00:00 2001 From: Stijnvandenbroek Date: Fri, 6 Mar 2026 11:55:44 +0000 Subject: [PATCH] chore: clean up dbt --- .../int_funda_listings_enriched.yml | 12 +++---- dbt/models/marts/elo_sample_listings.yml | 3 +- dbt/models/marts/funda_listings.yml | 18 +++++----- dbt/models/staging/sources.yml | 34 +++++++++---------- dbt/models/staging/stg_funda_listings.yml | 18 +++++----- .../staging/stg_funda_price_history.yml | 12 +++---- 6 files changed, 49 insertions(+), 48 deletions(-) diff --git a/dbt/models/intermediate/int_funda_listings_enriched.yml b/dbt/models/intermediate/int_funda_listings_enriched.yml index a5559b4..1f3a0e7 100644 --- a/dbt/models/intermediate/int_funda_listings_enriched.yml +++ b/dbt/models/intermediate/int_funda_listings_enriched.yml @@ -18,7 +18,7 @@ models: constraints: - type: not_null - type: unique - tests: + data_tests: - unique - not_null - name: tiny_id @@ -30,7 +30,7 @@ models: - name: city description: City name. data_type: text - tests: + data_tests: - not_null - name: postcode description: Dutch postal code. @@ -53,12 +53,12 @@ models: - name: status description: Listing status. data_type: text - tests: + data_tests: - not_null - name: offering_type description: Buy or rent. data_type: text - tests: + data_tests: - not_null - name: object_type description: Property type. @@ -146,12 +146,12 @@ models: data_type: boolean constraints: - type: not_null - tests: + data_tests: - not_null - name: ingested_at description: Timestamp when the raw row was first written. data_type: timestamptz constraints: - type: not_null - tests: + data_tests: - not_null diff --git a/dbt/models/marts/elo_sample_listings.yml b/dbt/models/marts/elo_sample_listings.yml index 29bdd0b..a7a33c4 100644 --- a/dbt/models/marts/elo_sample_listings.yml +++ b/dbt/models/marts/elo_sample_listings.yml @@ -11,6 +11,7 @@ models: unique_key: global_id on_schema_change: fail schema: elo + alias: sample_listings contract: enforced: true meta: @@ -23,7 +24,7 @@ models: constraints: - type: not_null - type: unique - tests: + data_tests: - unique - not_null - relationships: diff --git a/dbt/models/marts/funda_listings.yml b/dbt/models/marts/funda_listings.yml index e5d41ff..eeef4ca 100644 --- a/dbt/models/marts/funda_listings.yml +++ b/dbt/models/marts/funda_listings.yml @@ -18,7 +18,7 @@ models: constraints: - type: not_null - type: unique - tests: + data_tests: - unique - not_null - name: tiny_id @@ -35,7 +35,7 @@ models: data_type: text constraints: - type: not_null - tests: + data_tests: - not_null - name: postcode description: Dutch postal code. @@ -66,7 +66,7 @@ models: data_type: text constraints: - type: not_null - tests: + data_tests: - not_null - name: construction_type description: Construction method. @@ -80,7 +80,7 @@ models: - name: living_area description: Interior floor area in m². data_type: integer - tests: + data_tests: - dbt_utils.expression_is_true: expression: "> 0" where: "living_area is not null" @@ -117,7 +117,7 @@ models: - name: current_price description: Current asking or rental price in euros. data_type: bigint - tests: + data_tests: - dbt_utils.expression_is_true: expression: "> 0" where: "current_price is not null" @@ -138,7 +138,7 @@ models: data_type: boolean constraints: - type: not_null - tests: + data_tests: - not_null - name: photo_count description: Number of photos on the listing. @@ -154,7 +154,7 @@ models: data_type: text constraints: - type: not_null - tests: + data_tests: - not_null - name: publication_date description: Listing publication date. @@ -164,12 +164,12 @@ models: data_type: timestamptz constraints: - type: not_null - tests: + data_tests: - not_null - name: price_per_sqm description: Current price divided by living area in m². data_type: numeric - tests: + data_tests: - dbt_utils.expression_is_true: expression: "> 0" where: "price_per_sqm is not null" diff --git a/dbt/models/staging/sources.yml b/dbt/models/staging/sources.yml index 97c6c5b..689c48d 100644 --- a/dbt/models/staging/sources.yml +++ b/dbt/models/staging/sources.yml @@ -18,32 +18,32 @@ sources: columns: - name: global_id description: Funda internal listing ID. - tests: + data_tests: - unique - not_null - name: title description: Property address / title. - tests: + data_tests: - not_null - name: city description: City name. - tests: + data_tests: - not_null - name: price description: Asking or rental price in euros. - name: is_active description: False when the listing has not appeared in search results for 7+ days. - tests: + data_tests: - not_null - accepted_values: values: [true, false] - name: last_seen_at description: Timestamp the listing was last returned by the Funda search API. - tests: + data_tests: - not_null - name: ingested_at description: Timestamp when the row was first written. - tests: + data_tests: - not_null - name: listing_details @@ -59,36 +59,36 @@ sources: columns: - name: global_id description: Funda internal listing ID. - tests: + data_tests: - not_null - relationships: to: source('raw_funda', 'search_results') field: global_id - name: tiny_id description: Public ID used in Funda URLs. - tests: + data_tests: - not_null - name: price description: Asking or rental price in euros. - name: status description: Listing status (available or sold). - tests: + data_tests: - not_null - accepted_values: values: ["available", "sold", "withdrawn", "under_negotiation"] - name: is_stale description: True when the parent search listing is no longer active. - tests: + data_tests: - not_null - accepted_values: values: [true, false] - name: last_fetched_at description: Timestamp of the most recent detail fetch. - tests: + data_tests: - not_null - name: ingested_at description: Timestamp when the row was first written. - tests: + data_tests: - not_null - name: price_history @@ -104,7 +104,7 @@ sources: columns: - name: global_id description: Funda internal listing ID. - tests: + data_tests: - not_null - relationships: to: source('raw_funda', 'listing_details') @@ -113,21 +113,21 @@ sources: description: Price at this point in time. - name: date description: Date of this price event. - tests: + data_tests: - not_null - name: source description: Price data source (funda or woz). - tests: + data_tests: - not_null - accepted_values: values: ["Funda", "WOZ"] - name: status description: Price event type (asking_price, sold, or woz). - tests: + data_tests: - not_null - accepted_values: values: ["asking_price", "sold", "woz", "withdrawn"] - name: ingested_at description: Timestamp when the row was written. - tests: + data_tests: - not_null diff --git a/dbt/models/staging/stg_funda_listings.yml b/dbt/models/staging/stg_funda_listings.yml index 5bf3a3a..cd74f94 100644 --- a/dbt/models/staging/stg_funda_listings.yml +++ b/dbt/models/staging/stg_funda_listings.yml @@ -16,7 +16,7 @@ models: constraints: - type: not_null - type: unique - tests: + data_tests: - unique - not_null - name: tiny_id @@ -24,7 +24,7 @@ models: data_type: text constraints: - type: not_null - tests: + data_tests: - not_null - name: title description: Property address / title. @@ -34,7 +34,7 @@ models: data_type: text constraints: - type: not_null - tests: + data_tests: - not_null - name: postcode description: Dutch postal code. @@ -51,7 +51,7 @@ models: - name: price description: Asking or rental price in euros. data_type: bigint - tests: + data_tests: - dbt_utils.expression_is_true: expression: ">= 0" where: "price is not null" @@ -63,14 +63,14 @@ models: data_type: text constraints: - type: not_null - tests: + data_tests: - not_null - accepted_values: values: ["available", "sold", "withdrawn", "under_negotiation"] - name: offering_type description: Buy or rent. data_type: text - tests: + data_tests: - not_null - name: object_type description: Property type (house, apartment, etc.). @@ -87,14 +87,14 @@ models: - name: energy_label description: Dutch energy performance label (A–G). data_type: text - tests: + data_tests: - accepted_values: values: ["A4", "A3", "A2", "A1", "A", "B", "C", "D", "E", "F", "G"] where: "energy_label is not null" - name: living_area description: Interior floor area in m². data_type: integer - tests: + data_tests: - dbt_utils.expression_is_true: expression: "> 0" where: "living_area is not null" @@ -154,5 +154,5 @@ models: data_type: timestamptz constraints: - type: not_null - tests: + data_tests: - not_null diff --git a/dbt/models/staging/stg_funda_price_history.yml b/dbt/models/staging/stg_funda_price_history.yml index 32c6d2c..2a79c05 100644 --- a/dbt/models/staging/stg_funda_price_history.yml +++ b/dbt/models/staging/stg_funda_price_history.yml @@ -15,7 +15,7 @@ models: data_type: text constraints: - type: not_null - tests: + data_tests: - not_null - relationships: to: ref('stg_funda_listings') @@ -23,7 +23,7 @@ models: - name: price description: Price at this point in time. data_type: bigint - tests: + data_tests: - dbt_utils.expression_is_true: expression: ">= 0" where: "price is not null" @@ -35,7 +35,7 @@ models: data_type: text constraints: - type: not_null - tests: + data_tests: - not_null - name: price_timestamp description: Timestamp of this price event. @@ -45,7 +45,7 @@ models: data_type: text constraints: - type: not_null - tests: + data_tests: - not_null - accepted_values: values: ["Funda", "WOZ"] @@ -54,7 +54,7 @@ models: data_type: text constraints: - type: not_null - tests: + data_tests: - not_null - accepted_values: values: ["asking_price", "sold", "woz", "withdrawn"] @@ -63,5 +63,5 @@ models: data_type: timestamptz constraints: - type: not_null - tests: + data_tests: - not_null