villebro commented on code in PR #31315:
URL: https://github.com/apache/superset/pull/31315#discussion_r1873849921
##########
superset/models/core.py:
##########
@@ -691,27 +731,30 @@ def _log_query(sql: str) -> None:
with self.get_raw_connection(catalog=catalog, schema=schema) as conn:
cursor = conn.cursor()
df = None
- for i, sql_ in enumerate(sqls):
- sql_ = self.mutate_sql_based_on_config(sql_, is_split=True)
- _log_query(sql_)
- with event_logger.log_context(
- action="execute_sql",
- database=self,
- object_ref=__name__,
- ):
- self.db_engine_spec.execute(cursor, sql_, self)
- if i < len(sqls) - 1:
- # If it's not the last, we don't keep the results
- cursor.fetchall()
- else:
- # Last query, fetch and process the results
- data = self.db_engine_spec.fetch_data(cursor)
- result_set = SupersetResultSet(
- data, cursor.description, self.db_engine_spec
- )
- df = result_set.to_pandas_df()
- if mutator:
- df = mutator(df)
+ with temporarily_disconnect_db():
+ if is_feature_enabled("SIMULATE_SLOW_ANALYTICS_DATABASE"):
+ time.sleep(30)
Review Comment:
I agree with @giftig - adding this type of testing logic is IMO not a great
solution, as it convolutes the codebase and adds maintenance burden that
doesn't contribute to the core functionality of the product.
--
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]