Skip to content

Commit 3b13c5f

Browse files
authored
Merge pull request #159 from oracle/dev/v1.8.4
v1.8.4
2 parents 47d72d0 + 01f357b commit 3b13c5f

File tree

10 files changed

+86
-18
lines changed

10 files changed

+86
-18
lines changed

.github/workflows/oracle-xe-adapter-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
fail-fast: true
99
matrix:
1010
os: [ ubuntu-latest ]
11-
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12']
11+
python-version: ['3.9', '3.10', '3.11', '3.12']
1212

1313
services:
1414
oracle_db_xe:

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Configuration variables
2-
VERSION=1.8.3
2+
VERSION=1.8.4
33
PROJ_DIR?=$(shell pwd)
44
VENV_DIR?=${PROJ_DIR}/.bldenv
55
BUILD_DIR=${PROJ_DIR}/build

dbt/adapters/oracle/__version__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
See the License for the specific language governing permissions and
1515
limitations under the License.
1616
"""
17-
version = "1.8.3"
17+
version = "1.8.4"

dbt/include/oracle/macros/adapters.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@
159159
{%- set sql = get_select_subquery(sql) %}
160160
{% endif %}
161161
{% if temporary -%} on commit preserve rows {%- endif %}
162+
{% if parallel %} parallel {{ parallel }}{% endif %}
162163
{% if not temporary -%}
163164
{% if partition_clause %} {{ partition_clause }} {% endif %}
164-
{% if parallel %} parallel {{ parallel }}{% endif %}
165165
{% if compression_clause %} {{ compression_clause }} {% endif %}
166166
{%- endif %}
167167
as

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
{{ strategy.scd_id }} as dbt_scd_id,
165165
{{ strategy.updated_at }} as dbt_updated_at,
166166
{{ strategy.updated_at }} as dbt_valid_from,
167-
cast(nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as DATE) as dbt_valid_to
167+
cast(nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as TIMESTAMP(9)) as dbt_valid_to
168168
from (
169169
{{ sql }}
170170
) sbq
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{#
2+
Copyright (c) 2024, Oracle and/or its affiliates.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
#}
16+
17+
{#
18+
Legacy hash function ORA_HASH is known to have collisions in large datasets
19+
causing errors in snapshot merge statement. Please check the below Github
20+
issues:
21+
22+
https://github.com/oracle/dbt-oracle/issues/52
23+
https://github.com/oracle/dbt-oracle/issues/102
24+
25+
This hash function is used in the marcro oracle__snapshot_hash_arguments
26+
27+
dbt-oracle 1.9 will switch to a stronger hash function - SHA256. Changing the
28+
hash function will invalidate existing snapshots.These helper macros will
29+
ensure a smoother transition to dbt-oracle 1.9.
30+
31+
It is recommended for teams to switch to SHA256 hash function before
32+
dbt-oracle 1.9 using a 2-step process:
33+
1. Create a macro oracle__snapshot_hash_arguments(args) in your dbt project
34+
Copy paste the contents of macro
35+
oracle__snapshot_standard_hash_arguments(args) shown below. This will become
36+
the default from dbt-oracle 1.9
37+
38+
2. Run the following operation on your snapshot table
39+
40+
dbt --debug run-operation update_legacy_dbt_scd_id \
41+
--args '{snapshot_table: PROMOTION_COSTS_SNAPSHOT, cols: ["promo_id", "dbt_updated_at"]}'
42+
43+
#}
44+
45+
{% macro oracle__snapshot_standard_hash_arguments(args) -%}
46+
STANDARD_HASH({%- for arg in args -%}
47+
coalesce(cast({{ arg }} as varchar(4000) ), '')
48+
{% if not loop.last %} || '|' || {% endif %}
49+
{%- endfor -%}, 'SHA256')
50+
{%- endmacro %}
51+
52+
53+
{% macro update_legacy_dbt_scd_id(snapshot_table, cols) -%}
54+
55+
{%- call statement('update_legacy_dbt_scd_id_dtype') -%}
56+
BEGIN
57+
UPDATE {{ snapshot_table }} SET DBT_SCD_ID = NULL;
58+
COMMIT;
59+
EXECUTE IMMEDIATE 'ALTER TABLE {{ snapshot_table }} MODIFY (dbt_scd_id RAW(32))';
60+
END;
61+
{%- endcall -%}
62+
63+
{%- call statement('update_legacy_dbt_scd_id') -%}
64+
BEGIN
65+
UPDATE {{ snapshot_table }}
66+
SET dbt_scd_id = {{ oracle__snapshot_standard_hash_arguments(cols) }};
67+
COMMIT;
68+
END;
69+
{%- endcall -%}
70+
{%- endmacro %}

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
dbt-common>=1.1.0,<2.0
22
dbt-adapters>=1.2.1,<2.0
33
dbt-core>=1.8.1,<2.0
4-
oracledb==2.4.1
4+
oracledb==2.5.1

setup.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = dbt-oracle
3-
version = 1.8.3
3+
version = 1.8.4
44
description = dbt (data build tool) adapter for Oracle Autonomous Database
55
long_description = file: README.md
66
long_description_content_type = text/markdown
@@ -12,7 +12,6 @@ classifiers =
1212
Intended Audience :: Developers
1313
License :: OSI Approved :: Apache Software License
1414
Programming Language :: Python :: 3
15-
Programming Language :: Python :: 3.8
1615
Programming Language :: Python :: 3.9
1716
Programming Language :: Python :: 3.10
1817
Programming Language :: Python :: 3.11
@@ -28,15 +27,15 @@ project_urls =
2827
Release Notes = https://github.com/oracle/dbt-oracle/releases
2928

3029
[options]
31-
python_requires = >=3.8
30+
python_requires = >=3.9
3231
zip_safe = False
3332
packages = find_namespace:
3433
include_package_data = True
3534
install_requires =
3635
dbt-common>=1.1.0,<2.0
3736
dbt-adapters>=1.2.1,<2.0
3837
dbt-core~=1.8,<1.9
39-
oracledb==2.4.1
38+
oracledb==2.5.1
4039
test_suite=tests
4140
test_requires =
4241
dbt-tests-adapter~=1.8,<1.9

setup.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929

3030

3131
# lockstep with dbt-core which requires Python > 3.8
32-
if sys.version_info < (3, 8):
32+
if sys.version_info < (3, 9):
3333
print("Error: dbt-oracle does not support this version of Python.")
34-
print("Please upgrade to Python 3.8 or higher.")
34+
print("Please upgrade to Python 3.9 or higher.")
3535
sys.exit(1)
3636

3737

@@ -43,7 +43,7 @@
4343
"dbt-common>=1.1.0,<2.0",
4444
"dbt-adapters>=1.2.1,<2.0",
4545
"dbt-core~=1.8,<1.9",
46-
"oracledb==2.4.1"
46+
"oracledb==2.5.1"
4747
]
4848

4949
test_requirements = [
@@ -61,17 +61,16 @@
6161

6262
url = 'https://github.com/oracle/dbt-oracle'
6363

64-
VERSION = '1.8.3'
64+
VERSION = '1.8.4'
6565
setup(
6666
author="Oracle",
67-
python_requires='>=3.8',
67+
python_requires='>=3.9',
6868
classifiers=[
6969
'Development Status :: 5 - Production/Stable',
7070
'Intended Audience :: Developers',
7171
'License :: OSI Approved :: Apache Software License',
7272
'Natural Language :: English',
7373
'Programming Language :: Python :: 3',
74-
'Programming Language :: Python :: 3.8',
7574
'Programming Language :: Python :: 3.9',
7675
'Programming Language :: Python :: 3.10',
7776
'Programming Language :: Python :: 3.11',

tox.ini

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py3{8,9,10,11,12}
2+
envlist = py3{9,10,11,12}
33

44
[testenv]
55
passenv =
@@ -15,7 +15,7 @@ passenv =
1515

1616
deps =
1717
-rrequirements.txt
18-
dbt-tests-adapter~=1.7,<1.8
18+
dbt-tests-adapter~=1.8,<1.9
1919
pytest
2020

2121
commands = pytest

0 commit comments

Comments
 (0)