From c87efc7d1d4b5b4528668537cca51854ef55b6f0 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Wed, 5 Jun 2024 16:50:14 +0200 Subject: [PATCH 1/8] low-hanging fruit refactor. Fix name --- models/staging/core/_core_sources.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/staging/core/_core_sources.yml b/models/staging/core/_core_sources.yml index 12ae258..58c7a16 100644 --- a/models/staging/core/_core_sources.yml +++ b/models/staging/core/_core_sources.yml @@ -167,7 +167,7 @@ sources: - name: _airbyte_meta data_type: jsonb description: "{{ doc('_airbyte_meta_desc') }}" - - name: superhog_user + - name: SuperhogUser identifier: SuperhogUser - name: UserVerificationStatus identifier: UserVerificationStatus From 60063b5455d1fff2f02a3bf773bc042e78e4d724 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Wed, 5 Jun 2024 17:15:35 +0200 Subject: [PATCH 2/8] propagate fix --- models/staging/core/stg_core__superhog_user.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/staging/core/stg_core__superhog_user.sql b/models/staging/core/stg_core__superhog_user.sql index 39e875c..5f3468b 100644 --- a/models/staging/core/stg_core__superhog_user.sql +++ b/models/staging/core/stg_core__superhog_user.sql @@ -7,7 +7,7 @@ }} with - raw_superhog_user as (select * from {{ source("core", "superhog_user") }}), + raw_superhog_user as (select * from {{ source("core", "SuperhogUser") }}), stg_core__superhog_user as ( select {{ adapter.quote("Avatar") }} as avatar, From f216e7708a58e1ffba7ecbcd94ceb0b2872d4b39 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Wed, 5 Jun 2024 17:24:39 +0200 Subject: [PATCH 3/8] add accommodation to sources --- models/staging/core/_core_sources.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/models/staging/core/_core_sources.yml b/models/staging/core/_core_sources.yml index 58c7a16..059c6c0 100644 --- a/models/staging/core/_core_sources.yml +++ b/models/staging/core/_core_sources.yml @@ -205,3 +205,5 @@ sources: identifier: Integration - name: IntegrationType identifier: IntegrationType + - name: Accommodation + identifier: Accommodation From 26ce452a0cd82ad0c0264077dff4816033e537b9 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Wed, 5 Jun 2024 17:24:59 +0200 Subject: [PATCH 4/8] accommodation staging model --- .../staging/core/stg_core__accommodation.sql | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 models/staging/core/stg_core__accommodation.sql diff --git a/models/staging/core/stg_core__accommodation.sql b/models/staging/core/stg_core__accommodation.sql new file mode 100644 index 0000000..b28eedb --- /dev/null +++ b/models/staging/core/stg_core__accommodation.sql @@ -0,0 +1,30 @@ +with + raw_accommodation as (select * from {{ source("core", "Accommodation") }}), + stg_core__accommodation as ( + select + {{ adapter.quote("AccommodationId") }} as id_accommodation, + {{ adapter.quote("CreatedByUserId") }} as id_creating_user, + {{ adapter.quote("PaymentValidationSetId") }} as id_payment_validation_set, + {{ adapter.quote("FriendlyName") }} as friendly_name, + {{ adapter.quote("CountryId") }} as id_country, + {{ adapter.quote("IsActive") }} as is_active, + {{ adapter.quote("Town") }} as town, + {{ adapter.quote("Postcode") }} as postcode, + {{ adapter.quote("AddressLine1") }} as address_line_1, + {{ adapter.quote("AddressLine2") }} as address_line_2, + {{ adapter.quote("VerificationLevel") }} as verification_level, + {{ adapter.quote("ManuallyValidated") }} as manually_validated, + {{ adapter.quote("FloorArea") }} as floor_area, + {{ adapter.quote("NumberOfFloors") }} as number_of_floors, + {{ adapter.quote("NumberOfBedrooms") }} as number_of_bedrooms, + {{ adapter.quote("NumberOfBathrooms") }} as number_of_bathrooms, + {{ adapter.quote("NumberOfOtherRooms") }} as number_of_other_rooms, + {{ adapter.quote("DetailsOfConstruction") }} as construction_details, + {{ adapter.quote("CreatedDate") }} as created_at_utc, + {{ adapter.quote("UpdatedDate") }} as updated_at_utc, + {{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc + + from raw_accommodation + ) +select * +from stg_core__accommodation From 21f9a63db27067d00dc01d07655ee5fa07892057 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Wed, 5 Jun 2024 17:30:19 +0200 Subject: [PATCH 5/8] add test --- models/staging/core/schema.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/models/staging/core/schema.yml b/models/staging/core/schema.yml index 5df73b6..7249511 100644 --- a/models/staging/core/schema.yml +++ b/models/staging/core/schema.yml @@ -106,3 +106,10 @@ models: tests: - unique - not_null + + - name: stg_core__accommodation + columns: + - name: id_accommodation + tests: + - unique + - not_null From cd8fc9893dc1cfb0127c4bb92007f2521fc30a3e Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Wed, 5 Jun 2024 17:31:19 +0200 Subject: [PATCH 6/8] add accommodationtouser in sources --- models/staging/core/_core_sources.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/models/staging/core/_core_sources.yml b/models/staging/core/_core_sources.yml index 059c6c0..eff5619 100644 --- a/models/staging/core/_core_sources.yml +++ b/models/staging/core/_core_sources.yml @@ -207,3 +207,5 @@ sources: identifier: IntegrationType - name: Accommodation identifier: Accommodation + - name: AccommodationToUser + identifier: AccommodationToUser From 85a299da960469b85bffc541c9afc5b7759bfcc8 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Wed, 5 Jun 2024 17:38:02 +0200 Subject: [PATCH 7/8] staging accommodation to user --- .../core/stg_core__accommodation_to_user.sql | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 models/staging/core/stg_core__accommodation_to_user.sql diff --git a/models/staging/core/stg_core__accommodation_to_user.sql b/models/staging/core/stg_core__accommodation_to_user.sql new file mode 100644 index 0000000..7841d02 --- /dev/null +++ b/models/staging/core/stg_core__accommodation_to_user.sql @@ -0,0 +1,18 @@ +with + raw_accommodation_to_user as ( + select * from {{ source("core", "AccommodationToUser") }} + ), + stg_core__accommodation_to_user as ( + select + {{ adapter.quote("SuperhogUserId") }} as id_user_owner, + {{ adapter.quote("AccommodationId") }} as id_accommodation, + {{ adapter.quote("AccommodationToUserId") }} as id_accommodation_to_user, + {{ adapter.quote("AccommodationUserType") }} as accommodation_user_type, + {{ adapter.quote("CreatedDate") }} as created_at_utc, + {{ adapter.quote("UpdatedDate") }} as updated_at_utc, + {{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc + + from raw_accommodation_to_user + ) +select * +from stg_core__accommodation_to_user From 7aa100d115841da0887b959c3be51df1020ffada Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Wed, 5 Jun 2024 17:39:53 +0200 Subject: [PATCH 8/8] add tests --- models/staging/core/schema.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/models/staging/core/schema.yml b/models/staging/core/schema.yml index 7249511..604588d 100644 --- a/models/staging/core/schema.yml +++ b/models/staging/core/schema.yml @@ -113,3 +113,10 @@ models: tests: - unique - not_null + + - name: stg_core__accommodation_to_user + columns: + - name: id_accommodation_to_user + tests: + - unique + - not_null