Skip to content

Commit

Permalink
(#1728) exclude ephemeral models from freshness task
Browse files Browse the repository at this point in the history
  • Loading branch information
drewbanin committed Sep 10, 2019
1 parent 23bfc67 commit 689a0ea
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
4 changes: 4 additions & 0 deletions core/dbt/contracts/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ def __init__(self, node, max_loaded_at, snapshotted_at,
def failed(self):
return self.status == 'error'

@property
def warned(self):
return self.status == 'warn'

@property
def skipped(self):
return False
Expand Down
1 change: 1 addition & 0 deletions core/dbt/task/freshness.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def build_query(self):
"resource_types": [NodeType.Source],
"tags": [],
"required": ['has_freshness'],
"addin_ephemeral_nodes": False,
}

def get_runner_type(self):
Expand Down
9 changes: 7 additions & 2 deletions core/dbt/ui/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,13 @@ def print_run_result_error(result, newline=True, is_warning=False):
result.node.get('resource_type'),
result.node.get('name'),
result.node.get('original_file_path')))
status = dbt.utils.pluralize(result.status, 'result')
logger.info(" Got {}, expected 0.".format(status))

try:
int(result.status)
status = dbt.utils.pluralize(result.status, 'result')
logger.info(" Got {}, expected 0.".format(status))
except ValueError:
logger.info(" Status: {}".format(result.status))

if result.node.get('build_path') is not None:
logger.info("")
Expand Down
4 changes: 4 additions & 0 deletions test/integration/042_sources_test/models/view_model.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

-- See here: https://github.com/fishtown-analytics/dbt/pull/1729

select * from {{ ref('ephemeral_model') }}
2 changes: 1 addition & 1 deletion test/integration/042_sources_test/test_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def run_dbt_with_vars(self, cmd, *args, **kwargs):
@use_profile('postgres')
def test_postgres_basic_source_def(self):
results = self.run_dbt_with_vars(['run'])
self.assertEqual(len(results), 3)
self.assertEqual(len(results), 4)
self.assertManyTablesEqual(
['source', 'descendant_model', 'nonsource_descendant'],
['expected_multi_source', 'multi_source_model'])
Expand Down

0 comments on commit 689a0ea

Please sign in to comment.