dbt-labs / dbt-adapters

Apache License 2.0
28 stars 38 forks source link

[Bug] `microbatch` is being added to `builtin_incremental_strategies` in the wrong situations #349

Closed QMalcolm closed 1 week ago

QMalcolm commented 1 week ago

Is this a new bug?

Current Behavior

Currently we are adding microbatch to the list of builtin_incremental_strategies only when the behavior flag require_batched_execution_for_custom_microbatch_strategy is set to True. However, 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.

Expected Behavior

microbatch should only be added to the list of builtin_incremental_strategies when the behavior flag require_batched_execution_for_custom_microbatch_strategy is False

Steps To Reproduce

  1. Grab an adapter that doesn't support microbatch yet, like dbt-athena
  2. Create a project with a custom microbatch macro
  3. Create a microbatch incremental model
  4. Set require_batched_execution_for_custom_microbatch_strategy to true in your project.yaml
  5. run dbt-run

Relevant log output

No response

Environment

- OS:
- Python:
- dbt-adapters:

Additional Context

No response