-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix_null_equality_110
- Loading branch information
Showing
14 changed files
with
412 additions
and
59 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,10 @@ | ||
## dbt-adapters 1.11.0 - December 17, 2024 | ||
|
||
### Features | ||
|
||
- Add new hard_deletes="new_record" mode for snapshots. ([#317](https://github.com/dbt-labs/dbt-adapters/issues/317)) | ||
- Introduce new Capability for MicrobatchConcurrency support ([#359](https://github.com/dbt-labs/dbt-adapters/issues/359)) | ||
|
||
### Under the Hood | ||
|
||
- Add retry logic for retryable exceptions. ([#368](https://github.com/dbt-labs/dbt-adapters/issues/368)) |
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 @@ | ||
## dbt-adapters 1.12.0 - December 18, 2024 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
kind: Features | ||
body: Add function to run custom sql for getting freshness info | ||
time: 2024-12-16T17:20:47.065611-08:00 | ||
custom: | ||
Author: ChenyuLInx | ||
Issue: "8797" |
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 |
---|---|---|
|
@@ -198,6 +198,9 @@ jobs: | |
if: ${{ needs.temp-branch.outputs.name != '' && inputs.merge }} | ||
runs-on: ${{ vars.DEFAULT_RUNNER }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.temp-branch.outputs.name }} | ||
- uses: everlytic/[email protected] | ||
with: | ||
source_ref: ${{ needs.temp-branch.outputs.name }} | ||
|
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
70 changes: 70 additions & 0 deletions
70
dbt-tests-adapter/dbt/tests/adapter/utils/test_source_freshness_custom_info.py
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,70 @@ | ||
from typing import Type | ||
from unittest.mock import MagicMock | ||
|
||
from dbt_common.exceptions import DbtRuntimeError | ||
import pytest | ||
|
||
from dbt.adapters.base.impl import BaseAdapter | ||
|
||
|
||
class BaseCalculateFreshnessMethod: | ||
"""Tests the behavior of the calculate_freshness_from_customsql method for the relevant adapters. | ||
The base method is meant to throw the appropriate custom exception when calculate_freshness_from_customsql | ||
fails. | ||
""" | ||
|
||
@pytest.fixture(scope="class") | ||
def valid_sql(self) -> str: | ||
"""Returns a valid statement for issuing as a validate_sql query. | ||
Ideally this would be checkable for non-execution. For example, we could use a | ||
CREATE TABLE statement with an assertion that no table was created. However, | ||
for most adapter types this is unnecessary - the EXPLAIN keyword has exactly the | ||
behavior we want, and here we are essentially testing to make sure it is | ||
supported. As such, we return a simple SELECT query, and leave it to | ||
engine-specific test overrides to specify more detailed behavior as appropriate. | ||
""" | ||
|
||
return "select now()" | ||
|
||
@pytest.fixture(scope="class") | ||
def invalid_sql(self) -> str: | ||
"""Returns an invalid statement for issuing a bad validate_sql query.""" | ||
|
||
return "Let's run some invalid SQL and see if we get an error!" | ||
|
||
@pytest.fixture(scope="class") | ||
def expected_exception(self) -> Type[Exception]: | ||
"""Returns the Exception type thrown by a failed query. | ||
Defaults to dbt_common.exceptions.DbtRuntimeError because that is the most common | ||
base exception for adapters to throw.""" | ||
return DbtRuntimeError | ||
|
||
@pytest.fixture(scope="class") | ||
def mock_relation(self): | ||
mock = MagicMock() | ||
mock.__str__ = lambda x: "test.table" | ||
return mock | ||
|
||
def test_calculate_freshness_from_custom_sql_success( | ||
self, adapter: BaseAdapter, valid_sql: str, mock_relation | ||
) -> None: | ||
with adapter.connection_named("test_freshness_custom_sql"): | ||
adapter.calculate_freshness_from_custom_sql(mock_relation, valid_sql) | ||
|
||
def test_calculate_freshness_from_custom_sql_failure( | ||
self, | ||
adapter: BaseAdapter, | ||
invalid_sql: str, | ||
expected_exception: Type[Exception], | ||
mock_relation, | ||
) -> None: | ||
with pytest.raises(expected_exception=expected_exception): | ||
with adapter.connection_named("test_infreshness_custom_sql"): | ||
adapter.calculate_freshness_from_custom_sql(mock_relation, invalid_sql) | ||
|
||
|
||
class TestCalculateFreshnessMethod(BaseCalculateFreshnessMethod): | ||
pass |
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.10.4" | ||
version = "1.12.0" |
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
Oops, something went wrong.