Skip to content

Commit 7518bcb

Browse files
authored
Merge pull request #79 from oracle/dev/1.4.2
v1.4.2
2 parents a13e007 + 63701c7 commit 7518bcb

File tree

14 files changed

+77
-20
lines changed

14 files changed

+77
-20
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- name: Install dbt-oracle with core dependencies
4949
run: |
5050
python -m pip install --upgrade pip
51-
pip install pytest dbt-tests-adapter==1.4.4
51+
pip install pytest dbt-tests-adapter==1.4.5
5252
pip install -r requirements.txt
5353
pip install -e .
5454

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Configuration variables
2-
VERSION=1.4.1
2+
VERSION=1.4.2
33
PROJ_DIR?=$(shell pwd)
44
VENV_DIR?=${PROJ_DIR}/.bldenv
55
BUILD_DIR=${PROJ_DIR}/build

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
[![PyPI version](https://badge.fury.io/py/dbt-oracle.svg)](https://pypi.python.org/pypi/dbt-oracle)
44
[![dbt-tests-adapter](https://github.com/oracle/dbt-oracle/actions/workflows/oracle-xe-adapter-tests.yml/badge.svg)](https://github.com/oracle/dbt-oracle/actions/workflows/oracle-xe-adapter-tests.yml)
5+
[![dbt-oracle docs](https://img.shields.io/badge/docs-read-blue)](https://docs.getdbt.com/reference/warehouse-setups/oracle-setup)
6+
[![dbt-oracle license](https://img.shields.io/badge/license-Apache%202.0-blue)][4]
57

68
`dbt-oracle` implements [dbt (data build tool)](https://docs.getdbt.com/docs/introduction) functionalities for the Oracle database.
79

@@ -11,7 +13,14 @@ From version 1.0.0, dbt-oracle is maintained and distributed by Oracle.
1113

1214
## Installation
1315

14-
For installation, read how you can set up [Oracle profile][1] for dbt.
16+
```bash
17+
pip install dbt-oracle
18+
```
19+
20+
21+
## Documentation
22+
23+
Please refer to the [Oracle setup on dbt docs website][1] for documentation.
1524

1625
## Sample project
1726

dbt/adapters/oracle/__version__.py

Lines changed: 1 addition & 1 deletion
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.4.4"
17+
version = "1.4.5"

dbt/adapters/oracle/connection_helper.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ class OracleDriverType(str, enum.Enum):
106106
description = (
107107
f"cx_oracle will soon be deprecated, use python-oracledb"
108108
f"\n\nTo switch to python-oracledb set the environment variable ORA_PYTHON_DRIVER_TYPE=thin "
109-
f"or ORA_PYTHON_DRIVER_TYPE=thick"
110109
f"\n\nRead the guideline here: "
111110
f"https://docs.getdbt.com/reference/warehouse-setups/oracle-setup#configure-the-python-driver-mode"
112111
f"\n\nDocumentation for python-oracledb can be found here: "

dbt/include/oracle/macros/adapters.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@
114114
global temporary
115115
{%- endif %} table {{ relation.include(schema=(not temporary)) }}
116116
{% if temporary -%} on commit preserve rows {%- endif %}
117-
{% if parallel %} parallel {{ parallel }}{% endif %}
118-
{% if compression_clause %} {{ compression_clause }} {% endif %}
117+
{% if not temporary -%}
118+
{% if parallel %} parallel {{ parallel }}{% endif %}
119+
{% if compression_clause %} {{ compression_clause }} {% endif %}
120+
{%- endif %}
119121
as
120122
{{ sql }}
121123

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,21 @@
9393
9494
9595
{% macro oracle__get_incremental_append_sql(args_dict) %}
96+
{%- set parallel = config.get('parallel', none) -%}
9697
{%- set dest_columns = args_dict["dest_columns"] -%}
9798
{%- set temp_relation = args_dict["temp_relation"] -%}
9899
{%- set target_relation = args_dict["target_relation"] -%}
99100
{%- set dest_column_names = dest_columns | map(attribute='name') | list -%}
100101
{%- set dest_cols_csv = get_quoted_column_csv(model, dest_column_names) -%}
101-
INSERT INTO {{ target_relation }} ({{ dest_cols_csv }})
102+
INSERT INTO {% if parallel %} /*+parallel({{ parallel }})*/ {% endif %} {{ target_relation }} ({{ dest_cols_csv }})
102103
(
103104
SELECT {{ dest_cols_csv }}
104105
FROM {{ temp_relation }}
105106
)
106107
{% endmacro %}
107108
108109
{% macro oracle__get_incremental_merge_sql(args_dict) %}
110+
{%- set parallel = config.get('parallel', none) -%}
109111
{%- set dest_columns = args_dict["dest_columns"] -%}
110112
{%- set temp_relation = args_dict["temp_relation"] -%}
111113
{%- set target_relation = args_dict["target_relation"] -%}
@@ -120,7 +122,7 @@
120122
{%- set unique_key_result = oracle_check_and_quote_unique_key_for_incremental_merge(unique_key, incremental_predicates) -%}
121123
{%- set unique_key_list = unique_key_result['unique_key_list'] -%}
122124
{%- set unique_key_merge_predicates = unique_key_result['unique_key_merge_predicates'] -%}
123-
merge into {{ target_relation }} DBT_INTERNAL_DEST
125+
merge into {% if parallel %} /*+parallel({{ parallel }})*/ {% endif %} {{ target_relation }} DBT_INTERNAL_DEST
124126
using {{ temp_relation }} DBT_INTERNAL_SOURCE
125127
on ({{ unique_key_merge_predicates | join(' AND ') }})
126128
when matched then
@@ -136,7 +138,7 @@
136138
{% endfor -%}
137139
)
138140
{%- else -%}
139-
insert into {{ target_relation }} ({{ dest_cols_csv }})
141+
insert into {% if parallel %} /*+parallel({{ parallel }})*/ {% endif %} {{ target_relation }} ({{ dest_cols_csv }})
140142
(
141143
select {{ dest_cols_csv }}
142144
from {{ temp_relation }}

dbt_adbs_test_project/models/us_product_sales_channel_ranking.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
{{
1717
config(
1818
materialized='incremental',
19-
unique_key='group_id')
19+
unique_key='group_id',
20+
parallel=4,
21+
table_compression_clause='COLUMN STORE COMPRESS FOR QUERY LOW')
2022
}}
2123

2224
SELECT prod_name, channel_desc, calendar_month_desc,
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{#
2+
Copyright (c) 2022, 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+
config(
18+
materialized='incremental',
19+
incremental_strategy='append',
20+
parallel=4,
21+
table_compression_clause='COLUMN STORE COMPRESS FOR QUERY LOW')
22+
}}
23+
24+
SELECT prod_name, channel_desc, calendar_month_desc,
25+
{{ snapshot_hash_arguments(['prod_name', 'channel_desc', 'calendar_month_desc']) }} AS group_id,
26+
TO_CHAR(SUM(amount_sold), '9,999,999,999') SALES$,
27+
RANK() OVER (ORDER BY SUM(amount_sold)) AS default_rank,
28+
RANK() OVER (ORDER BY SUM(amount_sold) DESC NULLS LAST) AS custom_rank
29+
FROM {{ source('sh_database', 'sales') }}, {{ source('sh_database', 'products') }}, {{ source('sh_database', 'customers') }},
30+
{{ source('sh_database', 'times') }}, {{ source('sh_database', 'channels') }}, {{ source('sh_database', 'countries') }}
31+
WHERE sales.prod_id=products.prod_id AND sales.cust_id=customers.cust_id
32+
AND customers.country_id = countries.country_id AND sales.time_id=times.time_id
33+
AND sales.channel_id=channels.channel_id
34+
AND country_iso_code='US'
35+
36+
{% if is_incremental() %}
37+
38+
AND times.calendar_month_desc > (SELECT MAX(calendar_month_desc) FROM {{ this }})
39+
40+
{% endif %}
41+
42+
GROUP BY prod_name, channel_desc, calendar_month_desc
43+

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dbt-core==1.4.4
1+
dbt-core==1.4.5
22
cx_Oracle==8.3.0
33
oracledb==1.2.2
44

0 commit comments

Comments
 (0)