Hi, I would like to parametrize the source names b...
# troubleshooting
s
Hi, I would like to parametrize the source names based on the environment. For example in
prod
my source is called
my_source
, while in
dev
my source is called
my_source_smith
(smith is the last name of the developer). The developer is defined in a
DEVELOPER
environment variable. What is the best way to achieve this? Does it make sense to parametrize the sources (the idea is to make the dev environments completely independent among develpers)? Hi. I would like to parametrize my sources so that in the
e
Hi @simone_gaiarin, do you mean dbt sources?
s
Ops, I'me realizing now I've posted in the wrong slack, I wanted to post on dbt. 🙂 Yes I mean dbt sources.
e
So, I’m not sure but I’ve shared this in #C01UW21TM98 in case anyone in the community knows
s
thanks
My current solution is this: source:
Copy code
version: 2

sources:
  - name: "mysource{{ env_var('DATASET_SUFFIX', '') }}"
model:
Copy code
with

source as (

    select *
    from {{ source(source_name('mysource'), 'mytable') }}

),
macro:
Copy code
{% macro source_name(the_name) %}{{ the_name + env_var('DATASET_SUFFIX', '') }}{% endmacro %}%
I couldn't figure out a way to create a macro/function to use in the source.yml instead of using env_var directly