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

improvements for code that runs in hooks #544

Merged
merged 4 commits into from
Sep 29, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions dbt/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ def type(self):
return 'Runtime'

def node_to_string(self, node):
if node is None:
return "<Unknown>"

return "{} {} ({})".format(
node.get('resource_type'),
node.get('name', 'unknown'),
Expand Down
9 changes: 9 additions & 0 deletions dbt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ def __init__(self, adapter, node, use_temp=False):
def _get_table_name(self, node):
return model_immediate_name(node, dbt.flags.NON_DESTRUCTIVE)

def final_name(self):
if self.materialized == 'ephemeral':
msg = "rendered_name() called on an ephemeral_model"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final_name?

dbt.exceptions.raise_compiler_error(msg, self.node)
else:
return self._adapter.quote_schema_and_table(profile=None,
schema=self.schema,
table=self.name)

def __repr__(self):
if self.materialized == 'ephemeral':
return '__dbt__CTE__{}'.format(self.name)
Expand Down