Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WillianFuks/6cb6e07e208621d532fc99cb1cfb0039 to your computer and use it in GitHub Desktop.
Save WillianFuks/6cb6e07e208621d532fc99cb1cfb0039 to your computer and use it in GitHub Desktop.
{{
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