Skip to content

Commit

Permalink
Merge branch 'main' into update-incremental-merge-for-nullable-fields
Browse files Browse the repository at this point in the history
  • Loading branch information
dbeatty10 authored Nov 4, 2024
2 parents 781bc89 + b12c987 commit 265cbfc
Show file tree
Hide file tree
Showing 50 changed files with 1,159 additions and 120 deletions.
1 change: 1 addition & 0 deletions .changes/1.10.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## dbt-adapters 1.10.0 - September 12, 2024
1 change: 1 addition & 0 deletions .changes/1.10.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## dbt-adapters 1.10.1 - September 16, 2024
5 changes: 5 additions & 0 deletions .changes/1.10.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## dbt-adapters 1.10.2 - October 01, 2024

### Under the Hood

- dbt-tests-adapters: Add required begin to microbatch model config to BaseMicrobatch test ([#315](https://github.com/dbt-labs/dbt-adapters/issues/315))
1 change: 1 addition & 0 deletions .changes/1.10.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## dbt-adapters 1.10.3 - October 29, 2024
13 changes: 13 additions & 0 deletions .changes/1.4.1.md
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))
11 changes: 11 additions & 0 deletions .changes/1.5.0.md
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))
5 changes: 5 additions & 0 deletions .changes/1.6.0.md
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))
1 change: 1 addition & 0 deletions .changes/1.6.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## dbt-adapters 1.6.1 - September 16, 2024
5 changes: 5 additions & 0 deletions .changes/1.7.0.md
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))
5 changes: 5 additions & 0 deletions .changes/1.7.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## dbt-adapters 1.7.1 - October 15, 2024

### Features

- Enable setting current value of dbt_valid_to ([#320](https://github.com/dbt-labs/dbt-adapters/issues/320))
16 changes: 16 additions & 0 deletions .changes/1.7.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## dbt-adapters 1.7.2 - October 21, 2024

### Breaking Changes

- Drop support for Python 3.8 ([#332](https://github.com/dbt-labs/dbt-adapters/issues/332))

### Features

- Allows unique_key for snapshots to take a list ([#181](https://github.com/dbt-labs/dbt-adapters/issues/181))

### Fixes

- Always validate an incremental model's `incremental_strategy` ([#330](https://github.com/dbt-labs/dbt-adapters/issues/330))

### Contributors
- [@agpapa](https://github.com/agpapa) ([#181](https://github.com/dbt-labs/dbt-adapters/issues/181))
9 changes: 9 additions & 0 deletions .changes/1.8.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## dbt-adapters 1.8.0 - October 29, 2024

### Fixes

- Always make behavior flags available for evaluation ([#338](https://github.com/dbt-labs/dbt-adapters/issues/338))

### Under the Hood

- Add adapter telemetry. ([#301](https://github.com/dbt-labs/dbt-adapters/issues/301))
6 changes: 0 additions & 6 deletions .changes/unreleased/Fixes-20240610-195300.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions .changes/unreleased/Under the Hood-20240801-220551.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/actions/publish-results/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
description: File type for file name stub (e.g. "unit-tests")
required: true
python-version:
description: Python version for the file name stub (e.g. "3.8")
description: Python version for the file name stub (e.g. "3.9")
required: true
source-file:
description: File to be uploaded
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/precommit-autoupdate.yml
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 }}
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- name: Check out repository
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,30 @@ repos:
- id: dbt-core-in-adapters-check

- repo: https://github.com/psf/black
rev: 24.4.0
rev: 24.8.0
hooks:
- id: black
args:
- --line-length=99
- --target-version=py38
- --target-version=py39
- --target-version=py310
- --target-version=py311
- --target-version=py312
- --force-exclude=dbt/adapters/events/adapter_types_pb2.py

- repo: https://github.com/pycqa/flake8
rev: 7.0.0
rev: 7.1.1
hooks:
- id: flake8
exclude: dbt/adapters/events/adapter_types_pb2.py|tests/functional/
args:
- --max-line-length=99
- --select=E,F,W
- --ignore=E203,E501,E704,E741,W503,W504
- --per-file-ignores=*/__init__.py:F401
- --per-file-ignores=*/__init__.py:F401,*/conftest.py:F401

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
rev: v1.11.2
hooks:
- id: mypy
exclude: dbt/adapters/events/adapter_types_pb2.py|dbt-tests-adapter/dbt/__init__.py
Expand Down
87 changes: 87 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,93 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).

## dbt-adapters 1.10.3 - October 29, 2024



## dbt-adapters 1.10.2 - October 01, 2024

### Under the Hood

- dbt-tests-adapters: Add required begin to microbatch model config to BaseMicrobatch test ([#315](https://github.com/dbt-labs/dbt-adapters/issues/315))

## dbt-adapters 1.10.1 - September 16, 2024

## dbt-adapters 1.10.0 - September 12, 2024

## dbt-adapters 1.8.0 - October 29, 2024

### Fixes

- Always make behavior flags available for evaluation ([#338](https://github.com/dbt-labs/dbt-adapters/issues/338))

### Under the Hood

- Add adapter telemetry. ([#301](https://github.com/dbt-labs/dbt-adapters/issues/301))

## dbt-adapters 1.7.2 - October 21, 2024

### Breaking Changes

- Drop support for Python 3.8 ([#332](https://github.com/dbt-labs/dbt-adapters/issues/332))

### Features

- Allows unique_key for snapshots to take a list ([#181](https://github.com/dbt-labs/dbt-adapters/issues/181))

### Fixes

- Always validate an incremental model's `incremental_strategy` ([#330](https://github.com/dbt-labs/dbt-adapters/issues/330))

### Contributors
- [@agpapa](https://github.com/agpapa) ([#181](https://github.com/dbt-labs/dbt-adapters/issues/181))

## dbt-adapters 1.7.1 - October 15, 2024

### Features

- Enable setting current value of dbt_valid_to ([#320](https://github.com/dbt-labs/dbt-adapters/issues/320))

## 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))

## dbt-adapters 1.6.1 - September 16, 2024

## 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))

## 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))

## 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))

## dbt-adapters 1.4.0 - July 30, 2024

### Features
Expand Down
2 changes: 1 addition & 1 deletion dbt-tests-adapter/dbt/tests/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "1.9.2"
version = "1.10.3"
7 changes: 7 additions & 0 deletions dbt-tests-adapter/dbt/tests/adapter/basic/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@
{{ config(materialized="incremental") }}
"""

config_materialized_incremental_invalid_strategy = """
{{ config(materialized="incremental", incremental_strategy="bad_strategy") }}
"""

config_materialized_var = """
{{ config(materialized=var("materialized_var", "table"))}}
"""
Expand Down Expand Up @@ -217,3 +221,6 @@
ephemeral_view_sql = config_materialized_view + model_ephemeral
ephemeral_table_sql = config_materialized_table + model_ephemeral
incremental_sql = config_materialized_incremental + model_incremental
incremental_invalid_strategy_sql = (
config_materialized_incremental_invalid_strategy + model_incremental
)
39 changes: 39 additions & 0 deletions dbt-tests-adapter/dbt/tests/adapter/basic/test_incremental.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,45 @@ def test_incremental_not_schema_change(self, project):
assert run_result == RunStatus.Success


class BaseIncrementalBadStrategy:
@pytest.fixture(scope="class")
def project_config_update(self):
return {"name": "incremental"}

@pytest.fixture(scope="class")
def models(self):
return {
"incremental.sql": files.incremental_invalid_strategy_sql,
"schema.yml": files.schema_base_yml,
}

@pytest.fixture(scope="class")
def seeds(self):
return {"base.csv": files.seeds_base_csv, "added.csv": files.seeds_added_csv}

@pytest.fixture(autouse=True)
def clean_up(self, project):
yield
with project.adapter.connection_named("__test"):
relation = project.adapter.Relation.create(
database=project.database, schema=project.test_schema
)
project.adapter.drop_schema(relation)

def test_incremental_invalid_strategy(self, project):
# seed command
results = run_dbt(["seed"])
assert len(results) == 2

# try to run the incremental model, it should fail on the first attempt
results = run_dbt(["run"], expect_pass=False)
assert len(results.results) == 1
assert (
'dbt could not find an incremental strategy macro with the name "get_incremental_bad_strategy_sql"'
in results.results[0].message
)


class Testincremental(BaseIncremental):
pass

Expand Down
8 changes: 5 additions & 3 deletions dbt-tests-adapter/dbt/tests/adapter/hooks/test_run_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import pytest

from dbt_common.exceptions import DbtDatabaseError
from dbt.tests.adapter.hooks import fixtures
from dbt.tests.util import check_table_does_not_exist, run_dbt

Expand All @@ -11,8 +12,8 @@ class BasePrePostRunHooks:
@pytest.fixture(scope="function")
def setUp(self, project):
project.run_sql_file(project.test_data_dir / Path("seed_run.sql"))
project.run_sql(f"drop table if exists { project.test_schema }.schemas")
project.run_sql(f"drop table if exists { project.test_schema }.db_schemas")
project.run_sql(f"drop table if exists {project.test_schema}.schemas")
project.run_sql(f"drop table if exists {project.test_schema}.db_schemas")
os.environ["TERM_TEST"] = "TESTING"

@pytest.fixture(scope="class")
Expand Down Expand Up @@ -158,7 +159,8 @@ def project_config_update(self):
}

def test_missing_column_pre_hook(self, project):
run_dbt(["run"], expect_pass=False)
with pytest.raises(DbtDatabaseError):
run_dbt(["run"], expect_pass=False)


class TestAfterRunHooks(BaseAfterRunHooks):
Expand Down
Loading

0 comments on commit 265cbfc

Please sign in to comment.