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. Though this is not an issue if we expect dashes. -- 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-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org