diff --git a/Makefile b/Makefile index ade00f9..0253c39 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # Configuration variables -VERSION=1.7.5 +VERSION=1.7.6 PROJ_DIR?=$(shell pwd) VENV_DIR?=${PROJ_DIR}/.bldenv BUILD_DIR=${PROJ_DIR}/build diff --git a/dbt/adapters/oracle/__version__.py b/dbt/adapters/oracle/__version__.py index 0fdcd4c..4fb8d1d 100644 --- a/dbt/adapters/oracle/__version__.py +++ b/dbt/adapters/oracle/__version__.py @@ -14,4 +14,4 @@ See the License for the specific language governing permissions and limitations under the License. """ -version = "1.7.14" +version = "1.7.16" diff --git a/dbt/include/oracle/macros/materializations/incremental/strategies.sql b/dbt/include/oracle/macros/materializations/incremental/strategies.sql index 97be12b..dad5005 100644 --- a/dbt/include/oracle/macros/materializations/incremental/strategies.sql +++ b/dbt/include/oracle/macros/materializations/incremental/strategies.sql @@ -193,7 +193,7 @@ from {{ temp_relation }})'; END; {%- else -%} - insert {%- if parallel -%} /*+parallel({{ parallel }})*/ {%- endif -%} into {{ target_relation }} ({{ dest_cols_csv }}) + insert {% if parallel %} /*+parallel({{ parallel }})*/ {% endif %} into {{ target_relation }} ({{ dest_cols_csv }}) ( select {{ dest_cols_csv }} from {{ temp_relation }} diff --git a/dbt_adbs_test_project/models/us_product_delete_insert_append.sql b/dbt_adbs_test_project/models/us_product_delete_insert_append.sql new file mode 100644 index 0000000..4e17b8d --- /dev/null +++ b/dbt_adbs_test_project/models/us_product_delete_insert_append.sql @@ -0,0 +1,43 @@ +{# + Copyright (c) 2024, Oracle and/or its affiliates. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} +{{ + config( + materialized='incremental', + incremental_strategy='delete+insert', + parallel=4, + partition_config={"clause": "PARTITION BY HASH(PROD_NAME) PARTITIONS 4"}, + table_compression_clause='COLUMN STORE COMPRESS FOR QUERY LOW') +}} + +SELECT prod_name, channel_desc, calendar_month_desc, + {{ snapshot_hash_arguments(['prod_name', 'channel_desc', 'calendar_month_desc']) }} AS group_id, + TO_CHAR(SUM(amount_sold), '9,999,999,999') SALES$, + RANK() OVER (ORDER BY SUM(amount_sold)) AS default_rank, + RANK() OVER (ORDER BY SUM(amount_sold) DESC NULLS LAST) AS custom_rank +FROM {{ source('sh_database', 'sales') }}, {{ source('sh_database', 'products') }}, {{ source('sh_database', 'customers') }}, + {{ source('sh_database', 'times') }}, {{ source('sh_database', 'channels') }}, {{ source('sh_database', 'countries') }} +WHERE sales.prod_id=products.prod_id AND sales.cust_id=customers.cust_id + AND customers.country_id = countries.country_id AND sales.time_id=times.time_id + AND sales.channel_id=channels.channel_id + AND country_iso_code='US' + +{% if is_incremental() %} + + AND times.calendar_month_desc > (SELECT MAX(calendar_month_desc) FROM {{ this }}) + +{% endif %} + +GROUP BY prod_name, channel_desc, calendar_month_desc diff --git a/requirements.txt b/requirements.txt index a3aa617..85ea959 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ dbt-core~=1.7,<1.8 -oracledb==2.2.0 +oracledb==2.2.1 diff --git a/setup.cfg b/setup.cfg index 79ca43b..6dc7aee 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = dbt-oracle -version = 1.7.5 +version = 1.7.6 description = dbt (data build tool) adapter for Oracle Autonomous Database long_description = file: README.md long_description_content_type = text/markdown @@ -34,7 +34,7 @@ packages = find_namespace: include_package_data = True install_requires = dbt-core~=1.7,<1.8 - oracledb==2.2.0 + oracledb==2.2.1 test_suite=tests test_requires = dbt-tests-adapter~=1.7,<1.8 diff --git a/setup.py b/setup.py index 06d45a3..5a55d7c 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ """ -Copyright (c) 2022, Oracle and/or its affiliates. +Copyright (c) 2024, Oracle and/or its affiliates. Copyright (c) 2020, Vitor Avancini Licensed under the Apache License, Version 2.0 (the "License"); @@ -41,7 +41,7 @@ requirements = [ "dbt-core~=1.7,<1.8", - "oracledb==2.2.0" + "oracledb==2.2.1" ] test_requirements = [ @@ -59,7 +59,7 @@ url = 'https://github.com/oracle/dbt-oracle' -VERSION = '1.7.5' +VERSION = '1.7.6' setup( author="Oracle", python_requires='>=3.8',