|
24 | 24 | from sqlmesh.core.dialect import select_from_values |
25 | 25 | from sqlmesh.core.model import Model, load_sql_based_model |
26 | 26 | from sqlmesh.core.engine_adapter.shared import DataObject, DataObjectType |
27 | | -from sqlmesh.core.engine_adapter.mixins import RowDiffMixin |
| 27 | +from sqlmesh.core.engine_adapter.mixins import RowDiffMixin, LogicalMergeMixin |
28 | 28 | from sqlmesh.core.model.definition import create_sql_model |
29 | 29 | from sqlmesh.core.plan import Plan |
30 | 30 | from sqlmesh.core.state_sync.db import EngineAdapterStateSync |
@@ -1902,10 +1902,18 @@ def test_incremental_by_unique_key_model_when_matched(ctx: TestContext): |
1902 | 1902 | pytest.skip(f"{ctx.dialect} on {ctx.gateway} doesnt support merge") |
1903 | 1903 |
|
1904 | 1904 | # DuckDB and some other engines use logical_merge which doesn't support when_matched |
1905 | | - if ctx.dialect not in ["bigquery", "databricks", "postgres", "snowflake", "spark"]: |
1906 | | - pytest.skip(f"{ctx.dialect} doesn't support native MERGE with when_matched clause") |
| 1905 | + if isinstance(ctx.engine_adapter, LogicalMergeMixin): |
| 1906 | + pytest.skip( |
| 1907 | + f"{ctx.dialect} on {ctx.gateway} uses logical merge which doesn't support when_matched" |
| 1908 | + ) |
1907 | 1909 |
|
1908 | | - context = ctx.create_context() |
| 1910 | + def _mutate_config(current_gateway_name: str, config: Config): |
| 1911 | + connection = config.gateways[current_gateway_name].connection |
| 1912 | + connection.concurrent_tasks = 1 |
| 1913 | + if current_gateway_name == "inttest_redshift": |
| 1914 | + connection.enable_merge = True |
| 1915 | + |
| 1916 | + context = ctx.create_context(_mutate_config) |
1909 | 1917 | schema = ctx.schema(TEST_SCHEMA) |
1910 | 1918 |
|
1911 | 1919 | # Create seed data with multiple days |
|
0 commit comments