Removed accommodations from the model
This commit is contained in:
parent
2a897c6ead
commit
431182a098
2 changed files with 93 additions and 38 deletions
|
|
@ -1,8 +1,4 @@
|
|||
with
|
||||
stg_core__accommodation_to_user as (
|
||||
select * from {{ ref("stg_core__accommodation_to_user") }}
|
||||
),
|
||||
stg_core__accommodation as (select * from {{ ref("stg_core__accommodation") }}),
|
||||
stg_core__user as (select * from {{ ref("stg_core__user") }}),
|
||||
stg_core__verification_set as (
|
||||
select id_user_host, id_verification_set, is_active
|
||||
|
|
@ -11,41 +7,25 @@ with
|
|||
stg_core__verification_set_to_verification_type as (
|
||||
select id_verification_set, id_verification_type
|
||||
from {{ ref("stg_core__verification_set_to_verification_type") }}
|
||||
)
|
||||
select
|
||||
atu.id_user_owner as id_user_host,
|
||||
atu.id_accommodation,
|
||||
atu.accommodation_user_type,
|
||||
atu.created_at_utc,
|
||||
atu.updated_at_utc,
|
||||
ac.friendly_name,
|
||||
ac.id_country,
|
||||
ac.is_active,
|
||||
ac.town,
|
||||
ac.address_line_1,
|
||||
us.email,
|
||||
us.joined_at_utc,
|
||||
us.joined_date_utc,
|
||||
us.last_name,
|
||||
us.user_name,
|
||||
us.first_name,
|
||||
us.company_name,
|
||||
us.phone_number
|
||||
from stg_core__accommodation_to_user atu
|
||||
left join stg_core__accommodation ac on atu.id_accommodation = ac.id_accommodation
|
||||
left join stg_core__user us on atu.id_user_owner = us.id_user
|
||||
inner join
|
||||
(
|
||||
select
|
||||
vs.id_user_host,
|
||||
vs.id_verification_set,
|
||||
vstvt.id_verification_set,
|
||||
vstvt.id_verification_type
|
||||
),
|
||||
hosts_with_check_in_cover as (
|
||||
select vs.id_user_host
|
||||
from stg_core__verification_set vs
|
||||
left join
|
||||
stg_core__verification_set_to_verification_type vstvt
|
||||
on vs.id_verification_set = vstvt.id_verification_set
|
||||
where vs.is_active is true and vstvt.id_verification_type = 15
|
||||
) as vsat
|
||||
on vsat.id_user_host = atu.id_user_owner
|
||||
order by atu.id_user_owner, atu.id_accommodation
|
||||
)
|
||||
select
|
||||
u.id_user,
|
||||
u.last_name,
|
||||
u.user_name,
|
||||
u.first_name,
|
||||
u.email,
|
||||
u.phone_number,
|
||||
u.joined_at_utc,
|
||||
u.joined_date_utc,
|
||||
u.billing_town,
|
||||
u.company_name
|
||||
from stg_core__user u
|
||||
inner join hosts_with_check_in_cover hcih on hcih.id_user_host = u.id_user
|
||||
|
|
|
|||
|
|
@ -813,4 +813,79 @@ models:
|
|||
|
||||
- name: has_been_booked_within_last_12_months
|
||||
data_type: boolean
|
||||
description: If the deal has had a booking created in the past 12 months.
|
||||
description: If the deal has had a booking created in the past 12 months.
|
||||
- name: int_core__check_in_cover_users_accommodations
|
||||
description:
|
||||
columns:
|
||||
- name: id_user_host
|
||||
data_type: character varying
|
||||
description: Unique id for Superhog host
|
||||
|
||||
- name: id_accommodation
|
||||
data_type: bigint
|
||||
description: Unique id for accommodation
|
||||
|
||||
- name: accommodation_user_type
|
||||
data_type: bigint
|
||||
description: ""
|
||||
|
||||
- name: created_at_utc
|
||||
data_type: timestamp without time zone
|
||||
description: Date and time of creation of the accommodation
|
||||
|
||||
- name: updated_at_utc
|
||||
data_type: timestamp without time zone
|
||||
description: Date and time of last update of the accommodation
|
||||
|
||||
- name: friendly_name
|
||||
data_type: character varying
|
||||
description: Name of the accommodation
|
||||
|
||||
- name: id_country
|
||||
data_type: bigint
|
||||
description: Country Id of the accommodation
|
||||
|
||||
- name: is_active
|
||||
data_type: boolean
|
||||
description: Boolean value if the accommodation is active
|
||||
|
||||
- name: town
|
||||
data_type: character varying
|
||||
description: Town where accommodation is located
|
||||
|
||||
- name: address_line_1
|
||||
data_type: character varying
|
||||
description: Address of the accommodation
|
||||
|
||||
- name: email
|
||||
data_type: character varying
|
||||
description: email of host
|
||||
|
||||
- name: joined_at_utc
|
||||
data_type: timestamp without time zone
|
||||
description: date and time when host joined Superhog
|
||||
|
||||
- name: joined_date_utc
|
||||
data_type: date
|
||||
description: date when host joined Superhog
|
||||
|
||||
- name: last_name
|
||||
data_type: character varying
|
||||
description: Last name of host
|
||||
|
||||
- name: user_name
|
||||
data_type: character varying
|
||||
description: User name of host
|
||||
|
||||
- name: first_name
|
||||
data_type: character varying
|
||||
description: First name of host
|
||||
|
||||
- name: company_name
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: phone_number
|
||||
data_type: character varying
|
||||
description: Phone number of host
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue