Skip to content

feat(athena): add conditional_merge_string parameter to to_iceberg#3361

Closed
bujjibabukatta wants to merge 2 commits into
aws:mainfrom
bujjibabukatta:fix/#3173
Closed

feat(athena): add conditional_merge_string parameter to to_iceberg#3361
bujjibabukatta wants to merge 2 commits into
aws:mainfrom
bujjibabukatta:fix/#3173

Conversation

@bujjibabukatta

Copy link
Copy Markdown
Contributor

Summary

Adds conditional_merge_string parameter to wr.athena.to_iceberg, resolving #3173.

When merge_condition='conditional_update' and a SQL predicate is passed via conditional_merge_string, the MERGE statement becomes:

WHEN MATCHED AND source."updated_at" > target."updated_at" THEN
    UPDATE SET ...

This prevents late-arriving records from overwriting more recent data.

Changes

  • Added conditional_update to merge_condition Literal
  • Added conditional_merge_string: str | None = None to to_iceberg, _merge_iceberg, and _validate_args
  • Added input validation — raises InvalidArgumentCombination if conditional_update is used without a predicate string
  • Updated docstrings

Backward compatibility

Fully backward compatible. Existing 'update' and 'ignore' behaviour is unchanged.

…g arg to _merge_iceberg and to_iceberg, enabling AND-predicate WHEN MATCHED clauses to prevent stale data overwrites. Resolves aws#3173.
@bujjibabukatta bujjibabukatta changed the title Adds 'conditional_update' merge_condition and conditional_merge_strin… feat(athena): add conditional_merge_string parameter to to_iceberg Jun 10, 2026

@kukushking kukushking left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test failures and a duplicate of #3201

@kukushking kukushking closed this Jun 10, 2026
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