Skip to content

Commit 5fec8ee

Browse files
committed
Downgrade INSERT_OVERWRITE error to warning for SQL warehouses
1 parent 901ecf0 commit 5fec8ee

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

dbt/include/databricks/macros/materializations/incremental/incremental.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@
191191
set spark.sql.sources.partitionOverwriteMode = {{ value }}
192192
{%- endcall -%}
193193
{% else %}
194-
{{ exceptions.raise_compiler_error('INSERT OVERWRITE is only properly supported on all-purpose clusters. On SQL Warehouses, this strategy would be equivalent to using the table materialization.') }}
194+
{{ exceptions.warn("INSERT OVERWRITE is only properly supported on all-purpose clusters. On SQL Warehouses, this strategy would be equivalent to using the table materialization.") }}
195195
{% endif %}
196196
{% endmacro %}
197197

tests/functional/adapter/incremental/test_incremental_strategies.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,37 @@ def test_incremental(self, project):
150150
util.check_relations_equal(project.adapter, ["overwrite_model", "upsert_expected"])
151151

152152

153+
# Insert overwrite in SQL warehouse is expected to behave like a table materialization
154+
# We support this as a short term hack for customers who want the side effect of reusing
155+
# the same table on subsequent runs
156+
@pytest.mark.skip_profile("databricks_uc_cluster", "databricks_cluster")
157+
class TestInsertOverwriteSqlWarehouse(IncrementalBase):
158+
@pytest.fixture(scope="class")
159+
def project_config_update(self):
160+
return {
161+
"models": {
162+
"+incremental_strategy": "insert_overwrite",
163+
"+partition_by": "id",
164+
},
165+
}
166+
167+
@pytest.fixture(scope="class")
168+
def seeds(self):
169+
return {
170+
"overwrite_expected.csv": fixtures.overwrite_expected,
171+
}
172+
173+
@pytest.fixture(scope="class")
174+
def models(self):
175+
return {
176+
"overwrite_model.sql": fixtures.base_model,
177+
}
178+
179+
def test_incremental(self, project):
180+
self.seed_and_run_twice()
181+
util.check_relations_equal(project.adapter, ["overwrite_model", "overwrite_expected"])
182+
183+
153184
@pytest.mark.external
154185
@pytest.mark.skip("This test is not repeatable due to external location")
155186
class TestInsertOverwriteParquet(InsertOverwriteBase):

0 commit comments

Comments
 (0)