Skip to content

Fix incremental predicates#312

Open
mlilius wants to merge 4 commits intodremio:mainfrom
mlilius:fix-incremental-predicates
Open

Fix incremental predicates#312
mlilius wants to merge 4 commits intodremio:mainfrom
mlilius:fix-incremental-predicates

Conversation

@mlilius
Copy link
Copy Markdown

@mlilius mlilius commented Nov 25, 2025

Summary

Fix incremental_predicates option not being applied in merge strategy

Description

Fixes issue #306 where the incremental_predicates config option had no effect when using the merge incremental strategy.

Root Cause:
The incremental_predicates config was being read from the model configuration but wasn't being passed through to the merge SQL generation macro. The dbt_dremio_get_incremental_sql macro was hardcoded to pass incremental_predicates=none to the merge strategy, ignoring any predicates defined in the model config.

Changes Made:

  1. Added incremental_predicates parameter to the dbt_dremio_get_incremental_sql macro signature in strategies.sql
  2. Updated the materialization to pass incremental_predicates when calling dbt_dremio_get_incremental_sql in incremental.sql
  3. Fixed the merge strategy call to use the passed incremental_predicates parameter instead of hardcoding none

Files Modified:

  • dbt/include/dremio/macros/materializations/incremental/incremental.sql - Pass incremental_predicates to the SQL generation macro
  • dbt/include/dremio/macros/materializations/incremental/strategies.sql - Accept and forward incremental_predicates parameter

Test Results

  • Verified that incremental_predicates are now properly included in the MERGE statement's ON clause
  • Tested with both single and multiple predicate configurations
  • Confirmed backward compatibility (models without incremental_predicates continue to work as before)
  • All existing incremental materialization tests pass

Changelog

  • Added a summary of what this PR accomplishes to CHANGELOG.md

Contributor License Agreement

Related Issue

#306 - incremental_predicates option has no effect

…es in SQL generation. Added tests for incremental predicates and verified parameter passing through the macro chain. This addresses potential issues with SQL keywords and improves overall robustness of the incremental materialization process.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant