File tree Expand file tree Collapse file tree
macros/utils/table_operations Expand file tree Collapse file tree Original file line number Diff line number Diff line change 283283{%- endmacro -%}
284284
285285{%- macro render_value(value, data_type) -%}
286+ {{- adapter.dispatch("render_value", "elementary")(value, data_type) -}}
287+ {%- endmacro -%}
288+
289+ {%- macro default__render_value(value, data_type) -%}
286290 {%- if value is defined and value is not none -%}
287291 {%- if value is number -%} {{- value -}}
288292 {%- elif value is string and data_type == "timestamp" -%}
299303 {%- else -%} null
300304 {%- endif -%}
301305{%- endmacro -%}
306+
307+ {# Fabric/T-SQL: Python booleans (True/False) pass Jinja' s " is number" test
308+ but T- SQL has no TRUE/ FALSE keywords, so they must be rendered as
309+ cast(1 as bit ) / cast(0 as bit ). # }
310+ {%- macro fabric__render_value(value, data_type) - %}
311+ {%- if value is defined and value is not none - %}
312+ {%- if value is boolean - %}
313+ {%- if value - %} cast(1 as bit ) {%- else - %} cast(0 as bit ) {%- endif - %}
314+ {%- elif value is number - %} {{- value - }}
315+ {%- elif value is string and data_type == " timestamp" - %}
316+ {{-
317+ elementary .edr_cast_as_timestamp (
318+ elementary .edr_datetime_to_sql (value)
319+ )
320+ - }}
321+ {%- elif value is string - %} ' {{- elementary.escape_special_chars(value) -}}'
322+ {%- elif value is mapping or value is sequence - %}
323+ ' {{- elementary.escape_special_chars(tojson(value)) -}}'
324+ {%- else - %} null
325+ {%- endif - %}
326+ {%- else - %} null
327+ {%- endif - %}
328+ {%- endmacro - %}
You can’t perform that action at this time.
0 commit comments