Skip to content

Commit 6c8cf0b

Browse files
author
Andrew Brookins
committed
Fix all_pks to work if decode_responses=False
1 parent c7c6dff commit 6c8cf0b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "redis-om"
3-
version = "0.0.9"
3+
version = "0.0.11"
44
description = "A high-level library containing useful Redis abstractions and tools, like an ORM and leaderboard."
55
authors = ["Andrew Brookins <[email protected]>"]
66
maintainers = ["Andrew Brookins <[email protected]>"]

redis_om/model/model.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1210,8 +1210,11 @@ def all_pks(cls):
12101210
# TODO: We assume the key ends with the default separator, ":" -- when
12111211
# we make the separator configurable, we need to update this as well.
12121212
# ... And probably lots of other places ...
1213+
#
1214+
# TODO: Also, we need to decide how we want to handle the lack of
1215+
# decode_responses=True...
12131216
return (
1214-
key.split(":")[-1]
1217+
key.split(":")[-1] if isinstance(key, str) else key.decode(cls.Meta.encoding).split(":")[-1]
12151218
for key in cls.db().scan_iter(f"{key_prefix}*", _type="HASH")
12161219
)
12171220

0 commit comments

Comments
 (0)