Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
35070d7
bumping .latest branch variable in update_dependencies.sh to 1.5.latest
FishtownBuildBot Apr 13, 2023
8c8303d
[create-pull-request] automated change (#714)
github-actions[bot] Apr 17, 2023
c942e68
created 1.5.0rc1 changelog (#713)
mikealfare Apr 17, 2023
24c7792
ADAP-473: Table materialization not properly dropping existing relati…
github-actions[bot] Apr 21, 2023
45cc917
update docs for 1.5.0rc1 release (#728)
mikealfare Apr 22, 2023
7c70c36
[create-pull-request] automated change (#746)
github-actions[bot] Apr 27, 2023
8676b70
backport cce8975906ff5693d4c761ac32dc761f3f097a36 (#776)
emmyoop May 17, 2023
2ad6d2a
Finish Constraint Support for Spark (#747) (#795)
github-actions[bot] Jun 6, 2023
03d5d15
[Backport 1.5.latest] [Fix] Wrap constraint type 'check' expression i…
github-actions[bot] Jun 9, 2023
9d14652
backport 798 to 1.5.latest (#806)
MichelleArk Jun 14, 2023
2ec5ad6
[create-pull-request] automated change (#844)
github-actions[bot] Aug 1, 2023
7abad07
[create-pull-request] automated change (#854)
github-actions[bot] Aug 7, 2023
b4c76c6
Allow for scala models to be created
pekapa Sep 24, 2023
04713cf
Merge branch 'main' into submit-scala-jobs-beta
pekapa Sep 24, 2023
d2a858e
Delete .changes/1.5.0.md
pekapa Sep 24, 2023
f056b64
Delete .changes/1.5.1.md
pekapa Sep 24, 2023
c3d81c3
Delete .changes/1.5.2.md
pekapa Sep 24, 2023
7ca66cc
Update CHANGELOG.md
pekapa Sep 24, 2023
ac050f8
Update CHANGELOG.md
pekapa Sep 24, 2023
a895f66
Update CHANGELOG.md
pekapa Sep 24, 2023
82314ba
Update CHANGELOG.md
pekapa Sep 24, 2023
0e32655
Update dev-requirements.txt
pekapa Sep 24, 2023
84e8b15
Update test_constraints.py
pekapa Sep 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ADAP-473: Table materialization not properly dropping existing relati…
…on on refresh (#724) (#727)

* update `drop_relation()` to drop `target_relation` instead of `old_relation`; these should be the same anyway, but `old_relation` doesn't always get populated

* add in old relation type in cases where the relation type changes

(cherry picked from commit 44b10f9)

Co-authored-by: Mike Alfare <[email protected]>
  • Loading branch information
github-actions[bot] and mikealfare authored Apr 21, 2023
commit 24c77923b0ecf33d6c0bd279a21f3869d58a82cc
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20230420-214433.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Fixed issue where table materialization was not always properly refreshing for non-admin users on Databricks
time: 2023-04-20T21:44:33.343598-04:00
custom:
Author: mikealfare
Issue: "725"
22 changes: 14 additions & 8 deletions dbt/include/spark/macros/materializations/table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,22 @@
-- setup: if the target relation already exists, drop it
-- in case if the existing and future table is delta or iceberg, we want to do a
-- create or replace table instead of dropping, so we don't have the table unavailable
{% if old_relation and not (old_relation.is_delta and config.get('file_format', validator=validation.any[basestring]) == 'delta') -%}
{{ adapter.drop_relation(old_relation) }}
{%- endif %}

{% if old_relation and not (old_relation.is_iceberg and config.get('file_format', validator=validation.any[basestring]) == 'iceberg') -%}
{{ adapter.drop_relation(old_relation) }}
{%- endif %}
{% if old_relation is not none %}
{% set is_delta = (old_relation.is_delta and config.get('file_format', validator=validation.any[basestring]) == 'delta') %}
{% set is_iceberg = (old_relation.is_iceberg and config.get('file_format', validator=validation.any[basestring]) == 'iceberg') %}
{% set old_relation_type = old_relation.type %}
{% else %}
{% set is_delta = false %}
{% set is_iceberg = false %}
{% set old_relation_type = target_relation.type %}
{% endif %}

{% if not is_delta and not is_iceberg %}
{% set existing_relation = target_relation %}
{{ adapter.drop_relation(existing_relation.incorporate(type=old_relation_type)) }}
{% endif %}

-- build model

{%- call statement('main', language=language) -%}
{{ create_table_as(False, target_relation, compiled_code, language) }}
{%- endcall -%}
Expand Down