/ eu-air-traffic / dbt / macros / generate_schema_name.sql
swadhinbiswas Add a Docker Compose deployment anyone can run · 9/14/2026
76836cb
17 lines · 545 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{#
  Use custom schema names verbatim instead of dbt's default
  `<target_schema>_<custom_schema>` concatenation.

  This keeps the physical schemas predictable (`staging`, `marts`, `reports`)
  so downstream consumers — e.g. the orchestrator registering `gold_*` views
  from the `marts` schema — can rely on them.
#}
{% macro generate_schema_name(custom_schema_name, node) -%}
    {%- if custom_schema_name is none -%}
        {{ target.schema }}
    {%- else -%}
        {{ custom_schema_name | trim }}
    {%- endif -%}
{%- endmacro %}