Skip to content

Commit

Permalink
Switch from environment variable to behavior flag for gating microbat…
Browse files Browse the repository at this point in the history
…ch functionality
  • Loading branch information
QMalcolm committed Oct 1, 2024
1 parent b414668 commit f7ec548
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@ def assert_row_count(self, project, relation_name: str, expected_row_count: int)

assert len(result) == expected_row_count, f"{relation_name}:{pformat(result)}"

@mock.patch.dict(os.environ, {"DBT_EXPERIMENTAL_MICROBATCH": "True"})
@pytest.fixture(scope="class")
def project_config_update(self):
return {
"flags": {
"require_builtin_microbatch_strategy": True,
}
}

def test_run_with_event_time(self, project, insert_two_rows_sql):
# initial run -- backfills all data
with patch_microbatch_end_time("2020-01-03 13:57:00"):
Expand Down
4 changes: 2 additions & 2 deletions dbt/adapters/base/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def _behavior_flags(self) -> List[BehaviorFlag]:
"""
This method should be overwritten by adapter maintainers to provide platform-specific flags
"""
return []
return [{"name": "require_builtin_microbatch_strategy", "default": False}]

###
# Methods that pass through to the connection manager
Expand Down Expand Up @@ -1570,7 +1570,7 @@ def valid_incremental_strategies(self):

def builtin_incremental_strategies(self):
builtin_strategies = ["append", "delete+insert", "merge", "insert_overwrite"]
if os.environ.get("DBT_EXPERIMENTAL_MICROBATCH"):
if self.behavior.require_builtin_microbatch_strategy:
builtin_strategies.append("microbatch")

return builtin_strategies
Expand Down

0 comments on commit f7ec548

Please sign in to comment.