Also do it on charges
This commit is contained in:
parent
32065fba65
commit
1cdab6634e
2 changed files with 18 additions and 3 deletions
|
|
@ -14,7 +14,6 @@ with
|
|||
union all
|
||||
{%- endif %}
|
||||
{% endfor %}
|
||||
|
||||
),
|
||||
stg_seed__currencies as (select * from {{ ref("stg_seed__currencies") }}),
|
||||
stg_stripe__balance_transactions as (
|
||||
|
|
|
|||
|
|
@ -1,5 +1,20 @@
|
|||
with
|
||||
raw_charges as (select * from {{ source("stripe_uk", "charges") }}),
|
||||
raw_charges as (
|
||||
/*
|
||||
This macro runs for every country code and:
|
||||
- Reads from the right source (stripe_<country-code>)
|
||||
- Adds a column identifying the source account with a string like "stripe_<country>_account"
|
||||
*/
|
||||
{% set countries = ["us", "uk"] %}
|
||||
|
||||
{% for country in countries %}
|
||||
select *, 'stripe_{{ country }}_account' as stripe_source_account
|
||||
from {{ source("stripe_" ~ country, "charges") }}
|
||||
{% if not loop.last -%}
|
||||
union all
|
||||
{%- endif %}
|
||||
{% endfor %}
|
||||
),
|
||||
stg_seed__currencies as (select * from {{ ref("stg_seed__currencies") }}),
|
||||
stg_stripe__charges as (
|
||||
select
|
||||
|
|
@ -72,7 +87,8 @@ with
|
|||
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc,
|
||||
cast(
|
||||
{{ adapter.quote("_airbyte_extracted_at") }} as date
|
||||
) as dwh_extracted_date_utc
|
||||
) as dwh_extracted_date_utc,
|
||||
{{ adapter.quote("stripe_source_account") }}
|
||||
|
||||
from raw_charges ch
|
||||
left join
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue