Skip to content

Commit

Permalink
Added missing newline EOF and fixed caching test case
Browse files Browse the repository at this point in the history
  • Loading branch information
aosingh committed May 9, 2023
1 parent 368d548 commit 409b58c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dbt/adapters/oracle/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class OracleAdapter(SQLAdapter):
ConstraintType.not_null: ConstraintSupport.ENFORCED,
ConstraintType.unique: ConstraintSupport.ENFORCED,
ConstraintType.primary_key: ConstraintSupport.ENFORCED,
ConstraintType.foreign_key: ConstraintSupport.NOT_ENFORCED,
ConstraintType.foreign_key: ConstraintSupport.ENFORCED,
}

def debug_query(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/adapter/constraints/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
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.
"""
"""
2 changes: 1 addition & 1 deletion tests/functional/adapter/constraints/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,4 +289,4 @@
data_type: char
- name: date_day
data_type: date
"""
"""
2 changes: 1 addition & 1 deletion tests/functional/adapter/constraints/test_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,4 @@ def expected_sql(self):
TO_DATE('2019-01-01', 'YYYY-MM-DD') as date_day
from dual
) model_subq
"""
"""
2 changes: 1 addition & 1 deletion tests/functional/adapter/simple_seed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
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.
"""
"""
31 changes: 30 additions & 1 deletion tests/functional/adapter/test_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
import pytest

from dbt.tests.adapter.caching.test_caching import (
BaseCachingTest,
BaseCachingLowercaseModel,
BaseCachingUppercaseModel,
BaseCachingSelectedSchemaOnly,
)
from dbt.tests.util import run_dbt

model_sql = """
{{
Expand All @@ -42,7 +44,34 @@
"""


class TestCachingLowerCaseModel(BaseCachingLowercaseModel):
class OracleBaseCaching(BaseCachingTest):

def run_and_inspect_cache(self, project, run_args=None):
run_dbt(run_args)

# the cache was empty at the start of the run.
# the model materialization returned an unquoted relation and added to the cache.
adapter = project.adapter
assert len(adapter.cache.relations) == 1
relation = list(adapter.cache.relations).pop()
# assert relation.schema == project.test_schema
assert relation.schema == project.test_schema.lower()

# on the second run, dbt will find a relation in the database during cache population.
# this relation will be quoted, because list_relations_without_caching (by default) uses
# quote_policy = {"database": True, "schema": True, "identifier": True}
# when adding relations to the cache.
run_dbt(run_args)
adapter = project.adapter
assert len(adapter.cache.relations) == 1
second_relation = list(adapter.cache.relations).pop()

# perform a case-insensitive + quote-insensitive comparison
for key in ["database", "schema", "identifier"]:
assert getattr(relation, key).lower() == getattr(second_relation, key).lower()


class TestCachingLowerCaseModel(OracleBaseCaching):

@pytest.fixture(scope="class")
def models(self):
Expand Down

0 comments on commit 409b58c

Please sign in to comment.