mistercrunch commented on code in PR #31294:
URL: https://github.com/apache/superset/pull/31294#discussion_r1872046723


##########
superset/daos/query.py:
##########
@@ -35,25 +35,6 @@
 class QueryDAO(BaseDAO[Query]):
     base_filter = QueryFilter
 
-    @staticmethod
-    def update_saved_query_exec_info(query_id: int) -> None:
-        """
-        Propagates query execution info back to saved query if applicable
-
-        :param query_id: The query id
-        :return:
-        """
-        query = db.session.query(Query).get(query_id)
-        related_saved_queries = (
-            db.session.query(SavedQuery)
-            .filter(SavedQuery.database == query.database)
-            .filter(SavedQuery.sql == query.sql)

Review Comment:
   Can't we just add `.filter(SavedQuery.id == query_id)` here? Why would we 
want to update the last run time of other saved queries with the exact same 
SQL? 
   
   If we filter on query_id, it should use the PK index and be super efficient. 
Also if we don't want to update if the query has been mutated, seems we should 
not only check `sql` and `database`, but schema/catalog too.



-- 
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]

Reply via email to