From 76042be7c3b52c5019114b372dc841137205e14f Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Mon, 17 Apr 2017 17:32:21 -0700 Subject: [PATCH] [hotfix/sqllab] setting up the connection in the try: block --- superset/sql_lab.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/superset/sql_lab.py b/superset/sql_lab.py index f3dcbf120b65b..9491c5f546c3e 100644 --- a/superset/sql_lab.py +++ b/superset/sql_lab.py @@ -120,11 +120,11 @@ def handle_error(msg): session.commit() logging.info("Set query to 'running'") - engine = database.get_sqla_engine(schema=query.schema) - conn = engine.raw_connection() - cursor = conn.cursor() - logging.info("Running query: \n{}".format(executed_sql)) try: + engine = database.get_sqla_engine(schema=query.schema) + conn = engine.raw_connection() + cursor = conn.cursor() + logging.info("Running query: \n{}".format(executed_sql)) logging.info(query.executed_sql) cursor.execute( query.executed_sql, **db_engine_spec.cursor_execute_kwargs)