Skip to content

Commit e6bbe8f

Browse files
authored
Merge pull request #422 from dbt-labs/wrap-strings-quote-update
2 parents defae8b + 03538f3 commit e6bbe8f

6 files changed

Lines changed: 19 additions & 8 deletions

File tree

integration_tests/models/dbt_project_evaluator_schema_tests/core.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ models:
2020
- name: on_schema_change
2121
description: this contains the on_schema_change setting for incremental models. This column was sometimes an empty string, so should be tested to detect regressions
2222
tests:
23-
- is_not_empty_string
23+
- not_null:
24+
config:
25+
where: resource_type = 'model'
2426
- name: model_type
2527
tests:
2628
- dbt_utils.expression_is_true:

integration_tests/models/staging/source_1/schema.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ models:
55
description: test
66
columns:
77
- name: id
8-
description: hocus pocus
8+
description: >
9+
hocus pocus
10+
pocus hocus
911
tests:
1012
- unique
1113
- name: stg_model_3

macros/wrap_string_with_quotes.sql

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
{% macro wrap_string_with_quotes(str) %}
2-
{% if not str %}
2+
{% if str is none %}
33
{{ return('cast(NULL as ' ~ dbt.type_string() ~ ')') }}
44
{% else %}
5-
{{ return("'" ~ str ~ "'") }}
5+
{{ dbt.string_literal(str) }}
66
{% endif %}
77
{% endmacro %}
8+
9+
{#
10+
To be removed when https://github.com/dbt-labs/dbt-bigquery/pull/1089 is merged
11+
#}
12+
{% macro bigquery__string_literal(value) -%}
13+
'''{{ value }}'''
14+
{%- endmacro %}

models/marts/core/int_all_graph_resources.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ unioned_with_calc as (
3434
*,
3535
case
3636
when resource_type = 'source' then {{ dbt.concat(['source_name',"'.'",'name']) }}
37-
when version is not null then {{ dbt.concat(['name',"'.v'",'version']) }}
37+
when coalesce(version, '') != '' then {{ dbt.concat(['name',"'.v'",'version']) }}
3838
else name
3939
end as resource_name,
4040
case

models/marts/dag/dag.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ models:
66
tests:
77
- is_empty
88
- name: fct_duplicate_sources
9-
descritption: "This table shows each source database location with more than one node in your dbt project."
9+
description: "This table shows each source database location with more than one node in your dbt project."
1010
tests:
1111
- is_empty
1212
- name: fct_marts_or_intermediate_dependent_on_source
@@ -24,7 +24,7 @@ models:
2424
- name: fct_rejoining_of_upstream_concepts
2525
description: >
2626
"All cases where one of the parent's direct children (child) is ALSO the direct child of ANOTHER one of the
27-
parent's direct childen (parent_and_child). Only includes cases where the model "in between" the parent and child
27+
parent's direct children (parent_and_child). Only includes cases where the model "in between" the parent and child
2828
has NO other downstream dependencies.
2929
tests:
3030
- is_empty

models/marts/dag/fct_hard_coded_references.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ final as (
1111
resource_name as model,
1212
hard_coded_references
1313
from models
14-
where hard_coded_references is not null
14+
where hard_coded_references != ''
1515
)
1616

1717
select * from final

0 commit comments

Comments
 (0)