Skip to content

Commit

Permalink
schema and alias macros
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesphil committed Sep 17, 2024
1 parent a2275f0 commit 8276e9c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
8 changes: 2 additions & 6 deletions transform/macros/generate_alias_name.sql
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{% macro generate_alias_name(custom_alias_name=none, node=none) -%}

{%- if custom_alias_name -%}

{{ custom_alias_name | trim }}
{%- if custom_alias_name -%} {{ custom_alias_name | trim }}

{%- elif node.version -%}

{{ return(node.name ~ "_v" ~ (node.version | replace(".", "_"))) }}

{%- else -%}

{{ node.name.split('_', 1)[1] }}
{%- else -%} {{ node.name.split("_", 1)[1] }}

{%- endif -%}

Expand Down
7 changes: 2 additions & 5 deletions transform/macros/generate_schema_name.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{% macro generate_schema_name(custom_schema_name, node) -%}

{%- set default_schema = target.schema -%}
{%- if custom_schema_name is none -%}

{{ default_schema }}
{%- if custom_schema_name is none -%} {{ default_schema }}

{%- else -%}

{{ custom_schema_name | trim }}
{%- else -%} {{ custom_schema_name | trim }}

{%- endif -%}

Expand Down

0 comments on commit 8276e9c

Please sign in to comment.