Skip to content

v1.9.2 #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Configuration variables
VERSION=1.9.1
VERSION=1.9.2
PROJ_DIR?=$(shell pwd)
VENV_DIR?=${PROJ_DIR}/.bldenv
BUILD_DIR=${PROJ_DIR}/build
Expand Down
10 changes: 10 additions & 0 deletions dbt/include/oracle/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -422,3 +422,13 @@
{% set db_name = results.columns[0].values()[0] %}
{{ return(db_name) }}
{% endmacro %}

{% macro generate_insert_hint(parallel, insert_mode) %}
{% if parallel and insert_mode == 'append' %}
/*+parallel({{ parallel }}) append*/
{% elif parallel %}
/*+parallel({{ parallel }})*/
{% elif insert_mode == 'append' %}
/*+ append */
{% endif %}
{% endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,15 @@

{% macro oracle__get_incremental_append_sql(args_dict) %}
{%- set parallel = config.get('parallel', none) -%}
{%- set insert_mode = config.get('insert_mode', none) -%}
{%- set insert_hint = generate_insert_hint(parallel, insert_mode) -%}
{%- set dest_columns = args_dict["dest_columns"] -%}
{%- set temp_relation = args_dict["temp_relation"] -%}
{%- set target_relation = args_dict["target_relation"] -%}
{%- set dest_column_names = dest_columns | map(attribute='name') | list -%}
{%- set dest_cols_csv = get_quoted_column_csv(model, dest_column_names) -%}
INSERT {% if parallel %} /*+PARALLEL({{ parallel }})*/ {% endif %} INTO {{ target_relation }} ({{ dest_cols_csv }})
INSERT {{ insert_hint }}
INTO {{ target_relation }} ({{ dest_cols_csv }})
(
SELECT {{ dest_cols_csv }}
FROM {{ temp_relation }}
Expand All @@ -108,6 +111,8 @@

{% macro oracle__get_incremental_merge_sql(args_dict) %}
{%- set parallel = config.get('parallel', none) -%}
{%- set insert_mode = config.get('insert_mode', none) -%}
{%- set insert_hint = generate_insert_hint(parallel, insert_mode) -%}
{%- set dest_columns = args_dict["dest_columns"] -%}
{%- set temp_relation = args_dict["temp_relation"] -%}
{%- set target_relation = args_dict["target_relation"] -%}
Expand Down Expand Up @@ -138,7 +143,8 @@
{% endfor -%}
)
{%- else -%}
insert {% if parallel %} /*+parallel({{ parallel }})*/ {% endif %} into {{ target_relation }} ({{ dest_cols_csv }})
insert {{ insert_hint }}
into {{ target_relation }} ({{ dest_cols_csv }})
(
select {{ dest_cols_csv }}
from {{ temp_relation }}
Expand Down Expand Up @@ -178,6 +184,8 @@

{% macro oracle__get_incremental_delete_insert_sql(args_dict) %}
{%- set parallel = config.get('parallel', none) -%}
{%- set insert_mode = config.get('insert_mode', none) -%}
{%- set insert_hint = generate_insert_hint(parallel, insert_mode) -%}
{%- set dest_columns = args_dict["dest_columns"] -%}
{%- set temp_relation = args_dict["temp_relation"] -%}
{%- set target_relation = args_dict["target_relation"] -%}
Expand All @@ -188,12 +196,14 @@
{%- if unique_key or incremental_predicates -%}
BEGIN
EXECUTE IMMEDIATE '{{ oracle__get_delete_sql_for_delete_insert_strategy(target_relation, temp_relation, unique_key, incremental_predicates) }}';
EXECUTE IMMEDIATE 'insert {% if parallel %} /*+parallel({{ parallel }})*/ {% endif %} into {{ target_relation }} ({{ dest_cols_csv }})(
EXECUTE IMMEDIATE 'INSERT {{ insert_hint }}
into {{ target_relation }} ({{ dest_cols_csv }})(
select {{ dest_cols_csv }}
from {{ temp_relation }})';
END;
{%- else -%}
insert {% if parallel %} /*+parallel({{ parallel }})*/ {% endif %} into {{ target_relation }} ({{ dest_cols_csv }})
insert {{ insert_hint }}
into {{ target_relation }} ({{ dest_cols_csv }})
(
select {{ dest_cols_csv }}
from {{ temp_relation }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@


{% materialization snapshot, adapter='oracle' %}
{%- set config = model['config'] -%}

{%- set target_table = model.get('alias', model.get('name')) -%}

Expand Down
1 change: 1 addition & 0 deletions dbt_adbs_test_project/models/us_product_delete_insert.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
incremental_predicates=["DBT_INTERNAL_DEST.calendar_month_desc > TO_CHAR(sysdate, ''yyyy/mm/dd'')"],
incremental_strategy='delete+insert',
parallel=4,
insert_mode="append",
partition_config={"clause": "PARTITION BY HASH(PROD_NAME) PARTITIONS 4"},
table_compression_clause='COLUMN STORE COMPRESS FOR QUERY LOW')
}}
Expand Down
7 changes: 6 additions & 1 deletion dbt_adbs_test_project/snapshots/promotion_costs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
strategy='check',
unique_key='promo_id',
check_cols='all',
hard_deletes='invalidate'
hard_deletes='invalidate',
snapshot_meta_column_names={
"dbt_valid_from": "promo_valid_from",
"dbt_valid_to": "promo_valid_to",
"dbt_scd_id": "dbt_scd_id"
}
)
}}
select * from {{ ref('promotion_costs') }}
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dbt-common>=1.1.0,<2.0
dbt-adapters>=1.2.1,<2.0
dbt-core>=1.9.1,<2.0
oracledb==3.1.0
oracledb==3.1.1
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = dbt-oracle
version = 1.9.1
version = 1.9.2
description = dbt (data build tool) adapter for Oracle Autonomous Database
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down Expand Up @@ -35,7 +35,7 @@ install_requires =
dbt-common>=1.1.0,<2.0
dbt-adapters>=1.2.1,<2.0
dbt-core~=1.9,<1.10
oracledb==3.1.0
oracledb==3.1.1
test_suite=tests
test_requires =
dbt-tests-adapter~=1.10,<1.11
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"dbt-common>=1.1.0,<2.0",
"dbt-adapters>=1.2.1,<2.0",
"dbt-core~=1.9,<1.10",
"oracledb==3.1.0"
"oracledb==3.1.1"
]

test_requirements = [
Expand All @@ -61,7 +61,7 @@

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

VERSION = '1.9.1'
VERSION = '1.9.2'
setup(
author="Oracle",
python_requires='>=3.9',
Expand Down