Skip to content

Commit

Permalink
Merge pull request #1694 from fishtown-analytics/fix/connection-name-…
Browse files Browse the repository at this point in the history
…snowflake

Fix for errant method call in error handler
  • Loading branch information
drewbanin authored Aug 21, 2019
2 parents e7a24a2 + 89c4dbc commit 84a9915
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 84a9915

Please sign in to comment.