Skip to content

Commit 45e9ac4

Browse files
committed
Fixed unittests for snapshots
1 parent 07095d7 commit 45e9ac4

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

dbt/include/oracle/macros/materializations/snapshot/strategies.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
limitations under the License.
1616
#}
1717
{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}
18-
{% set check_cols_config = config['check_cols'] %}
19-
{% set primary_key = config['unique_key'] %}
18+
{% set check_cols_config = config.get('check_cols') %}
19+
{% set primary_key = config.get('unique_key') %}
2020
{% set hard_deletes = adapter.get_hard_deletes_behavior(config) %}
2121
{% set invalidate_hard_deletes = hard_deletes == 'invalidate' %}
2222

tests/functional/adapter/incremental_materialization/test_unique_id.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2022, Oracle and/or its affiliates.
2+
Copyright (c) 2025, Oracle and/or its affiliates.
33
Copyright (c) 2020, Vitor Avancini
44
55
Licensed under the Apache License, Version 2.0 (the "License");
@@ -57,6 +57,11 @@
5757
"""
5858

5959
models__expected__unique_key_list__inplace_overwrite_sql = """
60+
{{
61+
config(
62+
materialized='table'
63+
)
64+
}}
6065
SELECT
6166
'CT' AS state,
6267
'Hartford' AS county,
@@ -72,9 +77,16 @@
7277
SELECT 'NY','New York','Manhattan', TO_DATE('2021-04-01', 'YYYY-MM-DD') FROM DUAL
7378
union all
7479
SELECT 'PA','Philadelphia','Philadelphia', TO_DATE('2021-05-21', 'YYYY-MM-DD') FROM DUAL
80+
union all
81+
select 'CO','Denver',null,TO_DATE('2021-06-18', 'YYYY-MM-DD') FROM DUAL
7582
"""
7683

7784
models__expected__one_str__overwrite_sql = """
85+
{{
86+
config(
87+
materialized='table'
88+
)
89+
}}
7890
SELECT
7991
'CT' AS state,
8092
'Hartford' AS county,
@@ -90,6 +102,8 @@
90102
SELECT 'NY','New York','Manhattan', TO_DATE('2021-04-01', 'YYYY-MM-DD') FROM DUAL
91103
union all
92104
SELECT 'PA','Philadelphia','Philadelphia', TO_DATE('2021-05-21', 'YYYY-MM-DD') FROM DUAL
105+
union all
106+
select 'CO','Denver', null, TO_DATE('2021-06-18', 'YYYY-MM-DD') FROM DUAL
93107
"""
94108

95109

0 commit comments

Comments
 (0)