Thingies
This commit is contained in:
parent
2b6c385b8c
commit
7480222cc7
7 changed files with 49 additions and 13 deletions
27
code_thingies/dbtlearn/models/mart/mart_fullmoon_reviews.sql
Normal file
27
code_thingies/dbtlearn/models/mart/mart_fullmoon_reviews.sql
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{{
|
||||
config(
|
||||
materialized = 'table'
|
||||
)
|
||||
}}
|
||||
|
||||
WITH fact_reviews AS (
|
||||
SELECT *
|
||||
FROM
|
||||
{{ ref('fact_reviews') }}
|
||||
),
|
||||
full_moon_dates AS (
|
||||
SELECT *
|
||||
FROM
|
||||
{{ ref('seed_full_moon_dates')}}
|
||||
)
|
||||
|
||||
SELECT
|
||||
fr.*,
|
||||
CASE
|
||||
WHEN fm.full_moon_date IS NULL THEN 'not full moon'
|
||||
ELSE 'full moon'
|
||||
END AS is_full_moon
|
||||
FROM
|
||||
fact_reviews fr
|
||||
LEFT JOIN full_moon_dates fm
|
||||
ON (fr.review_date::date) = (fm.full_moon_date + interval '1' day)
|
||||
Loading…
Add table
Add a link
Reference in a new issue