happykust commented on issue #15854: URL: https://github.com/apache/superset/issues/15854#issuecomment-1628519304
@tirkarthi this solution is already in the Superset codebase and it doesn't work in the same way that people's solutions don't with modifying or cutting out the search. In the `query` function, in the `SQLAInterface` class, where the query itself occurs, there are no external link attachments, which, presumably, at the time the template is rendered, causes a large number of queries. https://github.com/dpgaspar/Flask-AppBuilder/blob/7f194cfd28099688e0a398ca7b1317aafa804c92/flask_appbuilder/models/sqla/interface.py#L458-L507 ` def query( self, filters: Optional[Filters] = None, order_column: str = "", order_direction: str = "", page: Optional[int] = None, page_size: Optional[int] = None, select_columns: Optional[List[str]] = None, outer_default_load: bool = False, ) -> Tuple[int, List[Model]]: """ Returns the results for a model query, applies filters, sorting and pagination :param filters: A Filter class that contains all filters to apply :param order_column: name of the column to order :param order_direction: the direction to order <'asc'|'desc'> :param page: the current page :param page_size: the current page size :param select_columns: A List of columns to be specifically selected on the query. Supports dotted notation. :param outer_default_load: If True, the default load for outer joins will be applied. This is useful for when you want to control the load of the many-to-many relationships at the model level. we will apply: https://docs.sqlalchemy.org/en/14/orm/loading_relationships.html#sqlalchemy.orm.Load.defaultload :return: A tuple with the query count (non paginated) and the results """ if not self.session: raise InterfaceQueryWithoutSession() query = self.session.query(self.obj) count = self.query_count(query, filters, select_columns) query = self.apply_all( query, filters, order_column, order_direction, page, page_size, select_columns, ) query_results = query.all() result = [] for item in query_results: if hasattr(item, self.obj.__name__): result.append(getattr(item, self.obj.__name__)) else: return count, query_results return count, result` -- 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]
