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.
   
   BTW I totally agree there's room for improvement here—I was even toiling 
with the idea that maybe `create` and `update` should be handled by a single 
`upsert` method—however I do sense this PR helps ensure that the code is more 
consistent (and both the `create` and `update` methods have the same function 
signature).



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