Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Mar 28, 2017
1 parent 1af2ca6 commit 50769c9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions superset/sql_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,15 @@ def handle_error(msg):
handle_error(msg)

query.executed_sql = executed_sql
logging.info("Running query: \n{}".format(executed_sql))
query.status = QueryStatus.RUNNING
query.start_running_time = utils.now_as_float()
session.merge(query)
session.flush()

engine = database.get_sqla_engine(schema=query.schema)
conn = engine.raw_connection()
cursor = conn.cursor()
logging.info("Running query: \n{}".format(executed_sql))
try:
logging.info(query.executed_sql)
cursor.execute(
Expand All @@ -117,10 +122,6 @@ def handle_error(msg):
conn.close()
handle_error(db_engine_spec.extract_error_message(e))

query.status = QueryStatus.RUNNING
query.start_running_time = utils.now_as_float()
session.merge(query)
session.commit()
try:
logging.info("Handling cursor")
db_engine_spec.handle_cursor(cursor, query, session)
Expand Down

0 comments on commit 50769c9

Please sign in to comment.