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 authored and benc-db committed Nov 7, 2023
1 parent 4de37c6 commit d145f3a
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 d145f3a

Please sign in to comment.