Skip to content

Commit

Permalink
Remove type lookup and casting in double loop during INSERT statement…
Browse files Browse the repository at this point in the history
… when loading dbt seeds.
  • Loading branch information
tc-nrichards committed Oct 27, 2023
1 parent 9127720 commit a68509b
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
insert {% if loop.index0 == 0 -%} overwrite {% else -%} into {% endif -%} {{ this.render() }} values
{% for row in chunk -%}
({%- for col_name in agate_table.column_names -%}
{%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}
{%- set type = column_override.get(col_name, inferred_type) -%}
cast({{ get_binding_char() }} as {{type}})
{{ get_binding_char() }}
{%- if not loop.last%},{%- endif %}
{%- endfor -%})
{%- if not loop.last%},{%- endif %}
Expand Down

0 comments on commit a68509b

Please sign in to comment.