Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix --store-failures #233

Merged
merged 5 commits into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
## dbt-spark 0.21.0 (Release TBD)
## dbt-spark 0.21.1 (Release TBD)

### Fixes
- Fix `--store-failures` for tests, by suppressing irrelevant error in `comment_clause()` macro ([#232](https://github.com/dbt-labs/dbt-spark/issues/232), [#233](https://github.com/dbt-labs/dbt-spark/pull/233))

## dbt-spark 0.21.0 (October 4, 2021)

### Fixes
- Enhanced get_columns_in_relation method to handle a bug in open source deltalake which doesnt return schema details in `show table extended in databasename like '*'` query output. This impacts dbt snapshots if file format is open source deltalake ([#207](https://github.com/dbt-labs/dbt-spark/pull/207))
Expand Down
2 changes: 1 addition & 1 deletion dbt/include/spark/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
{%- if raw_relation -%}
comment '{{ model.description | replace("'", "\\'") }}'
{% endif %}
{%- else -%}
{%- elif raw_persist_docs -%}
{{ exceptions.raise_compiler_error("Invalid value provided for 'persist_docs'. Expected dict but got value: " ~ raw_persist_docs) }}
{% endif %}
{%- endmacro -%}
Expand Down
9 changes: 9 additions & 0 deletions test/custom/store_failures/models/schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2

models:
- name: view_model
columns:
- name: id
tests:
- unique
- not_null
5 changes: 5 additions & 0 deletions test/custom/store_failures/models/view_model.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
select 1 as id
union all
select 1 as id
union all
select null as id
51 changes: 51 additions & 0 deletions test/custom/store_failures/test_store_failures.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from test.custom.base import DBTSparkIntegrationTest, use_profile

class TestStoreFailures(DBTSparkIntegrationTest):
@property
def schema(self):
return "store_failures"

@property
def models(self):
return "models"

@property
def project_config(self):
return {
'config-version': 2,
'tests': {
'+store_failures': True,
'+severity': 'warn',
}
}

def test_store_failures(self):
self.run_dbt(['run'])
results = self.run_dbt(['test', '--store-failures'], strict = False)

class TestStoreFailuresApacheSpark(TestStoreFailures):

@use_profile("apache_spark")
def test_store_failures_apache_spark(self):
self.test_store_failures()

class TestStoreFailuresDelta(TestStoreFailures):

@property
def project_config(self):
return {
'config-version': 2,
'tests': {
'+store_failures': True,
'+severity': 'warn',
'+file_format': 'delta',
sungchun12 marked this conversation as resolved.
Show resolved Hide resolved
}
}

@use_profile("databricks_cluster")
def test_store_failures_databricks_cluster(self):
self.test_store_failures()

@use_profile("databricks_sql_endpoint")
def test_store_failures_databricks_sql_endpoint(self):
self.test_store_failures()