-
Notifications
You must be signed in to change notification settings - Fork 0
int-member-bookings #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| with bookings as ( | ||
|
|
||
| select * | ||
| from {{ source('fitness_dataset', 'bookings') }} | ||
|
|
||
| ), | ||
|
|
||
| members as ( | ||
|
|
||
| select * | ||
| from {{ ref('stg_members') }} | ||
|
|
||
| ), | ||
|
|
||
| joined as ( | ||
|
|
||
| select | ||
| bookings.booking_id, | ||
| bookings.member_id, | ||
| bookings.class_id, | ||
| bookings.booking_timestamp, | ||
| bookings.attendance_status, | ||
| bookings.check_in_timestamp, | ||
| bookings.cancellation_timestamp, | ||
|
|
||
| members.first_name, | ||
| members.last_name, | ||
| members.email, | ||
| members.missing_email_flag, | ||
| members.date_of_birth, | ||
| members.join_date, | ||
| members.membership_status, | ||
| members.home_club | ||
|
|
||
| from bookings | ||
| left join members | ||
| on bookings.member_id = members.member_id | ||
|
|
||
| ) | ||
|
|
||
| select * | ||
| from joined | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| version: 2 | ||
|
|
||
| models: | ||
| - name: int_member_bookings | ||
| description: "Intermediate model joining bookings to members at booking grain." | ||
|
|
||
| columns: | ||
| - name: booking_id | ||
| description: "Unique identifier for each booking." | ||
| tests: | ||
| - not_null | ||
| - unique | ||
|
|
||
| - name: member_id | ||
| description: "Unique identifier for the member linked to the booking." | ||
| tests: | ||
| - not_null | ||
|
|
||
| - name: class_id | ||
| description: "Unique identifier for the class linked to the booking." | ||
| tests: | ||
| - not_null | ||
|
|
||
| - name: booking_timestamp | ||
| description: "Timestamp when the booking was made." | ||
| tests: | ||
| - not_null | ||
|
|
||
| - name: attendance_status | ||
| description: "Attendance status recorded for the booking." | ||
| tests: | ||
| - not_null | ||
|
|
||
| - name: check_in_timestamp | ||
| description: "Timestamp when the member checked in for the class, if applicable." | ||
|
|
||
| - name: cancellation_timestamp | ||
| description: "Timestamp when the booking was cancelled, if applicable." | ||
|
|
||
| - name: first_name | ||
| description: "Member first name." | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not null test needed |
||
| - name: last_name | ||
| description: "Member last name." | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not null tests needed |
||
| - name: email | ||
| description: "Member email address." | ||
|
|
||
| - name: missing_email_flag | ||
| description: "True when the member email is missing or blank." | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not null tests needed |
||
| - name: date_of_birth | ||
| description: "Member date of birth." | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not null tests needed |
||
| - name: join_date | ||
| description: "Date the member joined." | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not null tests needed |
||
| - name: membership_status | ||
| description: "Standardised membership status from stg_members." | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not null tests needed |
||
| - name: home_club | ||
| description: "Member home club." | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not null tests needed and maybe accepted values test |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you will need a unit test in the int_member_bookings.yml to test this logic