-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: temporarily disconnect metadata db during long analytics queries #916
Conversation
superset/sqllab/sql_json_executer.py
Outdated
@@ -101,6 +102,7 @@ def execute( | |||
raise | |||
except Exception as ex: | |||
logger.exception("Query %i failed unexpectedly", query_id) | |||
logger.error(ex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this to get some message from the exception logged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.exception
already logs the exception, in addition to the message, it's what differentiates it from logger.error
. So this line is not needed.
superset/sqllab/sql_json_executer.py
Outdated
@@ -101,6 +102,7 @@ def execute( | |||
raise | |||
except Exception as ex: | |||
logger.exception("Query %i failed unexpectedly", query_id) | |||
logger.error(ex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.exception
already logs the exception, in addition to the message, it's what differentiates it from logger.error
. So this line is not needed.
is_feature_enabled("DISABLE_METADATA_DB_DURING_ANALYTICS") | ||
and pool_type == "NullPool" | ||
) | ||
conn = db.session.connection() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this? This is just a new connection, it seems like creating it here, closing it in the try
and reopening it in the finally
will do nothing.
made the changes, closing in favor of apache#31315 |
Tried some things ... having issues recreating the scoped session.
Hitting a wall with this message -
Instance <Database at 0xffff7c5305e0> is not bound to a Session; attribute refresh operation cannot proceed (Background on this error at: https://sqlalche.me/e/14/bhk3)
It's probably just a few lines to restore the database session the right way... Would need to look deeper at the mechanics in https://github.com/pallets-eco/flask-sqlalchemy and reproduce what they do there to re-init the sesh