|
1 | | -{% macro get_scalar_function_sql(target_relation) %} |
2 | | - {{ get_scalar_function_create_replace_signature(target_relation) }} |
3 | | - {{ get_scalar_function_body() }}; |
| 1 | +{% macro scalar_function_sql(target_relation) %} |
| 2 | + {{ return(adapter.dispatch('scalar_function_sql', 'dbt')(target_relation)) }} |
4 | 3 | {% endmacro %} |
5 | 4 |
|
6 | | -{% macro get_scalar_function_create_replace_signature(target_relation) %} |
7 | | - CREATE OR REPLACE FUNCTION {{ target_relation.render() }} ({{ get_formatted_scalar_function_args()}}) RETURNS {{ model.return_type.type }} AS |
| 5 | +{% macro default__scalar_function_sql(target_relation) %} |
| 6 | + {{ scalar_function_create_replace_signature_sql(target_relation) }} |
| 7 | + {{ scalar_function_body_sql() }}; |
8 | 8 | {% endmacro %} |
9 | 9 |
|
10 | | -{% macro get_formatted_scalar_function_args() %} |
| 10 | +{% macro scalar_function_create_replace_signature_sql(target_relation) %} |
| 11 | + {{ return(adapter.dispatch('scalar_function_create_replace_signature_sql', 'dbt')(target_relation)) }} |
| 12 | +{% endmacro %} |
| 13 | + |
| 14 | +{% macro default__scalar_function_create_replace_signature_sql(target_relation) %} |
| 15 | + CREATE OR REPLACE FUNCTION {{ target_relation.render() }} ({{ formatted_scalar_function_args_sql()}}) RETURNS {{ model.return_type.type }} AS |
| 16 | +{% endmacro %} |
| 17 | + |
| 18 | +{% macro formatted_scalar_function_args_sql() %} |
| 19 | + {{ return(adapter.dispatch('formatted_scalar_function_args_sql', 'dbt')()) }} |
| 20 | +{% endmacro %} |
| 21 | + |
| 22 | +{% macro default__formatted_scalar_function_args_sql() %} |
11 | 23 | {% set args = [] %} |
12 | 24 | {% for arg in model.arguments -%} |
13 | 25 | {%- do args.append(arg.name ~ ' ' ~ arg.type) -%} |
14 | 26 | {%- endfor %} |
15 | 27 | {{ args | join(', ') }} |
16 | 28 | {% endmacro %} |
17 | 29 |
|
18 | | -{% macro get_scalar_function_body() %} |
| 30 | +{% macro scalar_function_body_sql() %} |
| 31 | + {{ return(adapter.dispatch('scalar_function_body_sql', 'dbt')()) }} |
| 32 | +{% endmacro %} |
| 33 | + |
| 34 | +{% macro default__scalar_function_body_sql() %} |
19 | 35 | $$ |
20 | 36 | {{ model.compiled_code }} |
21 | 37 | $$ LANGUAGE SQL; |
|
0 commit comments