16 lines
588 B
MySQL
16 lines
588 B
MySQL
|
|
/*
|
||
|
|
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"
|
||
|
|
*/
|
||
|
|
{% macro generate_stripe_sources_unioned_select(source_table) -%}
|
||
|
|
{% set countries = ["us", "uk"] %}
|
||
|
|
{% for country in countries %}
|
||
|
|
select *, 'stripe_{{ country }}_account' as stripe_source_account
|
||
|
|
from {{ source("stripe_" ~ country, source_table) }}
|
||
|
|
{% if not loop.last -%}
|
||
|
|
union all
|
||
|
|
{%- endif %}
|
||
|
|
{% endfor %}
|
||
|
|
{%- endmacro %}
|