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


##########
superset/models/slice.py:
##########
@@ -361,11 +362,17 @@ def get_query_context_factory(self) -> 
QueryContextFactory:
         return self.query_context_factory
 
     @classmethod
-    def get(cls, id_: int) -> Slice:
-        qry = db.session.query(Slice).filter_by(id=id_)
+    def get(cls, id_or_uuid: str) -> Slice:
+        qry = db.session.query(Slice).filter_by(id_or_uuid_filter(id_or_uuid))
         return qry.one_or_none()
 
 
+def id_or_uuid_filter(id_or_uuid: str) -> BinaryExpression:
+    if id_or_uuid.isdigit():

Review Comment:
   i think this is safe... do our uuids expect dashes `-` when represented as 
strings? I did a bit of nerdy research and the odds of a uuid being made out of 
digits only is 1/34M. Would hate to be the person debugging that 1 in 34M 
issue... Though this is not an issue if we expect dashes, not sure how to 
confirm this



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