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
|
||||
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 %}
|
||||
),
|
||||
raw_charges as ({{ generate_stripe_sources_unioned_select("charges") }}),
|
||||
stg_seed__currencies as (select * from {{ ref("stg_seed__currencies") }}),
|
||||
stg_stripe__charges as (
|
||||
select
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue