Skip to content

Commit

Permalink
Fix microbatch behavior flag check
Browse files Browse the repository at this point in the history
Previously we were adding `microbatch` to the list of `builtin_incremental_strategies`
only when the behavior flag `require_batched_execution_for_custom_microbatch_strategy`
was set to True. However in reality, we only want to set it True when that flag evaluates
to False. This is because having the flag set to True implies by the transitive property
that the project has a custom microbatch macro defined. In this situation, we _don't_ want
`microbatch` to be in the list of `builtins` because if the adapter doesn't have a builtin
`microbatch` macro, things will break. Said another way, the only time that having `microbatch`
in the list of builtin incremental strategies is relevant is when the flag is False.
  • Loading branch information
QMalcolm committed Nov 13, 2024
1 parent a72379e commit f376760
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20241112-141109.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Negate the check for microbatch behavior flag in determining builtins
time: 2024-11-12T14:11:09.341634-06:00
custom:
Author: QMalcolm
Issue: 349
2 changes: 1 addition & 1 deletion dbt/adapters/base/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,7 @@ def valid_incremental_strategies(self):

def builtin_incremental_strategies(self):
builtin_strategies = ["append", "delete+insert", "merge", "insert_overwrite"]
if self.behavior.require_batched_execution_for_custom_microbatch_strategy.no_warn:
if not self.behavior.require_batched_execution_for_custom_microbatch_strategy.no_warn:
builtin_strategies.append("microbatch")

return builtin_strategies
Expand Down

0 comments on commit f376760

Please sign in to comment.