From 5cfd48768d756099da120cb9d85e9b5fda18a9af Mon Sep 17 00:00:00 2001 From: Damian Owsianny Date: Fri, 13 Oct 2023 11:28:29 +0200 Subject: [PATCH] Update dbt-core to 1.7.0rc1 --- .../unreleased/Breaking Changes-20231013-160933.yaml | 7 +++++++ dbt/adapters/trino/__version__.py | 2 +- dbt/adapters/trino/relation.py | 9 +-------- dbt/include/trino/macros/adapters.sql | 4 +--- dev_requirements.txt | 2 +- tests/functional/adapter/constraints/test_constraints.py | 6 +++--- tests/unit/utils.py | 3 ++- 7 files changed, 16 insertions(+), 17 deletions(-) create mode 100644 .changes/unreleased/Breaking Changes-20231013-160933.yaml diff --git a/.changes/unreleased/Breaking Changes-20231013-160933.yaml b/.changes/unreleased/Breaking Changes-20231013-160933.yaml new file mode 100644 index 00000000..0456e30d --- /dev/null +++ b/.changes/unreleased/Breaking Changes-20231013-160933.yaml @@ -0,0 +1,7 @@ +kind: Breaking Changes +body: Update dbt-core to 1.7.0rc1 +time: 2023-10-13T16:09:33.989035+02:00 +custom: + Author: damian3031 + Issue: "361" + PR: "363" diff --git a/dbt/adapters/trino/__version__.py b/dbt/adapters/trino/__version__.py index a9851426..748f8f4e 100644 --- a/dbt/adapters/trino/__version__.py +++ b/dbt/adapters/trino/__version__.py @@ -1 +1 @@ -version = "1.6.2" +version = "1.7.0rc1" diff --git a/dbt/adapters/trino/relation.py b/dbt/adapters/trino/relation.py index 6a8fdb84..3c322417 100644 --- a/dbt/adapters/trino/relation.py +++ b/dbt/adapters/trino/relation.py @@ -4,16 +4,9 @@ from dbt.contracts.relation import ComponentName -@dataclass -class TrinoQuotePolicy(Policy): - database: bool = False - schema: bool = False - identifier: bool = False - - @dataclass(frozen=True, eq=False, repr=False) class TrinoRelation(BaseRelation): - quote_policy: TrinoQuotePolicy = field(default_factory=lambda: TrinoQuotePolicy()) + quote_policy: Policy = field(default_factory=lambda: Policy()) # Overridden as Trino converts relation identifiers to lowercase def _is_exactish_match(self, field: ComponentName, value: str) -> bool: diff --git a/dbt/include/trino/macros/adapters.sql b/dbt/include/trino/macros/adapters.sql index 24bf37c8..fe7f3a35 100644 --- a/dbt/include/trino/macros/adapters.sql +++ b/dbt/include/trino/macros/adapters.sql @@ -153,11 +153,9 @@ {% endmacro %} -{% macro trino__drop_relation(relation) -%} +{%- macro trino__get_drop_sql(relation) -%} {% set relation_type = relation.type|replace("_", " ") %} - {% call statement('drop_relation', auto_begin=False) -%} drop {{ relation_type }} if exists {{ relation }} - {%- endcall %} {% endmacro %} diff --git a/dev_requirements.txt b/dev_requirements.txt index ca62e6b6..4eb2d4f5 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,4 +1,4 @@ -dbt-tests-adapter~=1.6.5 +dbt-tests-adapter~=1.7.0rc1 mypy==1.5.1 # patch updates have historically introduced breaking changes pre-commit~=3.4 pytest~=7.4 diff --git a/tests/functional/adapter/constraints/test_constraints.py b/tests/functional/adapter/constraints/test_constraints.py index d6326c8b..0e432940 100644 --- a/tests/functional/adapter/constraints/test_constraints.py +++ b/tests/functional/adapter/constraints/test_constraints.py @@ -35,7 +35,7 @@ _expected_sql_trino = """ create table ( - "id" integer not null, + "id" int not null, color varchar, date_day varchar ) ; @@ -206,7 +206,7 @@ def models(self): def expected_sql(self): return """ create table ( - "id" integer not null, + "id" int not null, color varchar, date_day varchar ) ; @@ -240,7 +240,7 @@ def models(self): def expected_sql(self): return """ create table ( - id integer not null, + id int not null, "from" varchar not null, date_day varchar ) ; diff --git a/tests/unit/utils.py b/tests/unit/utils.py index 1778de1b..6bb17e16 100644 --- a/tests/unit/utils.py +++ b/tests/unit/utils.py @@ -7,7 +7,7 @@ from unittest import TestCase, mock from dbt.config.project import PartialProject -from hologram import ValidationError +from dbt.dataclass_schema import ValidationError def normalize(path): @@ -156,6 +156,7 @@ def assert_fails_validation(self, dct, cls=None): cls = self.ContractType with self.assertRaises(ValidationError): + cls.validate(dct) cls.from_dict(dct)