Skip to content

Commit 095055c

Browse files
authored
Merge branch 'main' into RRap0so/make-bigquery-temp-tbls-unique
2 parents ac0d194 + f4dfd35 commit 095055c

File tree

30 files changed

+228
-25
lines changed

30 files changed

+228
-25
lines changed

dbt-adapters/.changes/1.17.1.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## dbt-adapters 1.17.1 - October 01, 2025
2+
3+
### Fixes
4+
5+
- Drop extraneous `;` from scalar function macro ([#N/A](https://github.com/dbt-labs/dbt-adapters/issues/N/A))

dbt-adapters/.changes/1.17.2.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## dbt-adapters 1.17.2 - October 02, 2025
2+
3+
### Fixes
4+
5+
- Fix referenced function property names in function macros ([#1365](https://github.com/dbt-labs/dbt-adapters/issues/1365))

dbt-adapters/CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ and is generated by [Changie](https://github.com/miniscruff/changie)
1010
- Do not edit this file directly. This file is auto-generated using [changie](https://github.com/miniscruff/changie)
1111
- For details on how to document a change, see the [contributing guide](/CONTRIBUTING.md#changelog-entry)
1212

13+
## dbt-adapters 1.17.2 - October 02, 2025
14+
15+
### Fixes
16+
17+
- Fix referenced function property names in function macros ([#1365](https://github.com/dbt-labs/dbt-adapters/issues/1365))
18+
19+
20+
21+
## dbt-adapters 1.17.1 - October 01, 2025
22+
23+
### Fixes
24+
25+
- Drop extraneous `;` from scalar function macro ([#N/A](https://github.com/dbt-labs/dbt-adapters/issues/N/A))
26+
1327
## dbt-adapters 1.17.0 - September 29, 2025
1428

1529
### Features
@@ -24,7 +38,6 @@ and is generated by [Changie](https://github.com/miniscruff/changie)
2438
### Contributors
2539
- [@jeremyyeo](https://github.com/jeremyyeo) ([#1240](https://github.com/dbt-labs/dbt-adapters/issues/1240))
2640

27-
2841
## dbt-adapters 1.16.6 - September 03, 2025
2942

3043
### Under the Hood
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = "1.17.0"
1+
version = "1.17.2"

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

Lines changed: 5 additions & 3 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 %}
@@ -34,5 +36,5 @@
3436
{% macro default__scalar_function_body_sql() %}
3537
$$
3638
{{ model.compiled_code }}
37-
$$ LANGUAGE SQL;
39+
$$ LANGUAGE SQL
3840
{% endmacro %}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: Features
2+
body: Add support for scalar functions
3+
time: 2025-09-29T14:42:06.039751-05:00
4+
custom:
5+
Author: QMalcolm
6+
Issue: "1290"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
kind: Fixes
2+
body: Ensure we have exchanged a refresh-token for a token prior to detemining notebook
3+
user in BigFrames
4+
time: 2025-09-15T09:53:08.063964-07:00
5+
custom:
6+
Author: colin-rogers-dbt
7+
Issue: "1219"
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/adapters/bigquery/python_submissions.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,18 @@ def __init__(self, parsed_model: Dict, credentials: BigQueryCredentials) -> None
216216
model_timeout=parsed_model["config"].get("timeout") or _DEFAULT_BIGFRAMES_TIMEOUT
217217
)
218218

219+
def _get_token(self) -> str:
220+
"""Get a token from the credentials.
221+
If a token is not supplied by the user directly it is lazily created the first time we authenticates.
222+
BigFrames needs a token to determine the execution user but a call may not have
223+
"""
224+
creds = self._GoogleCredentials
225+
if creds.token:
226+
return creds.token
227+
else:
228+
creds.refresh()
229+
return creds.token
230+
219231
def _py_to_ipynb(self, compiled_code: str) -> str:
220232
notebook = nbformat.v4.new_notebook()
221233
# Put all codes in one cell.
@@ -332,7 +344,7 @@ def _config_notebook_job(
332344
response = request(
333345
method="GET",
334346
url="https://www.googleapis.com/oauth2/v2/userinfo",
335-
headers={"Authorization": f"Bearer {self._GoogleCredentials.token}"},
347+
headers={"Authorization": f"Bearer {self._get_token()}"},
336348
)
337349

338350
if response.status != 200:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{% macro bigquery__scalar_function_create_replace_signature_sql(target_relation) %}
2+
CREATE OR REPLACE FUNCTION {{ target_relation.render() }} ({{ formatted_scalar_function_args_sql()}})
3+
RETURNS {{ model.returns.data_type }}
4+
AS
5+
{% endmacro %}
6+
7+
{% macro bigquery__scalar_function_body_sql() %}
8+
(
9+
{{ model.compiled_code }}
10+
)
11+
{% endmacro %}

0 commit comments

Comments
 (0)