Skip to content

Commit

Permalink
Fix --store-failures (#233)
Browse files Browse the repository at this point in the history
* Fix --store-failures

* Add chnagelog entry

* Maybe this?

* Fix indentation

* Class inheritance, silly
  • Loading branch information
jtcohen6 committed Oct 18, 2021
1 parent 143c39a commit 544feee
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 2 deletions.
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',
}
}

@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()

0 comments on commit 544feee

Please sign in to comment.