macro-out the staging model unioning
This commit is contained in:
parent
e2655a9e06
commit
32065fba65
1 changed files with 15 additions and 5 deletions
|
|
@ -1,10 +1,20 @@
|
||||||
with
|
with
|
||||||
raw_balance_transactions as (
|
raw_balance_transactions as (
|
||||||
select *, 'stripe_uk_account' as stripe_source_account
|
/*
|
||||||
from {{ source("stripe_uk", "balance_transactions") }}
|
This macro runs for every country code and:
|
||||||
union all
|
- Reads from the right source (stripe_<country-code>)
|
||||||
select *, 'stripe_us_account' as stripe_source_account
|
- Adds a column identifying the source account with a string like "stripe_<country>_account"
|
||||||
from {{ source("stripe_us", "balance_transactions") }}
|
*/
|
||||||
|
{% set countries = ["us", "uk"] %}
|
||||||
|
|
||||||
|
{% for country in countries %}
|
||||||
|
select *, 'stripe_{{ country }}_account' as stripe_source_account
|
||||||
|
from {{ source("stripe_" ~ country, "balance_transactions") }}
|
||||||
|
{% if not loop.last -%}
|
||||||
|
union all
|
||||||
|
{%- endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
),
|
),
|
||||||
stg_seed__currencies as (select * from {{ ref("stg_seed__currencies") }}),
|
stg_seed__currencies as (select * from {{ ref("stg_seed__currencies") }}),
|
||||||
stg_stripe__balance_transactions as (
|
stg_stripe__balance_transactions as (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue