Skip to content

Commit

Permalink
fix calc_batch_size #407
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaslortiz committed Aug 21, 2023
1 parent 9546c40 commit 0b828b1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

{% macro calc_batch_size(num_columns) %}
{#
SQL Server allows for a max of 2100 parameters in a single statement.
SQL Server allows for a max of 2098 parameters in a single statement.
Check if the max_batch_size fits with the number of columns, otherwise
reduce the batch size so it fits.
#}
{% set max_batch_size = get_batch_size() %}
{% set calculated_batch = (2100 / num_columns)|int %}
{% set calculated_batch = (2098 / num_columns)|int %}
{% set batch_size = [max_batch_size, calculated_batch] | min %}

{{ return(batch_size) }}
Expand Down

0 comments on commit 0b828b1

Please sign in to comment.