Skip to content

Commit 88c3d84

Browse files
author
Dat Nguyen
committed
fix: correct where config
1 parent 7fd0046 commit 88c3d84

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

macros/resources/refresh_resource_data.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
,'{{ item.get("pk") }}' as pk
3737
,{{ item.get("include_columns", []) | upper }} as include_columns
3838
,{{ item.get("exclude_columns", []) | upper }} as exclude_columns
39-
,'{{ item.get("where_condition", "1=1") }}' as where_condition
39+
,'{{ data_diff.escape_single_quote_value(item.get("where", "1=1")) }}' as where_condition
4040
,True as is_enabled
4141

4242
{% if var("data_diff__auto_pipe", false) -%}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% macro escape_single_quote_value(value) %}
2+
3+
{{ return(value | replace("'", "''")) }}
4+
5+
{% endmacro %}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
macros:
2+
- name: escape_single_quote_value
3+
description: |
4+
Escape the SQL value which contains the single quote.
5+
6+
For example: `name = 'data'` will be escaped to `name = ''data''`

0 commit comments

Comments
 (0)