-
Notifications
You must be signed in to change notification settings - Fork 36
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 bumpVersion
- Loading branch information
Showing
17 changed files
with
364 additions
and
78 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,6 @@ | ||
kind: Features | ||
body: Update RelationConfig to capture all fields used by adapters | ||
time: 2024-02-12T12:35:44.653555-08:00 | ||
custom: | ||
Author: colin-rogers-dbt | ||
Issue: "30" |
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: Fixes | ||
body: Ignore adapter-level support warnings for 'custom' constraints | ||
time: 2024-02-15T14:15:45.764145+01:00 | ||
custom: | ||
Author: jtcohen6 | ||
Issue: "90" |
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,40 @@ | ||
# **what?** | ||
# Checks that a file has been committed under the /.changes directory | ||
# as a new CHANGELOG entry. Cannot check for a specific filename as | ||
# it is dynamically generated by change type and timestamp. | ||
# This workflow runs on pull_request_target because it requires | ||
# secrets to post comments. | ||
|
||
# **why?** | ||
# Ensure code change gets reflected in the CHANGELOG. | ||
|
||
# **when?** | ||
# This will run for all PRs going into main. It will | ||
# run when they are opened, reopened, when any label is added or removed | ||
# and when new code is pushed to the branch. The action will get | ||
# skipped if the 'Skip Changelog' label is present is any of the labels. | ||
|
||
name: Check Changelog Entry | ||
|
||
on: | ||
pull_request_target: | ||
types: [opened, reopened, labeled, unlabeled, synchronize] | ||
paths-ignore: ['.changes/**', '.github/**', 'tests/**', 'third-party-stubs/**', '**.md', '**.yml'] | ||
|
||
workflow_dispatch: | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
jobs: | ||
changelog: | ||
uses: dbt-labs/actions/.github/workflows/changelog-existence.yml@main | ||
with: | ||
changelog_comment: 'Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see [the contributing guide](https://github.com/dbt-labs/dbt-adapters/blob/main/CONTRIBUTING.md#adding-changelog-entry).' | ||
skip_label: 'Skip Changelog' | ||
secrets: inherit |
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 = "0.1.0a6" | ||
version = "0.1.0a7" |
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,3 +1,3 @@ | ||
from pkgutil import extend_path | ||
|
||
__path__ = extend_path(__path__, __name__) | ||
__path__ = extend_path(__path__, __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
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{% macro cast(field, type) %} | ||
{{ return(adapter.dispatch('cast', 'dbt') (field, type)) }} | ||
{% endmacro %} | ||
|
||
{% macro default__cast(field, type) %} | ||
cast({{field}} as {{type}}) | ||
{% endmacro %} |
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,49 @@ | ||
import pytest | ||
from dbt.tests.util import run_dbt | ||
|
||
|
||
my_model_sql = """ | ||
select | ||
tested_column from {{ ref('my_upstream_model')}} | ||
""" | ||
|
||
my_upstream_model_sql = """ | ||
select 1 as tested_column | ||
""" | ||
|
||
test_my_model_yml = """ | ||
unit_tests: | ||
- name: test_my_model | ||
model: my_model | ||
given: | ||
- input: ref('my_upstream_model') | ||
rows: | ||
- {tested_column: 1} | ||
- {TESTED_COLUMN: 2} | ||
- {tested_colUmn: 3} | ||
expect: | ||
rows: | ||
- {tested_column: 1} | ||
- {TESTED_COLUMN: 2} | ||
- {tested_colUmn: 3} | ||
""" | ||
|
||
|
||
class BaseUnitTestCaseInsensivity: | ||
@pytest.fixture(scope="class") | ||
def models(self): | ||
return { | ||
"my_model.sql": my_model_sql, | ||
"my_upstream_model.sql": my_upstream_model_sql, | ||
"unit_tests.yml": test_my_model_yml, | ||
} | ||
|
||
def test_case_insensitivity(self, project): | ||
results = run_dbt(["run"]) | ||
assert len(results) == 2 | ||
|
||
results = run_dbt(["test"]) | ||
|
||
|
||
class TestPosgresUnitTestCaseInsensitivity(BaseUnitTestCaseInsensivity): | ||
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import pytest | ||
from dbt.tests.util import run_dbt, run_dbt_and_capture | ||
|
||
|
||
my_model_sql = """ | ||
select | ||
tested_column from {{ ref('my_upstream_model')}} | ||
""" | ||
|
||
my_upstream_model_sql = """ | ||
select 1 as tested_column | ||
""" | ||
|
||
test_my_model_yml = """ | ||
unit_tests: | ||
- name: test_invalid_input_column_name | ||
model: my_model | ||
given: | ||
- input: ref('my_upstream_model') | ||
rows: | ||
- {invalid_column_name: 1} | ||
expect: | ||
rows: | ||
- {tested_column: 1} | ||
- name: test_invalid_expect_column_name | ||
model: my_model | ||
given: | ||
- input: ref('my_upstream_model') | ||
rows: | ||
- {tested_column: 1} | ||
expect: | ||
rows: | ||
- {invalid_column_name: 1} | ||
""" | ||
|
||
|
||
class BaseUnitTestInvalidInput: | ||
@pytest.fixture(scope="class") | ||
def models(self): | ||
return { | ||
"my_model.sql": my_model_sql, | ||
"my_upstream_model.sql": my_upstream_model_sql, | ||
"unit_tests.yml": test_my_model_yml, | ||
} | ||
|
||
def test_invalid_input(self, project): | ||
results = run_dbt(["run"]) | ||
assert len(results) == 2 | ||
|
||
_, out = run_dbt_and_capture( | ||
["test", "--select", "test_name:test_invalid_input_column_name"], expect_pass=False | ||
) | ||
assert "Invalid column name: 'invalid_column_name' in unit test fixture for 'my_upstream_model'." in out | ||
|
||
_, out = run_dbt_and_capture( | ||
["test", "--select", "test_name:test_invalid_expect_column_name"], expect_pass=False | ||
) | ||
assert "Invalid column name: 'invalid_column_name' in unit test fixture for expected output." in out | ||
|
||
|
||
class TestPostgresUnitTestInvalidInput(BaseUnitTestInvalidInput): | ||
pass |
Oops, something went wrong.