Skip to content

Commit

Permalink
v1.8.2 changes
Browse files Browse the repository at this point in the history
- Fix #136
- Fix #153
- Upgrade Python driver to 2.4.1
  • Loading branch information
aosingh committed Sep 19, 2024
1 parent 66aebfa commit a61d27d
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 8 deletions.
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.8.1
VERSION=1.8.2
PROJ_DIR?=$(shell pwd)
VENV_DIR?=${PROJ_DIR}/.bldenv
BUILD_DIR=${PROJ_DIR}/build
Expand Down
19 changes: 18 additions & 1 deletion dbt/adapters/oracle/relation.py
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -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,
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions dbt/adapters/oracle/sample_profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}"
Expand Down
18 changes: 17 additions & 1 deletion dbt/include/oracle/macros/relations/drop.sql
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
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.8.1,<2.0
oracledb==2.3.0
oracledb==2.4.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.8.1
version = 1.8.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 @@ -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
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.8,<1.9",
"oracledb==2.3.0"
"oracledb==2.4.1"
]

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

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

VERSION = '1.8.1'
VERSION = '1.8.2'
setup(
author="Oracle",
python_requires='>=3.8',
Expand Down

0 comments on commit a61d27d

Please sign in to comment.