dankor commented on code in PR #29573:
URL: https://github.com/apache/superset/pull/29573#discussion_r2025570673
##########
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:
OMG, I didn't expect it works:
```python
from marshmallow.fields import UUID
uuid_field = UUID()
print(uuid_field.deserialize("55018400129141141716446655440000"))
# returns '55018400-1291-4114-1716-446655440000'
```
Nonetheless, we operate deserialized values only, so we are indeed safe.
--
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]