-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into gitcoin/updates
- Loading branch information
Showing
13 changed files
with
574 additions
and
122 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
warehouse/metrics_mesh/models/events_daily_to_artifact_with_lag.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
MODEL ( | ||
name metrics.events_daily_to_artifact_with_lag, | ||
kind FULL, | ||
start '2015-01-01', | ||
cron '@daily', | ||
partitioned_by (day("bucket_day"), "event_type"), | ||
grain ( | ||
bucket_day, | ||
event_type, | ||
event_source, | ||
from_artifact_id, | ||
to_artifact_id | ||
), | ||
); | ||
SELECT bucket_day, | ||
to_artifact_id, | ||
from_artifact_id, | ||
event_source, | ||
event_type, | ||
amount, | ||
LAG(bucket_day) OVER ( | ||
PARTITION BY to_artifact_id, | ||
from_artifact_id, | ||
event_source, | ||
event_type | ||
ORDER BY bucket_day | ||
) AS last_event | ||
FROM metrics.events_daily_to_artifact |
This file contains 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
This file contains 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
Oops, something went wrong.