forked from opensource-observer/oso
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29254a0
commit 98e77cf
Showing
1 changed file
with
29 additions
and
18 deletions.
There are no files selected for viewing
47 changes: 29 additions & 18 deletions
47
warehouse/dbt/models/intermediate/events/int_time_intervals.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 |
---|---|---|
@@ -1,19 +1,30 @@ | ||
with dates as ( | ||
select | ||
'7 DAYS' as time_interval, | ||
DATE_SUB(CURRENT_DATE(), interval 7 day) as start_date | ||
union all | ||
select | ||
'30 DAYS' as time_interval, | ||
DATE_SUB(CURRENT_DATE(), interval 30 day) as start_date | ||
union all | ||
select | ||
'90 DAYS' as time_interval, | ||
DATE_SUB(CURRENT_DATE(), interval 90 day) as start_date | ||
union all | ||
select | ||
'6 MONTHS' as time_interval, | ||
DATE_SUB(CURRENT_DATE(), interval 6 month) as start_date | ||
union all | ||
select | ||
'1 YEAR' as time_interval, | ||
DATE_SUB(CURRENT_DATE(), interval 1 year) as start_date | ||
union all | ||
select | ||
'ALL' as time_interval, | ||
DATE('1970-01-01') as start_date | ||
) | ||
|
||
select | ||
'30D' as time_interval, | ||
DATE_SUB(CURRENT_DATE(), interval 30 day) as start_date | ||
union all | ||
select | ||
'90D' as time_interval, | ||
DATE_SUB(CURRENT_DATE(), interval 90 day) as start_date | ||
union all | ||
select | ||
'6M' as time_interval, | ||
DATE_SUB(CURRENT_DATE(), interval 6 month) as start_date | ||
union all | ||
select | ||
'1Y' as time_interval, | ||
DATE_SUB(CURRENT_DATE(), interval 1 year) as start_date | ||
union all | ||
select | ||
'ALL' as time_interval, | ||
DATE('1970-01-01') as start_date | ||
dates.time_interval, | ||
TIMESTAMP(dates.start_date) as start_date | ||
from dates |