udemy-complete-dbt-bootcamp/code_thingies/dbtlearn/models/fact/fact_reviews.sql

19 lines
340 B
MySQL
Raw Normal View History

2023-10-30 18:04:19 +01:00
{{
config(
materialized = 'incremental',
on_schema_change = 'fail'
)
}}
WITH src_reviews AS (
SELECT *
FROM
{{ ref('src_reviews') }}
)
SELECT *
FROM
src_reviews
WHERE
review_text IS NOT NULL
{% if is_incremental() %}
AND review_date > (SELECT MAX(review_date) FROM {{ this }})
{% endif %}