Skip to content

Commit 409b58c

Browse files
committed
Added missing newline EOF and fixed caching test case
1 parent 368d548 commit 409b58c

File tree

6 files changed

+35
-6
lines changed

6 files changed

+35
-6
lines changed

dbt/adapters/oracle/impl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class OracleAdapter(SQLAdapter):
8888
ConstraintType.not_null: ConstraintSupport.ENFORCED,
8989
ConstraintType.unique: ConstraintSupport.ENFORCED,
9090
ConstraintType.primary_key: ConstraintSupport.ENFORCED,
91-
ConstraintType.foreign_key: ConstraintSupport.NOT_ENFORCED,
91+
ConstraintType.foreign_key: ConstraintSupport.ENFORCED,
9292
}
9393

9494
def debug_query(self) -> None:

tests/functional/adapter/constraints/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
See the License for the specific language governing permissions and
1515
limitations under the License.
16-
"""
16+
"""

tests/functional/adapter/constraints/fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,4 +289,4 @@
289289
data_type: char
290290
- name: date_day
291291
data_type: date
292-
"""
292+
"""

tests/functional/adapter/constraints/test_constraints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,4 +205,4 @@ def expected_sql(self):
205205
TO_DATE('2019-01-01', 'YYYY-MM-DD') as date_day
206206
from dual
207207
) model_subq
208-
"""
208+
"""

tests/functional/adapter/simple_seed/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
See the License for the specific language governing permissions and
1515
limitations under the License.
16-
"""
16+
"""

tests/functional/adapter/test_caching.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717
import pytest
1818

1919
from dbt.tests.adapter.caching.test_caching import (
20+
BaseCachingTest,
2021
BaseCachingLowercaseModel,
2122
BaseCachingUppercaseModel,
2223
BaseCachingSelectedSchemaOnly,
2324
)
25+
from dbt.tests.util import run_dbt
2426

2527
model_sql = """
2628
{{
@@ -42,7 +44,34 @@
4244
"""
4345

4446

45-
class TestCachingLowerCaseModel(BaseCachingLowercaseModel):
47+
class OracleBaseCaching(BaseCachingTest):
48+
49+
def run_and_inspect_cache(self, project, run_args=None):
50+
run_dbt(run_args)
51+
52+
# the cache was empty at the start of the run.
53+
# the model materialization returned an unquoted relation and added to the cache.
54+
adapter = project.adapter
55+
assert len(adapter.cache.relations) == 1
56+
relation = list(adapter.cache.relations).pop()
57+
# assert relation.schema == project.test_schema
58+
assert relation.schema == project.test_schema.lower()
59+
60+
# on the second run, dbt will find a relation in the database during cache population.
61+
# this relation will be quoted, because list_relations_without_caching (by default) uses
62+
# quote_policy = {"database": True, "schema": True, "identifier": True}
63+
# when adding relations to the cache.
64+
run_dbt(run_args)
65+
adapter = project.adapter
66+
assert len(adapter.cache.relations) == 1
67+
second_relation = list(adapter.cache.relations).pop()
68+
69+
# perform a case-insensitive + quote-insensitive comparison
70+
for key in ["database", "schema", "identifier"]:
71+
assert getattr(relation, key).lower() == getattr(second_relation, key).lower()
72+
73+
74+
class TestCachingLowerCaseModel(OracleBaseCaching):
4675

4776
@pytest.fixture(scope="class")
4877
def models(self):

0 commit comments

Comments
 (0)