From 689ef549a295b2da0cd298537be7ce2f24f6ac1a Mon Sep 17 00:00:00 2001 From: Niall Woodward Date: Fri, 12 Aug 2022 09:25:14 +0100 Subject: [PATCH 1/2] Escape quotes --- macros/upload_exposures.sql | 2 +- macros/upload_sources.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/upload_exposures.sql b/macros/upload_exposures.sql index c9bd2751..0c967c3c 100644 --- a/macros/upload_exposures.sql +++ b/macros/upload_exposures.sql @@ -31,7 +31,7 @@ '{{ tojson(exposure.owner) }}', {# owner #} '{{ exposure.maturity }}', {# maturity #} '{{ exposure.original_file_path | replace('\\', '\\\\') }}', {# path #} - '{{ exposure.description }}', {# description #} + '{{ exposure.description | replace("'","\\'") }}', {# description #} '{{ exposure.url }}', {# url #} '{{ exposure.package_name }}', {# package_name #} '{{ tojson(exposure.depends_on.nodes) }}' {# depends_on_nodes #} diff --git a/macros/upload_sources.sql b/macros/upload_sources.sql index 457848a8..d8ab2456 100644 --- a/macros/upload_sources.sql +++ b/macros/upload_sources.sql @@ -31,7 +31,7 @@ '{{ source.loader }}', {# loader #} '{{ source.name }}', {# name #} '{{ source.identifier }}', {# identifier #} - '{{ source.loaded_at_field }}', {# loaded_at_field #} + '{{ source.loaded_at_field | replace("'","\\'") }}', {# loaded_at_field #} '{{ tojson(source.freshness) | replace("'","\\'") }}' {# freshness #} ) {%- if not loop.last %},{%- endif %} From 5dcd91404802b8bba737b470b028e62bcc5fe182 Mon Sep 17 00:00:00 2001 From: Niall Woodward Date: Fri, 12 Aug 2022 09:27:33 +0100 Subject: [PATCH 2/2] Add tests --- integration_test_project/models/sources.yml | 2 +- integration_test_project/models/tests_and_exposures.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/integration_test_project/models/sources.yml b/integration_test_project/models/sources.yml index 89138b30..364992de 100644 --- a/integration_test_project/models/sources.yml +++ b/integration_test_project/models/sources.yml @@ -7,6 +7,6 @@ sources: freshness: error_after: {count: 24, period: hour} filter: dayname(updatedat) not in ('Sunday', 'Monday') - loaded_at_field: current_timestamp + loaded_at_field: convert_timezone('UTC', load_timestamp) tables: - name: doesnt_exist diff --git a/integration_test_project/models/tests_and_exposures.yml b/integration_test_project/models/tests_and_exposures.yml index 3173eada..72caf3ac 100644 --- a/integration_test_project/models/tests_and_exposures.yml +++ b/integration_test_project/models/tests_and_exposures.yml @@ -13,7 +13,7 @@ exposures: - name: imaginary type: dashboard maturity: high - description: "dashboard description" + description: "ceo's favourite dashboard" url: https://bi.tool/dashboards/1 depends_on: