You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "john-bodley (via GitHub)" <gi...@apache.org> on 2023/08/10 00:29:02 UTC

[GitHub] [superset] john-bodley commented on a diff in pull request #24467: chore(dao): Replace save/overwrite with create/update respectively

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


##########
superset/daos/base.py:
##########
@@ -127,57 +128,72 @@ def find_one_or_none(cls, **filter_by: Any) -> Optional[T]:
         return query.filter_by(**filter_by).one_or_none()
 
     @classmethod
-    def create(cls, properties: dict[str, Any], commit: bool = True) -> T:
-        """
-        Generic for creating models
-        :raises: DAOCreateFailedError
+    def create(
+        cls,
+        item: T | None = None,

Review Comment:
   @michael-s-molina sorry for the delay in getting back to you on this. You mention you could do something of the form,
   
   ```python
   chart = ChartDAO.create()
   ```
   
   which would try to create a new chart and persist it to the database. This operation would succeed if the model attributes can be nullable. I realize this isn't a typical workflow, but I'm not entirely sure it's wrong per se.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org