Created
August 21, 2023 18:46
-
-
Save WillianFuks/6cb6e07e208621d532fc99cb1cfb0039 to your computer and use it in GitHub Desktop.
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
{{ | |
config( | |
materialized='incremental' | |
) | |
}} | |
with orders as ( | |
select * from {{ ref('stg__orders') }} | |
), | |
payments as ( | |
select * from {{ ref('int_payments_mapped') }} | |
), | |
orders_payments as ( | |
select | |
orders.order_id, | |
orders.customer_id, | |
order_date, | |
status, | |
payment_method_name, | |
amount | |
from payments | |
inner join orders on | |
payments.order_id = orders.order_id | |
{% if is_incremental() %} | |
where order_date > (select max(order_date) from {{ this }} ) | |
{% endif %} | |
) | |
select * from orders_payments |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment