betodealmeida commented on a change in pull request #11836:
URL: 
https://github.com/apache/incubator-superset/pull/11836#discussion_r532770313



##########
File path: superset/datasets/api.py
##########
@@ -252,6 +253,10 @@ def put(self, pk: int) -> Response:
             schema:
               type: integer
             name: pk
+          - in: path
+            schema:
+              type: bool
+            name: override_column

Review comment:
       `override_columns`

##########
File path: superset/datasets/api.py
##########
@@ -284,6 +289,11 @@ def put(self, pk: int) -> Response:
             500:
               $ref: '#/components/responses/500'
         """
+        override_columns = (
+            bool(strtobool(request.args["override_columns"]))

Review comment:
       It makes me angry that `strtobool` returns an integer. :angry: 

##########
File path: superset/datasets/commands/update.py
##########
@@ -48,17 +48,29 @@
 
 
 class UpdateDatasetCommand(BaseCommand):
-    def __init__(self, user: User, model_id: int, data: Dict[str, Any]):
+    def __init__(
+        self,
+        user: User,
+        model_id: int,
+        data: Dict[str, Any],
+        override_columns: bool = False,
+    ):
         self._actor = user
         self._model_id = model_id
         self._properties = data.copy()
         self._model: Optional[SqlaTable] = None
+        self.override_columns = override_columns
 
     def run(self) -> Model:
         self.validate()
         if self._model:
             try:
-                dataset = DatasetDAO.update(self._model, self._properties)
+                dataset = DatasetDAO.update(
+                    model=self._model,
+                    properties=self._properties,
+                    commit=True,

Review comment:
       This change threw me off because `commit` already defaults to `True`.




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

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