TacoBel42 commented on code in PR #1492:
URL: https://github.com/apache/superset/pull/1492#discussion_r1666938613
##########
caravel/sql_lab.py:
##########
@@ -46,10 +51,17 @@ def create_table_as(sql, table_name, schema=None,
override=False):
return exec_sql.format(**locals())
-@celery_app.task
-def get_sql_results(query_id, return_results=True, store_results=False):
+@celery_app.task(bind=True)
+def get_sql_results(self, query_id, return_results=True, store_results=False):
"""Executes the sql query returns the results."""
- session = db.session()
+ if not self.request.called_directly:
+ engine = sqlalchemy.create_engine(
+ app.config.get('SQLALCHEMY_DATABASE_URI'), poolclass=NullPool)
+ session_class = sessionmaker()
+ session_class.configure(bind=engine)
+ session = session_class()
+ else:
+ session = db.session()
session.commit() # HACK
Review Comment:
@mistercrunch why? what does HACK do?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]