Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion superset/models/slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,9 @@ def get(cls, id_or_uuid: str) -> Slice:
return qry.one_or_none()


def id_or_uuid_filter(id_or_uuid: str) -> BinaryExpression:
def id_or_uuid_filter(id_or_uuid: str | int) -> BinaryExpression:
if isinstance(id_or_uuid, int):
return Slice.id == id_or_uuid
if id_or_uuid.isdigit():
return Slice.id == int(id_or_uuid)
return Slice.uuid == id_or_uuid
Expand Down
1 change: 1 addition & 0 deletions tests/unit_tests/models/slice_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def test_slice_get_no_type_error(self, test_name, input_value):
("numeric_id", "123"),
("uuid_format", "550e8400-e29b-41d4-a716-446655440000"),
("invalid_string", "not-a-number"),
("integer_id", 123),
]
)
def test_id_or_uuid_filter(self, test_name, input_value):
Expand Down
Loading