Skip to content

feat: Use merge for delta and iceberg trino catalogs#5379

Closed
eakmanrq wants to merge 1 commit intomainfrom
eakmanrq/merge_iceberg_delta_trino
Closed

feat: Use merge for delta and iceberg trino catalogs#5379
eakmanrq wants to merge 1 commit intomainfrom
eakmanrq/merge_iceberg_delta_trino

Conversation

@eakmanrq
Copy link
Collaborator

Prior to this PR, Trino engine against Iceberg and Delta Lake catalogs would use DELETE+INSERT without a transaction for insert/overwrite instead of MERGE. MERGE allows the operation to be atomic which is preferred.

Also did some cleanup by deprecating InsertOverwriteWithMergeMixin and instead rely solely on INSERT_OVERWRITE_STRATEGY. Basically before we had two ways of doing the same thing so this consolidates into a single way.

@eakmanrq eakmanrq force-pushed the eakmanrq/merge_iceberg_delta_trino branch from 77bd715 to 329b2f2 Compare September 15, 2025 19:19
Comment on lines -345 to -354
def test_insert_overwrite_by_time_partition_replace_where_pandas(
make_mocked_engine_adapter: t.Callable, mocker: MockerFixture, make_temp_table_name: t.Callable
):
mocker.patch(
"sqlmesh.core.engine_adapter.mssql.MSSQLEngineAdapter.table_exists",
return_value=False,
)

adapter = make_mocked_engine_adapter(MSSQLEngineAdapter)
adapter.INSERT_OVERWRITE_STRATEGY = InsertOverwriteStrategy.REPLACE_WHERE
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This test didn't make sense. It was changing the MSSQL engine adapter to use REPLACE_WHERE and then showing that it did nothing. It would now do something but that is expected. I think it will likely a copy/paste mistake from other tests without understanding the intent.

@eakmanrq
Copy link
Collaborator Author

This won't work since Trino doesn't support "WHEN NOT MATCHED BY SOURCE": trinodb/trino#25871

@eakmanrq eakmanrq closed this Sep 15, 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.

1 participant