|
16 | 16 | {%- do invocation_args_dict.update({"warn_error_options": warn_error_options}) %} |
17 | 17 | {% endif %} |
18 | 18 | {% endif %} |
| 19 | + {% set converted_invocation_args_dict = dbt_artifacts.safe_copy_mapping(invocation_args_dict) %} |
19 | 20 |
|
20 | | - {% if "event_time_start" in invocation_args_dict %} |
21 | | - {% if invocation_args_dict.event_time_start is not string %} |
22 | | - {% do invocation_args_dict.update( |
23 | | - {"event_time_start": invocation_args_dict.event_time_start.strftime(dbt_artifacts.get_strftime_format())} |
24 | | - ) %} |
25 | | - {% endif%} |
26 | | - {% endif %} |
27 | | - {% if "event_time_end" in invocation_args_dict %} |
28 | | - {% if invocation_args_dict.event_time_end is not string %} |
29 | | - {% do invocation_args_dict.update( |
30 | | - {"event_time_end": invocation_args_dict.event_time_end.strftime(dbt_artifacts.get_strftime_format())} |
31 | | - ) %} |
32 | | - {% endif%} |
33 | | - {% endif %} |
34 | | - |
35 | | - {{ log(invocation_args_dict) }} |
36 | | - {{ return(adapter.dispatch("get_invocations_dml_sql", "dbt_artifacts")()) }} |
| 21 | + {{ return(adapter.dispatch("get_invocations_dml_sql", "dbt_artifacts")(converted_invocation_args_dict)) }} |
37 | 22 | {%- endmacro %} |
38 | 23 |
|
39 | | -{% macro default__get_invocations_dml_sql() -%} |
| 24 | +{% macro default__get_invocations_dml_sql(invocation_args=invocation_args_dict) -%} |
40 | 25 | {% set invocation_values %} |
41 | 26 | select |
42 | 27 | {{ adapter.dispatch('column_identifier', 'dbt_artifacts')(1) }}, |
|
97 | 82 | null, {# dbt_vars #} |
98 | 83 | {% endif %} |
99 | 84 |
|
100 | | - '{{ tojson(invocation_args_dict) | replace('\\', '\\\\') | replace("'", "\\'") }}', {# invocation_args #} |
| 85 | + '{{ tojson(invocation_args) | replace('\\', '\\\\') | replace("'", "\\'") }}', {# invocation_args #} |
101 | 86 |
|
102 | 87 | {% set metadata_env = {} %} |
103 | 88 | {% for key, value in dbt_metadata_envs.items() %} |
|
111 | 96 |
|
112 | 97 | {% endmacro -%} |
113 | 98 |
|
114 | | -{% macro bigquery__get_invocations_dml_sql() -%} |
| 99 | +{% macro bigquery__get_invocations_dml_sql(invocation_args=invocation_args_dict) -%} |
115 | 100 | {% set invocation_values %} |
116 | 101 | ( |
117 | 102 | '{{ invocation_id }}', {# command_invocation_id #} |
|
151 | 136 | null, {# dbt_vars #} |
152 | 137 | {% endif %} |
153 | 138 |
|
154 | | - {% if invocation_args_dict.vars %} |
| 139 | + {% if invocation_args.vars %} |
155 | 140 | {# vars - different format for pre v1.5 (yaml vs list) #} |
156 | | - {% if invocation_args_dict.vars is string %} |
| 141 | + {% if invocation_args.vars is string %} |
157 | 142 | {# BigQuery does not handle the yaml-string from "--vars" well, when passed to "parse_json". Workaround is to parse the string, and then "tojson" will properly format the dict as a json-object. #} |
158 | | - {% set parsed_inv_args_vars = fromyaml(invocation_args_dict.vars) %} |
159 | | - {% do invocation_args_dict.update({'vars': parsed_inv_args_vars}) %} |
| 143 | + {% set parsed_inv_args_vars = fromyaml(invocation_args.vars) %} |
| 144 | + {% do invocation_args.update({'vars': parsed_inv_args_vars}) %} |
160 | 145 | {% endif %} |
161 | 146 | {% endif %} |
162 | 147 |
|
163 | | - {{ adapter.dispatch('parse_json', 'dbt_artifacts')(tojson(invocation_args_dict) | replace("'", "\\'")) }}, {# invocation_args #} |
| 148 | + {{ adapter.dispatch('parse_json', 'dbt_artifacts')(tojson(invocation_args) | replace("'", "\\'")) }}, {# invocation_args #} |
164 | 149 |
|
165 | 150 | {% set metadata_env = {} %} |
166 | 151 | {% for key, value in dbt_metadata_envs.items() %} |
|
174 | 159 |
|
175 | 160 | {% endmacro -%} |
176 | 161 |
|
177 | | -{% macro postgres__get_invocations_dml_sql() -%} |
| 162 | +{% macro postgres__get_invocations_dml_sql(invocation_args=invocation_args_dict) -%} |
178 | 163 | {% set invocation_values %} |
179 | 164 | ( |
180 | 165 | '{{ invocation_id }}', {# command_invocation_id #} |
|
214 | 199 | null, {# dbt_vars #} |
215 | 200 | {% endif %} |
216 | 201 |
|
217 | | - {% if invocation_args_dict.vars %} |
| 202 | + {% if invocation_args.vars %} |
218 | 203 | {# vars - different format for pre v1.5 (yaml vs list) #} |
219 | | - {% if invocation_args_dict.vars is string %} |
| 204 | + {% if invocation_args.vars is string %} |
220 | 205 | {# BigQuery does not handle the yaml-string from "--vars" well, when passed to "parse_json". Workaround is to parse the string, and then "tojson" will properly format the dict as a json-object. #} |
221 | | - {% set parsed_inv_args_vars = fromyaml(invocation_args_dict.vars) %} |
222 | | - {% do invocation_args_dict.update({'vars': parsed_inv_args_vars}) %} |
| 206 | + {% set parsed_inv_args_vars = fromyaml(invocation_args.vars) %} |
| 207 | + {% do invocation_args.update({'vars': parsed_inv_args_vars}) %} |
223 | 208 | {% endif %} |
224 | 209 | {% endif %} |
225 | 210 |
|
226 | | - $${{ tojson(invocation_args_dict) }}$$, {# invocation_args #} |
| 211 | + $${{ tojson(invocation_args) }}$$, {# invocation_args #} |
227 | 212 |
|
228 | 213 | {% set metadata_env = {} %} |
229 | 214 | {% for key, value in dbt_metadata_envs.items() %} |
|
236 | 221 |
|
237 | 222 | {% endmacro -%} |
238 | 223 |
|
239 | | -{% macro trino__get_invocations_dml_sql() -%} |
| 224 | +{% macro trino__get_invocations_dml_sql(invocation_args=invocation_args_dict) -%} |
240 | 225 | {% set invocation_values %} |
241 | 226 | ( |
242 | 227 | '{{ invocation_id }}', {# command_invocation_id #} |
|
298 | 283 | {% endmacro -%} |
299 | 284 |
|
300 | 285 |
|
301 | | -{% macro sqlserver__get_invocations_dml_sql() -%} |
| 286 | +{% macro sqlserver__get_invocations_dml_sql(invocation_args=invocation_args_dict) -%} |
302 | 287 | {% set invocation_values %} |
303 | 288 | select |
304 | 289 | "1", |
|
356 | 341 | {% else %} |
357 | 342 | null, {# dbt_vars #} |
358 | 343 | {% endif %} |
359 | | - '{{ tojson(invocation_args_dict) | replace("'", "''") }}', {# invocation_args #} |
| 344 | + '{{ tojson(invocation_args) | replace("'", "''") }}', {# invocation_args #} |
360 | 345 |
|
361 | 346 | {% set metadata_env = {} %} |
362 | 347 | {% for key, value in dbt_metadata_envs.items() %} |
|
0 commit comments