diff --git a/dbt/node_runners.py b/dbt/node_runners.py index d77156d6438..1cba11d2a6d 100644 --- a/dbt/node_runners.py +++ b/dbt/node_runners.py @@ -253,10 +253,18 @@ def run_hooks(cls, project, adapter, flat_graph, hook_type): auto_begin=True) adapter.commit_if_has_connection(profile, model_name) + @classmethod + def safe_run_hooks(cls, project, adapter, flat_graph, hook_type): + try: + cls.run_hooks(project, adapter, flat_graph, hook_type) + except dbt.exceptions.RuntimeException as e: + logger.info("Database error while running {}".format(hook_type)) + raise + @classmethod def before_run(cls, project, adapter, flat_graph): cls.try_create_schema(project, adapter) - cls.run_hooks(project, adapter, flat_graph, RunHookType.Start) + cls.safe_run_hooks(project, adapter, flat_graph, RunHookType.Start) @classmethod def print_results_line(cls, results, execution_time): @@ -270,7 +278,7 @@ def print_results_line(cls, results, execution_time): @classmethod def after_run(cls, project, adapter, results, flat_graph, elapsed): - cls.run_hooks(project, adapter, flat_graph, RunHookType.End) + cls.safe_run_hooks(project, adapter, flat_graph, RunHookType.End) cls.print_results_line(results, elapsed) def describe_node(self):