john-bodley commented on code in PR #20473:
URL: https://github.com/apache/superset/pull/20473#discussion_r904365969


##########
superset/datasets/dao.py:
##########
@@ -190,28 +185,37 @@ def update_columns(
         - If there are extra columns on the metadata db that are not defined 
on the List
         then we delete.
         """
+
+        column_by_id = {column.id: column for column in model.columns}
         new_columns = []
+
         for column in property_columns:
             column_id = column.get("id")
 
             if column_id:
-                column_obj = db.session.query(TableColumn).get(column_id)

Review Comment:
   Leverage the columns defined by the model rather than re-querying for each 
column individually.



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