Skip to content

Commit 6268373

Browse files
authored
Update function macros to use correct function property names (#1366)
1 parent 170e4d3 commit 6268373

File tree

11 files changed

+44
-12
lines changed

11 files changed

+44
-12
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: Fixes
2+
body: Fix referenced function property names in function macros
3+
time: 2025-10-02T11:50:32.228639-05:00
4+
custom:
5+
Author: QMalcolm
6+
Issue: "1365"

dbt-adapters/src/dbt/include/global_project/macros/materializations/functions/scalar.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
{% endmacro %}
1313

1414
{% 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
15+
CREATE OR REPLACE FUNCTION {{ target_relation.render() }} ({{ formatted_scalar_function_args_sql()}})
16+
RETURNS {{ model.returns.data_type }}
17+
AS
1618
{% endmacro %}
1719

1820
{% macro formatted_scalar_function_args_sql() %}
@@ -22,7 +24,7 @@
2224
{% macro default__formatted_scalar_function_args_sql() %}
2325
{% set args = [] %}
2426
{% for arg in model.arguments -%}
25-
{%- do args.append(arg.name ~ ' ' ~ arg.type) -%}
27+
{%- do args.append(arg.name ~ ' ' ~ arg.data_type) -%}
2628
{%- endfor %}
2729
{{ args | join(', ') }}
2830
{% endmacro %}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: Fixes
2+
body: Fix references to function properties in function macros
3+
time: 2025-10-02T12:10:22.720046-05:00
4+
custom:
5+
Author: QMalcolm
6+
Issue: "1365"

dbt-bigquery/src/dbt/include/bigquery/macros/materializations/functions/scalar.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% macro bigquery__scalar_function_create_replace_signature_sql(target_relation) %}
22
CREATE OR REPLACE FUNCTION {{ target_relation.render() }} ({{ formatted_scalar_function_args_sql()}})
3-
RETURNS {{ model.return_type.type }}
3+
RETURNS {{ model.returns.data_type }}
44
AS
55
{% endmacro %}
66

dbt-bigquery/tests/functional/functions/files.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
description: Calculate the price for the xlarge version of a standard item
99
arguments:
1010
- name: price
11-
type: numeric
11+
data_type: numeric
1212
description: The price of the standard item
13-
return_type:
14-
type: numeric
13+
returns:
14+
data_type: numeric
1515
description: The resulting xlarge price
1616
"""
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: Fixes
2+
body: Fix references to function properties in function macros
3+
time: 2025-10-02T12:09:29.303025-05:00
4+
custom:
5+
Author: QMalcolm
6+
Issue: "1365"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% macro redshift__scalar_function_create_replace_signature_sql(target_relation) %}
22
CREATE OR REPLACE FUNCTION {{ target_relation.render() }} ({{ formatted_scalar_function_args_sql()}})
3-
RETURNS {{ model.return_type.type }}
3+
RETURNS {{ model.returns.data_type }}
44
{# TODO: Stop defaulting to VOLATILE once we have a way to set the volatility #}
55
{# We set a default here because redshift requires a volatility to be set #}
66
VOLATILE
@@ -10,7 +10,7 @@
1010
{% macro redshift__formatted_scalar_function_args_sql() %}
1111
{% set args = [] %}
1212
{% for arg in model.arguments -%}
13-
{%- do args.append(arg.type) -%}
13+
{%- do args.append(arg.data_type) -%}
1414
{%- endfor %}
1515
{{ args | join(', ') }}
1616
{% endmacro %}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: Fixes
2+
body: Fix references to function properties in funciton macros
3+
time: 2025-10-02T12:06:39.049296-05:00
4+
custom:
5+
Author: QMalcolm
6+
Issue: "1365"

dbt-snowflake/src/dbt/include/snowflake/macros/materializations/functions/scalar.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% macro snowflake__scalar_function_create_replace_signature_sql(target_relation) %}
22
CREATE OR REPLACE FUNCTION {{ target_relation.render() }} ({{ formatted_scalar_function_args_sql()}})
3-
RETURNS {{ model.return_type.type }}
3+
RETURNS {{ model.returns.data_type }}
44
LANGUAGE SQL
55
AS
66
{% endmacro %}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: Fixes
2+
body: Fix file fixtures for functions to use proper function property names
3+
time: 2025-10-02T11:52:59.273372-05:00
4+
custom:
5+
Author: QMalcolm
6+
Issue: "1365"

0 commit comments

Comments
 (0)