villebro commented on code in PR #33300: URL: https://github.com/apache/superset/pull/33300#discussion_r2069301953
########## superset/utils/metadata.py: ########## @@ -0,0 +1,9 @@ +from superset import db + +class SuspendSession: + def __enter__(self): + self.session_objects = db.session.identity_map.values() + db.session.remove() + def __exit__(self, exc_type, exc_val, exc_tb): + for obj in self.session_objects: + db.session.add(obj) Review Comment: I like the idea to release the metastore connection for the duration of the analytical query, but this seems slightly low level/dangerous. Have you considered any other approaches, like just doing `db.session.close()` and then letting the session lazily resume when needed? -- 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]
