Skip to content

Commit

Permalink
Merge pull request #362 from farmersdog/361-escape-newline-bigquery-e…
Browse files Browse the repository at this point in the history
…xecutions

Escape newline for BQ execution messages
  • Loading branch information
jared-rimmer authored Jun 21, 2023
2 parents 7789aca + 82dff2d commit 135b1d4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion macros/upload_model_executions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
'{{ model.node.schema }}', {# schema #}
'{{ model.node.name }}', {# name #}
'{{ model.node.alias }}', {# alias #}
'{{ model.message | replace("\\", "\\\\") | replace("'", "\\'") | replace('"', '\\"') }}', {# message #}
'{{ model.message | replace("\\", "\\\\") | replace("'", "\\'") | replace('"', '\\"') | replace("\n", "\\n") }}', {# message #}
parse_json('{{ tojson(model.adapter_response) | replace("\\", "\\\\") | replace("'", "\\'") | replace('"', '\\"') }}') {# adapter_response #}
)
{%- if not loop.last %},{%- endif %}
Expand Down
2 changes: 1 addition & 1 deletion macros/upload_seed_executions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
'{{ model.node.schema }}', {# schema #}
'{{ model.node.name }}', {# name #}
'{{ model.node.alias }}', {# alias #}
'{{ model.message | replace("\\", "\\\\") | replace("'", "\\'") | replace('"', '\\"') }}', {# message #}
'{{ model.message | replace("\\", "\\\\") | replace("'", "\\'") | replace('"', '\\"') | replace("\n", "\\n") }}', {# message #}
parse_json('{{ tojson(model.adapter_response) | replace("\\", "\\\\") | replace("'", "\\'") | replace('"', '\\"') }}') {# adapter_response #}
)
{%- if not loop.last %},{%- endif %}
Expand Down
2 changes: 1 addition & 1 deletion macros/upload_snapshot_executions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
'{{ model.node.schema }}', {# schema #}
'{{ model.node.name }}', {# name #}
'{{ model.node.alias }}', {# alias #}
'{{ model.message | replace("\\", "\\\\") | replace("'", "\\'") | replace('"', '\\"') }}', {# message #}
'{{ model.message | replace("\\", "\\\\") | replace("'", "\\'") | replace('"', '\\"') | replace("\n", "\\n") }}', {# message #}
parse_json('{{ tojson(model.adapter_response) | replace("\\", "\\\\") | replace("'", "\\'") | replace('"', '\\"') }}') {# adapter_response #}
)
{%- if not loop.last %},{%- endif %}
Expand Down
3 changes: 1 addition & 2 deletions macros/upload_test_executions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,8 @@
{{ test.execution_time }}, {# total_node_runtime #}
null, {# rows_affected not available in Databricks #}
{{ 'null' if test.failures is none else test.failures }}, {# failures #}
'{{ test.message | replace("\\", "\\\\") | replace("'", "\\'") | replace('"', '\\"') }}', {# message #}
'{{ test.message | replace("\\", "\\\\") | replace("'", "\\'") | replace('"', '\\"') | replace("\n", "\\n") }}', {# message #}
parse_json('{{ tojson(test.adapter_response) | replace("\\", "\\\\") | replace("'", "\\'") | replace('"', '\\"') }}', wide_number_mode=>'round') {# adapter_response #}

)
{%- if not loop.last %},{%- endif %}

Expand Down

0 comments on commit 135b1d4

Please sign in to comment.