diff --git a/Makefile b/Makefile index d36d2ae..4cd83df 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # Configuration variables -VERSION=1.8.1 +VERSION=1.8.3 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 57528fd..6f8ca09 100644 --- a/dbt/adapters/oracle/__version__.py +++ b/dbt/adapters/oracle/__version__.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"); @@ -14,4 +14,4 @@ See the License for the specific language governing permissions and limitations under the License. """ -version = "1.8.1" +version = "1.8.3" diff --git a/dbt/adapters/oracle/relation.py b/dbt/adapters/oracle/relation.py index e0a8ec4..c0135ed 100644 --- a/dbt/adapters/oracle/relation.py +++ b/dbt/adapters/oracle/relation.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"); @@ -19,6 +19,7 @@ from dataclasses import dataclass, field from dbt.adapters.base.relation import BaseRelation +from dbt.adapters.contracts.relation import ComponentName from dbt.adapters.events.logging import AdapterLogger from dbt.adapters.relation_configs import ( RelationConfigBase, @@ -148,3 +149,19 @@ def materialized_view_config_changeset( return config_change_collection return None + + def _is_exactish_match(self, field: ComponentName, value: str) -> bool: + """ + + The only purpose of _is_exactish_match is to detect matches that are + approximate (case-insensitive and quote-stripped) but not exact, + so that dbt can raise an exception saying a too-similar relation + already exists in the cache + + """ + if self.dbt_created and self.quote_policy.get_part(field) is False: + return self.path.get_lowered_part(field) == value.lower() + elif self.quote_policy.get_part(field) is False: + return self.path.get_lowered_part(field) == value.lower() + else: + return self.path.get_part(field) == value diff --git a/dbt/adapters/oracle/sample_profiles.yml b/dbt/adapters/oracle/sample_profiles.yml index acc2465..387cb8a 100644 --- a/dbt/adapters/oracle/sample_profiles.yml +++ b/dbt/adapters/oracle/sample_profiles.yml @@ -7,6 +7,7 @@ default: host: "{{ env_var('DBT_ORACLE_HOST') }}" user: "{{ env_var('DBT_ORACLE_USER') }}" password: "{{ env_var('DBT_ORACLE_PASSWORD') }}" + database: "{{ env_var('DBT_ORACLE_DATABASE') }}" port: 1522 service: "{{ env_var('DBT_ORACLE_SERVICE') }}" schema: "{{ env_var('DBT_ORACLE_SCHEMA') }}" diff --git a/dbt/include/oracle/macros/relations/drop.sql b/dbt/include/oracle/macros/relations/drop.sql index 340bab0..82056ef 100644 --- a/dbt/include/oracle/macros/relations/drop.sql +++ b/dbt/include/oracle/macros/relations/drop.sql @@ -1,3 +1,17 @@ +{# + 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. +#} {%- macro oracle__get_drop_sql(relation) -%} DECLARE dne_942 EXCEPTION; @@ -10,8 +24,10 @@ SAVEPOINT start_transaction; {%- if relation.is_materialized_view -%} EXECUTE IMMEDIATE '{{ oracle__drop_materialized_view(relation) }}'; + {%- elif relation.is_table -%} + EXECUTE IMMEDIATE 'DROP table {{ relation }} cascade constraints purge'; {%- else -%} - EXECUTE IMMEDIATE 'DROP {{ relation.type }} {{ relation }} cascade constraint'; + EXECUTE IMMEDIATE 'DROP {{ relation.type }} {{ relation }} cascade constraints'; {%- endif -%} COMMIT; EXCEPTION diff --git a/requirements.txt b/requirements.txt index 9183567..c176417 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ dbt-common>=1.1.0,<2.0 dbt-adapters>=1.2.1,<2.0 dbt-core>=1.8.1,<2.0 -oracledb==2.3.0 +oracledb==2.4.1 diff --git a/setup.cfg b/setup.cfg index c87a843..422b8cc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = dbt-oracle -version = 1.8.1 +version = 1.8.3 description = dbt (data build tool) adapter for Oracle Autonomous Database long_description = file: README.md long_description_content_type = text/markdown @@ -36,7 +36,7 @@ install_requires = dbt-common>=1.1.0,<2.0 dbt-adapters>=1.2.1,<2.0 dbt-core~=1.8,<1.9 - oracledb==2.3.0 + oracledb==2.4.1 test_suite=tests test_requires = dbt-tests-adapter~=1.8,<1.9 diff --git a/setup.py b/setup.py index 31fed00..332cc03 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ "dbt-common>=1.1.0,<2.0", "dbt-adapters>=1.2.1,<2.0", "dbt-core~=1.8,<1.9", - "oracledb==2.3.0" + "oracledb==2.4.1" ] test_requirements = [ @@ -61,7 +61,7 @@ url = 'https://github.com/oracle/dbt-oracle' -VERSION = '1.8.1' +VERSION = '1.8.3' setup( author="Oracle", python_requires='>=3.8',