I am trying to create a base
schema where we will land all our snapshots/base models, etc from the ELT process.
We are using the naming convention <schema_name>__<table_name>
which we’d like to apply conditionally. Models built outside of the base
schema should just retain the <table_name>
component while the ones in base
need both (e.g. there are two separate source system tables named orders
which would result in a collision)
I changed the alias name macro to what I thought would work, but it still tells me there is a collison:
What should I use from the node
to check this?
{% macro generate_alias_name(custom_alias_name=none, node=none) -%}
{%- if custom_alias_name is not none -%}
{{ custom_alias_name | trim }}
{%- elif target.name == 'prod' and custom_alias_name is none and node.schema != 'base' -%}
{# in prod pull out the table from <schema>__<table> naming convention #}
{% do log(node.schema) %}
{{ node.name.split('__')[1] }}
{%- else -%}
{{ node.name }}
{%- endif -%}
{%- endmacro %}