Skip to content

Commit

Permalink
Fix for errant method call in error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
drewbanin committed Aug 21, 2019
1 parent e7a24a2 commit 89c4dbc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plugins/snowflake/dbt/adapters/snowflake/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,18 @@ def add_query(self, sql, auto_begin=True,
)

if cursor is None:
conn = self.get_thread_connection()
if conn is None or conn.name is None:
conn_name = '<None>'
else:
conn_name = conn.name

raise dbt.exceptions.RuntimeException(
"Tried to run an empty query on model '{}'. If you are "
"conditionally running\nsql, eg. in a model hook, make "
"sure your `else` clause contains valid sql!\n\n"
"Provided SQL:\n{}"
.format(self.nice_connection_name(), sql)
.format(conn_name, sql)
)

return connection, cursor
Expand Down

0 comments on commit 89c4dbc

Please sign in to comment.