some more changes

This commit is contained in:
2026-02-17 23:11:16 +01:00
parent f88d870db5
commit 24a505e9bf
20 changed files with 184 additions and 60 deletions

5
dbt/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
target/
dbt_packages/
logs/
dbt_internal_packages/

15
dbt/README.md Normal file
View File

@@ -0,0 +1,15 @@
Welcome to your new dbt project!
### Using the starter project
Try running the following commands:
- dbt run
- dbt test
### Resources:
- Learn more about dbt [in the docs](https://docs.getdbt.com/docs/introduction)
- Check out [Discourse](https://discourse.getdbt.com/) for commonly asked questions and answers
- Join the [chat](https://community.getdbt.com/) on Slack for live discussions and support
- Find [dbt events](https://events.getdbt.com) near you
- Check out [the blog](https://blog.getdbt.com/) for the latest news on dbt's development and best practices

0
dbt/analyses/.gitkeep Normal file
View File

33
dbt/dbt_project.yml Normal file
View File

@@ -0,0 +1,33 @@
# Name your project! Project names should contain only lowercase characters
# and underscores. A good package name should reflect your organization's
# name or the intended use of these models
name: "fundamnit"
version: "1.0.0"
# This setting configures which "profile" dbt uses for this project.
profile: "fundamnit"
# These configurations specify where dbt should look for different types of files.
# The `model-paths` config, for example, states that models in this project can be
# found in the "models/" directory. You probably won't need to change these!
model-paths: ["models"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["macros"]
snapshot-paths: ["snapshots"]
clean-targets: # directories to be removed by `dbt clean`
- "target"
- "dbt_packages"
# Configuring models
# Full documentation: https://docs.getdbt.com/docs/configuring-models
# In this example config, we tell dbt to build all models in the example/
# directory as views. These settings can be overridden in the individual model
# files using the `{{ config(...) }}` macro.
models:
fundamnit:
staging:
+materialized: view

View File

@@ -0,0 +1,3 @@
{% macro extract_numeric(column_name) %}
NULLIF(regexp_replace({{ column_name }}, '[^0-9]','','g'), '')::numeric
{% endmacro %}

View File

@@ -0,0 +1,5 @@
{{ config(materialized='table') }}
select
*
from
{{ ref('stg_listings') }}

View File

@@ -0,0 +1,6 @@
version: 2
sources:
- name: funda
tables:
- name: raw_listings

View File

@@ -0,0 +1,53 @@
with source as (
select
*
from
{{ source('funda', 'raw_listings') }}
),
flattened_json as (
select
(data#>>'{globalId}')::int as listing_id,
(data#>>'{parentProject,globalId}')::int as parent_id,
(data#>>'{address,addressTitle}')::varchar as title,
(data#>>'{tracking,listing_offering_type}')::varchar as offering_type,
(data#>>'{tracking,listing_type}')::varchar as listing_type,
(data#>>'{tracking,listing_status}')::varchar as listing_status,
(data#>>'{advertising,targetingOptions,aantalkamers}')::int as rooms,
(data#>>'{featuresFastView,energyLabel}')::varchar as energy_label,
{{ extract_numeric("data#>>'{featuresFastView,livingArea}'") }} as living_area,
{{ extract_numeric("data#>>'{featuresFastView,plotArea}'") }} as plot_area,
(data#>>'{price,numericPrice}')::int as price,
(data#>>'{isSoldOrRented}')::boolean as is_sold,
(data#>>'{advertising,targetingOptions,balkon}')::boolean as has_balcony,
(data#>>'{advertising,targetingOptions,tuin}')::boolean as has_garden,
(data#>>'{advertising,targetingOptions,parkeergelegenheidopafgeslotenterrein}')::boolean as has_closed_parking,
(data#>>'{advertising,targetingOptions,parkeergelegenheidopeigenterrein}')::boolean as has_private_parking,
(data#>>'{address,country}')::varchar as country,
(data#>>'{address,province}')::varchar as province,
initcap((data#>>'{advertising,targetingOptions,gemeente}')) as municipality,
(data#>>'{address,city}')::varchar as city,
(data#>>'{address,neighborhood,name}')::varchar as neighborhood,
(data#>>'{address,postcode}')::varchar as postcode,
(data#>>'{tracking,listing_house_no}')::varchar as house_number,
(data#>>'{tracking,listing_house_no_addition}')::varchar as house_number_addition,
(data#>>'{coordinates,lng}')::float as longitude,
(data#>>'{coordinates,lat}')::float as latitude,
(data#>>'{googleMapsObjectUrl}')::varchar as google_maps_url,
(data#>>'{canonicalUrl}')::varchar as listing_url
from
source
)
select
*
from
flattened_json

5
dbt/package-lock.yml Normal file
View File

@@ -0,0 +1,5 @@
packages:
- package: dbt-labs/dbt_utils
name: dbt_utils
version: 1.3.1
sha1_hash: a58234d0b6335a94dffedc7a19f7278eaed2ecda

3
dbt/packages.yml Normal file
View File

@@ -0,0 +1,3 @@
packages:
- package: dbt-labs/dbt_utils
version: 1.3.1

0
dbt/seeds/.gitkeep Normal file
View File

0
dbt/snapshots/.gitkeep Normal file
View File

0
dbt/tests/.gitkeep Normal file
View File