Skip to content

Conversation

gfrmin
Copy link

@gfrmin gfrmin commented Oct 8, 2025

Added version-aware support for MERGE statements in DuckDB adapter for versions 1.4.0 and above. Introduced _supports_merge property to check and cache version compatibility, enabling "merge" and "microbatch" incremental strategies alongside existing "append" and "delete+insert". Updated SQL macros to implement microbatch and merge logic for efficient batch processing and upserts.

Vahe Hakobyan and others added 27 commits August 5, 2025 21:25
…d merge to the valid incremental strategies for dbt
Added version-aware support for MERGE statements in DuckDB adapter for versions 1.4.0 and above. Introduced `_supports_merge` property to check and cache version compatibility, enabling "merge" and "microbatch" incremental strategies alongside existing "append" and "delete+insert". Updated SQL macros to implement microbatch and merge logic for efficient batch processing and upserts.
@jwills
Copy link
Collaborator

jwills commented Oct 8, 2025

Ah @gfrmin thanks for this-- we also have #605 that adds support for the merge strategy and has a richer set of configs for it afaict.

I don't normally need to rectify two different impls of the same feature, happy to discuss this in the dbt Slack or DuckDB discord

@gfrmin
Copy link
Author

gfrmin commented Oct 8, 2025

Oh wow, thanks for the tip! Will join the Slack to deduplicate efforts :)

…port

Merged changes from PR duckdb#605 (feature/merge-into-incremental-strategy)
which adds comprehensive MERGE incremental strategy support with DuckDB
extensions, while preserving microbatch incremental strategy support.

Key changes:
- Add comprehensive MERGE strategy with validation and custom clauses
- Support for DuckDB MERGE extensions (BY NAME, BY POSITION, etc.)
- Extensive configuration options for merge behavior
- DuckLake restrictions validation
- Preserve microbatch incremental strategy support
- Reorganize macros into incremental_strategy/ directory
- Add comprehensive merge strategy documentation to README

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
…detection

- Move microbatch macro from delete_insert.sql to dedicated microbatch.sql
- Microbatch now uses MERGE when available (DuckDB >= 1.4.0) for better performance
- Falls back to delete+insert on earlier DuckDB versions
- Follows incremental_strategy directory organization pattern

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@gfrmin gfrmin changed the title feat(duckdb): add MERGE and microbatch support for incremental strategies feat(duckdb): add microbatch support for incremental strategies Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants