use macro in charges
This commit is contained in:
parent
306e2ad970
commit
bbeee7a4dc
1 changed files with 1 additions and 16 deletions
|
|
@ -1,20 +1,5 @@
|
||||||
with
|
with
|
||||||
raw_charges as (
|
raw_charges as ({{ generate_stripe_sources_unioned_select("charges") }}),
|
||||||
/*
|
|
||||||
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_seed__currencies as (select * from {{ ref("stg_seed__currencies") }}),
|
||||||
stg_stripe__charges as (
|
stg_stripe__charges as (
|
||||||
select
|
select
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue