Repository navigation
Add stg_host_project_ordinals staging model - #1
Open
Diego-Turno wants to merge 1 commit into
Open
Diego-Turno wants to merge 1 commit into
Diego-Turno wants to merge 1 commit into
Conversation
Diego-Turno
force-pushed
the
pr-review-test
branch
from
August 21, 2026 20:45
5b8b43d to
540d71d
Compare
Annallisboa
reviewed
Oct 5, 2026
| relation: true | ||
| columns: true | ||
| description: > | ||
| A staging table that captures ordinal marketplace project completion dates (2nd, 3rd, 5th) by account, |
There was a problem hiding this comment.
Its missing the 1st one marketing place completed.
Annallisboa
reviewed
Oct 5, 2026
| SELECT | ||
| h.account_id, | ||
| pl.captured_at AS marketplace_project_completed_at, | ||
| ROW_NUMBER() OVER ( |
There was a problem hiding this comment.
DESC should not be used here, because we need the oldest first
Annallisboa
reviewed
Oct 5, 2026
| pl.captured_at AS marketplace_project_completed_at, | ||
| ROW_NUMBER() OVER ( | ||
| PARTITION BY c.account_id | ||
| ORDER BY a.completed_at DESC |
There was a problem hiding this comment.
the ORDER BY clause should be captered_at
Annallisboa
reviewed
Oct 5, 2026
| {{ source('production', 'projects') }} p | ||
| ON pl.project_id = p.id | ||
| WHERE | ||
| pl.from_marketplace = 0 |
Annallisboa
reviewed
Oct 5, 2026
| pl.captured_at AS overall_project_completed_at, | ||
| ROW_NUMBER() OVER ( | ||
| PARTITION BY h.account_id | ||
| ORDER BY p.completed_at DESC |
There was a problem hiding this comment.
the ORDER BY clause should be captered_at
Annallisboa
reviewed
Oct 5, 2026
| {{ source('production', 'hosts') }} h | ||
| ON pl.host_id = h.id | ||
| LEFT JOIN | ||
| turno.turno_production_schema.projects p |
There was a problem hiding this comment.
we need to use {{ source('production', 'table_name') }}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Business context
Turno is a marketplace connecting short-term-rental hosts with cleaners. A host books a cleaning project, a cleaner completes it, and the host's payment method is charged. Growth and lifecycle analyses need to know when each host account hit its project milestones — specifically the completion dates of the account's 1st, 2nd, 3rd, and 5th marketplace projects, plus the 1st completed project overall (marketplace or not).
This PR adds
stg_host_project_ordinals, one row peraccount_id, exposing those milestone timestamps so downstream models can measure activation and repeat usage (e.g. "how long from first to second marketplace project?").Business definitions the model must follow:
captured_attimestamp is the completion date used here.from_marketplace = 1; everything else is non-marketplace.Team rules
{{ source('production', 'table_name') }}{{ ref('table_name') }}Tables and columns used
payment_logs(production) — one row per payment attempthost_idproject_idfrom_marketplace1if the payment is for a marketplace project,0otherwisecaptured_atNULLif it never didhosts(production) — one row per hostidaccount_idprojects(production) — one row per projectidcompleted_at