From 89c4dbcdbab00e94cc56c37cfb9a01c6f3a7898b Mon Sep 17 00:00:00 2001 From: Drew Banin Date: Tue, 20 Aug 2019 20:35:28 -0400 Subject: [PATCH] Fix for errant method call in error handler --- plugins/snowflake/dbt/adapters/snowflake/connections.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/snowflake/dbt/adapters/snowflake/connections.py b/plugins/snowflake/dbt/adapters/snowflake/connections.py index f2005b50c47..2952d364a66 100644 --- a/plugins/snowflake/dbt/adapters/snowflake/connections.py +++ b/plugins/snowflake/dbt/adapters/snowflake/connections.py @@ -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 = '' + 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