Explore more predictable solutions for `previous_*` field values
- Dominant language
- No language data
- Stars
- 3
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
In [pendo__page_event](https://github.com/fivetran/dbt_pendo/blob/main/models/pendo__page_event.sql#L30-L33) and [pendo__feature_event](https://github.com/fivetran/dbt_pendo/blob/main/models/pendo__feature_event.sql#L29-L32), we have the following kind of logic for grabbing previous page/feature event values:
```sql
lag() over(partition by visitor_id order by occurred_at asc, _fivetran_synced asc) as previous_
```
However, events will often have identical `occurred_at` and `_fivetran_synced` timestamps, so SQL arbitrarily chooses the previous event.
Let's explore other solutions to produce consistent outputs -- perhaps there have been new fields added since we first made these models that we can leverage.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with models/pendo__page_event.sql lines 30-33 and models/pendo__feature_event.sql lines 29-32, then inspect the available Pendo event fields for a stable ordering value. Compare outputs for events sharing both timestamps; done means the previous page and feature values are produced consistently for tied events.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- data-engineering
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100