Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 55689b9

Browse files
b-perdave-connors-3mikealfareVersusFacit
authored
Create BQ version of string_literal with correct quoting (#1089)
* Create BQ version of string_literal with correct quoting * Fix macro for whitespace and add test. --------- Co-authored-by: dave-connors-3 <[email protected]> Co-authored-by: Mike Alfare <[email protected]> Co-authored-by: Mila Page <[email protected]> Co-authored-by: Mila Page <[email protected]>
1 parent bd1eb66 commit 55689b9

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
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 dbt.string_literal for BQ when there are newlines
3+
time: 2024-02-05T10:29:54.145326+01:00
4+
custom:
5+
Author: b-per
6+
Issue: "1088"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{%- macro bigquery__string_literal(value) -%}
2+
'''{{ value }}'''
3+
{%- endmacro -%}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import pytest
2+
from dbt.tests.util import run_dbt
3+
4+
5+
_MODEL_SQL = """
6+
select {{ dbt.string_literal('my multiline
7+
string') }} as test
8+
"""
9+
10+
11+
class TestStringLiteralQuoting:
12+
@pytest.fixture(scope="class")
13+
def models(self):
14+
return {"my_model.sql": _MODEL_SQL}
15+
16+
def test_string_literal_quoting(self, project):
17+
run_dbt()

0 commit comments

Comments
 (0)