-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Update dbt-core and dbt-tests-adapter version to 1.6.0rc1 - Remove 'execute' method from TrinoConnectionManager, as implementation in SQLConnectionManager is sufficient, and new parameter was added there - Remove redundant addition of query comments in 'add_query' method, as it is handled in 'execute' method in SQLConnectionManager class - Revert "Fix tests for query comments." (commit a8309e9) - rename relation type 'materializedview' to 'materialized_view' - adjust hooks tests
- Loading branch information
1 parent
3327580
commit efddcb2
Showing
11 changed files
with
46 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kind: Breaking Changes | ||
body: Update dbt-core to 1.6.0rc1 | ||
time: 2023-07-21T12:58:06.169523+02:00 | ||
custom: | ||
Author: damian3031 | ||
Issue: "" | ||
PR: "332" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
kind: Breaking Changes | ||
body: Renamed relation type 'materializedview' to 'materialized_view' to be consistent | ||
with dbt-core 1.6. If you have any custom macro where you check if relation type | ||
equals to 'materializedview', change it to 'materialized_view' | ||
time: 2023-07-24T14:02:21.439344+02:00 | ||
custom: | ||
Author: damian3031 | ||
Issue: "" | ||
PR: "332" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
version = "1.5.1" | ||
version = "1.6.0rc1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,32 @@ | ||
import json | ||
|
||
import pytest | ||
from dbt.exceptions import DbtRuntimeError | ||
from dbt.tests.adapter.query_comment.test_query_comment import ( | ||
BaseDefaultQueryComments, | ||
BaseEmptyQueryComments, | ||
BaseMacroArgsQueryComments, | ||
BaseMacroInvalidQueryComments, | ||
BaseMacroQueryComments, | ||
BaseNullQueryComments, | ||
BaseQueryComments, | ||
) | ||
from dbt.tests.util import run_dbt_and_capture | ||
from dbt.version import __version__ as dbt_version | ||
|
||
|
||
# TODO: below tests could be simplified to just | ||
# pass statements, when tests in dbt.tests.adapter | ||
# will be fixed | ||
class BaseDefaultQueryCommentsTrino(BaseDefaultQueryComments): | ||
def run_get_json(self, expect_pass=True): | ||
res, raw_logs = run_dbt_and_capture( | ||
["--debug", "--log-format=json", "run"], expect_pass=expect_pass | ||
) | ||
|
||
# empty lists evaluate as False | ||
assert len(res) > 0 | ||
query = res[0].adapter_response["query"] | ||
return raw_logs, query | ||
|
||
|
||
class TestQueryCommentsTrino(BaseDefaultQueryCommentsTrino, BaseQueryComments): | ||
def test_matches_comment(self) -> bool: | ||
logs, query = self.run_get_json() | ||
assert r"/* dbt\nrules! */\n" in logs | ||
assert query.startswith("/* dbt\nrules! */\n") | ||
class TestQueryCommentsTrino(BaseQueryComments): | ||
pass | ||
|
||
|
||
class TestMacroQueryCommentsTrino(BaseDefaultQueryCommentsTrino, BaseMacroQueryComments): | ||
def test_matches_comment(self) -> bool: | ||
logs, query = self.run_get_json() | ||
assert r"/* dbt macros\nare pretty cool */\n" in logs | ||
assert query.startswith("/* dbt macros\nare pretty cool */\n") | ||
class TestMacroQueryCommentsTrino(BaseMacroQueryComments): | ||
pass | ||
|
||
|
||
class TestMacroArgsQueryCommentsTrino(BaseDefaultQueryCommentsTrino, BaseMacroArgsQueryComments): | ||
def test_matches_comment(self) -> bool: | ||
logs, query = self.run_get_json() | ||
expected_dct = { | ||
"app": "dbt++", | ||
"dbt_version": dbt_version, | ||
"macro_version": "0.1.0", | ||
"message": "blah: default", | ||
} | ||
expected = "/* {} */\n".format(json.dumps(expected_dct, sort_keys=True)) | ||
assert expected in query | ||
class TestMacroArgsQueryCommentsTrino(BaseMacroArgsQueryComments): | ||
pass | ||
|
||
|
||
class TestMacroInvalidQueryCommentsTrino(BaseMacroInvalidQueryComments): | ||
def test_run_assert_comments(self): | ||
with pytest.raises(DbtRuntimeError): | ||
self.run_get_json(expect_pass=False) | ||
pass | ||
|
||
|
||
class TestNullQueryCommentsTrino(BaseDefaultQueryCommentsTrino, BaseNullQueryComments): | ||
def test_matches_comment(self) -> bool: | ||
logs, query = self.run_get_json() | ||
assert "/*" not in logs or "*/" not in logs | ||
assert not query.startswith("/*") | ||
class TestNullQueryCommentsTrino(BaseNullQueryComments): | ||
pass | ||
|
||
|
||
class TestEmptyQueryCommentsTrino(BaseDefaultQueryCommentsTrino, BaseEmptyQueryComments): | ||
def test_matches_comment(self) -> bool: | ||
logs, query = self.run_get_json() | ||
assert "/*" not in logs or "*/" not in logs | ||
assert not query.startswith("/*") | ||
class TestEmptyQueryCommentsTrino(BaseEmptyQueryComments): | ||
pass |