-
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.
- Loading branch information
Showing
36 changed files
with
789 additions
and
73 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 @@ | ||
## dbt-adapters 1.10.0 - September 12, 2024 |
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.10.1 - September 16, 2024 |
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,13 @@ | ||
## dbt-adapters 1.4.1 - August 09, 2024 | ||
|
||
### Fixes | ||
|
||
- Use model alias for the CTE identifier generated during ephemeral materialization ([#5273](https://github.com/dbt-labs/dbt-adapters/issues/5273)) | ||
|
||
### Under the Hood | ||
|
||
- Updating changie.yaml to add contributors and PR links ([#219](https://github.com/dbt-labs/dbt-adapters/issues/219)) | ||
|
||
### Contributors | ||
- [@jeancochrane](https://github.com/jeancochrane) ([#5273](https://github.com/dbt-labs/dbt-adapters/issues/5273)) | ||
- [@leahwicz](https://github.com/leahwicz) ([#219](https://github.com/dbt-labs/dbt-adapters/issues/219)) |
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,11 @@ | ||
## dbt-adapters 1.5.0 - September 10, 2024 | ||
|
||
### Features | ||
|
||
- Compare 'snapshot_get_time' and snapshot 'updated_at' data types ([#242](https://github.com/dbt-labs/dbt-adapters/issues/242)) | ||
- Add Behavior Flag framework ([#281](https://github.com/dbt-labs/dbt-adapters/issues/281)) | ||
- Add EventTimeFilter to BaseRelation, which renders a filtered relation when start or end is set ([#294](https://github.com/dbt-labs/dbt-adapters/issues/294)) | ||
|
||
### Dependencies | ||
|
||
- Update dbt-common pin to >=1.8 ([#299](https://github.com/dbt-labs/dbt-adapters/pull/299)) |
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,5 @@ | ||
## dbt-adapters 1.6.0 - September 12, 2024 | ||
|
||
### Features | ||
|
||
- Default microbatch strategy implementation and base tests ([#302](https://github.com/dbt-labs/dbt-adapters/issues/302)) |
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.6.1 - September 16, 2024 |
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,5 @@ | ||
## dbt-adapters 1.7.0 - September 19, 2024 | ||
|
||
### Features | ||
|
||
- Allow configuring of snapshot column names ([#289](https://github.com/dbt-labs/dbt-adapters/issues/289)) |
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,7 @@ | ||
kind: Under the Hood | ||
body: 'dbt-tests-adapters: Add required begin to microbatch model config to BaseMicrobatch | ||
test' | ||
time: 2024-09-23T18:47:19.171618+01:00 | ||
custom: | ||
Author: michelleark | ||
Issue: "315" |
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,22 @@ | ||
name: "Run pre-commit autoupdate" | ||
|
||
on: | ||
schedule: | ||
- cron: "30 1 * * SAT" | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.sha }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
precommit-autoupdate: | ||
name: "Run pre-commit autoupdate" | ||
uses: dbt-labs/actions/.github/workflows/pre-commit-autoupdate.yml | ||
secrets: | ||
TOKEN: ${{ secrets.FISHTOWN_BOT_PAT }} | ||
SLACK_WEBHOOK_PR_URL: ${{ secrets.SLACK_DEV_ADAPTER_PULL_REQUESTS }} | ||
SLACK_WEBHOOK_ALERTS_URL: ${{ secrets.SLACK_DEV_ADAPTER_ALERTS }} |
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 +1 @@ | ||
version = "1.9.2" | ||
version = "1.10.1" |
96 changes: 96 additions & 0 deletions
96
dbt-tests-adapter/dbt/tests/adapter/incremental/test_incremental_microbatch.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,96 @@ | ||
import os | ||
from pprint import pformat | ||
from unittest import mock | ||
|
||
import pytest | ||
|
||
from dbt.tests.util import relation_from_name, run_dbt | ||
|
||
try: | ||
# patch_microbatch_end_time introduced in dbt 1.9.0 | ||
from dbt.tests.util import patch_microbatch_end_time | ||
except ImportError: | ||
from freezegun import freeze_time as patch_microbatch_end_time | ||
|
||
_input_model_sql = """ | ||
{{ config(materialized='table', event_time='event_time') }} | ||
select 1 as id, TIMESTAMP '2020-01-01 00:00:00-0' as event_time | ||
union all | ||
select 2 as id, TIMESTAMP '2020-01-02 00:00:00-0' as event_time | ||
union all | ||
select 3 as id, TIMESTAMP '2020-01-03 00:00:00-0' as event_time | ||
""" | ||
|
||
_microbatch_model_sql = """ | ||
{{ config(materialized='incremental', incremental_strategy='microbatch', unique_key='id', event_time='event_time', batch_size='day', begin=modules.datetime.datetime(2020, 1, 1, 0, 0, 0)) }} | ||
select * from {{ ref('input_model') }} | ||
""" | ||
|
||
|
||
class BaseMicrobatch: | ||
@pytest.fixture(scope="class") | ||
def microbatch_model_sql(self) -> str: | ||
""" | ||
This is the SQL that defines the microbatch model, including any {{ config(..) }} | ||
""" | ||
return _microbatch_model_sql | ||
|
||
@pytest.fixture(scope="class") | ||
def input_model_sql(self) -> str: | ||
""" | ||
This is the SQL that defines the input model to the microbatch model, including any {{ config(..) }}. | ||
event_time is a required configuration of this input | ||
""" | ||
return _input_model_sql | ||
|
||
@pytest.fixture(scope="class") | ||
def insert_two_rows_sql(self, project) -> str: | ||
test_schema_relation = project.adapter.Relation.create( | ||
database=project.database, schema=project.test_schema | ||
) | ||
return f"insert into {test_schema_relation}.input_model (id, event_time) values (4, TIMESTAMP '2020-01-04 00:00:00-0'), (5, TIMESTAMP '2020-01-05 00:00:00-0')" | ||
|
||
@pytest.fixture(scope="class") | ||
def models(self, microbatch_model_sql, input_model_sql): | ||
return { | ||
"input_model.sql": input_model_sql, | ||
"microbatch_model.sql": microbatch_model_sql, | ||
} | ||
|
||
def assert_row_count(self, project, relation_name: str, expected_row_count: int): | ||
relation = relation_from_name(project.adapter, relation_name) | ||
result = project.run_sql(f"select * from {relation}", fetch="all") | ||
|
||
assert len(result) == expected_row_count, f"{relation_name}:{pformat(result)}" | ||
|
||
@mock.patch.dict(os.environ, {"DBT_EXPERIMENTAL_MICROBATCH": "True"}) | ||
def test_run_with_event_time(self, project, insert_two_rows_sql): | ||
# initial run -- backfills all data | ||
with patch_microbatch_end_time("2020-01-03 13:57:00"): | ||
run_dbt(["run"]) | ||
self.assert_row_count(project, "microbatch_model", 3) | ||
|
||
# our partition grain is "day" so running the same day without new data should produce the same results | ||
with patch_microbatch_end_time("2020-01-03 14:57:00"): | ||
run_dbt(["run"]) | ||
self.assert_row_count(project, "microbatch_model", 3) | ||
|
||
# add next two days of data | ||
project.run_sql(insert_two_rows_sql) | ||
|
||
self.assert_row_count(project, "input_model", 5) | ||
|
||
# re-run without changing current time => no insert | ||
with patch_microbatch_end_time("2020-01-03 14:57:00"): | ||
run_dbt(["run", "--select", "microbatch_model"]) | ||
self.assert_row_count(project, "microbatch_model", 3) | ||
|
||
# re-run by advancing time by one day changing current time => insert 1 row | ||
with patch_microbatch_end_time("2020-01-04 14:57:00"): | ||
run_dbt(["run", "--select", "microbatch_model"]) | ||
self.assert_row_count(project, "microbatch_model", 4) | ||
|
||
# re-run by advancing time by one more day changing current time => insert 1 more row | ||
with patch_microbatch_end_time("2020-01-05 14:57:00"): | ||
run_dbt(["run", "--select", "microbatch_model"]) | ||
self.assert_row_count(project, "microbatch_model", 5) |
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 +1 @@ | ||
version = "1.4.0" | ||
version = "1.7.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
Oops, something went wrong.