Skip to content

Commit

Permalink
Install reusable macros from jaffle_utils
Browse files Browse the repository at this point in the history
  • Loading branch information
jtcohen6 committed Sep 29, 2024
1 parent 63d325b commit 450f5ce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 24 deletions.
3 changes: 3 additions & 0 deletions dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ projects:
- name: jaffle_shop_mesh_marketing

packages:
- private: dbt-labs/jaffle-shop-mesh-platform-redshift
subdirectory: jaffle_utils
warn-unpinned: false
- package: dbt-labs/dbt_utils
version: 1.1.1
26 changes: 3 additions & 23 deletions macros/generate_schema_name.sql
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
{% macro generate_schema_name(custom_schema_name, node) %}

{% set default_schema = target.schema %}

{# seeds go in a global `raw` schema #}
{% if node.resource_type == 'seed' %}
{{ custom_schema_name | trim }}

{# non-specified schemas go to the default target schema #}
{% elif custom_schema_name is none %}
{{ default_schema }}


{# specified custom schema names go to the schema name prepended with the the default schema name in prod (as this is an example project we want the schemas clearly labeled) #}
{% elif target.name == 'prod' %}
{{ default_schema }}_{{ custom_schema_name | trim }}

{# specified custom schemas go to the default target schema for non-prod targets #}
{% else %}
{{ default_schema }}
{% endif %}

{% endmacro %}
{% macro generate_schema_name(custom_schema_name, node) -%}
{{ return(jaffle_utils.generate_schema_name(custom_schema_name, node)) }}
{%- endmacro %}
5 changes: 4 additions & 1 deletion package-lock.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
packages:
- private: dbt-labs/jaffle-shop-mesh-platform-redshift
revision: d0aff8c7b4089260be307a8fc2cd9011ab5a80e3
subdirectory: jaffle_utils
- package: dbt-labs/dbt_utils
version: 1.1.1
sha1_hash: a158c48c59c2bb7d729d2a4e215aabe5bb4f3353
sha1_hash: ee93461f4868b20836fc0eefbe2f5fbbbd4d71eb

0 comments on commit 450f5ce

Please sign in to comment.