Skip to content

Commit 8621c8b

Browse files
committed
fix: tuple function error in ClickHouse 24.8
1 parent 7e7326e commit 8621c8b

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- fix: #99 update value containing "where" cause exception.
44
- fix: #97 JSONField error in ClickHouse 24.8.
5+
- fix: tuple function error in ClickHouse 24.8.
56

67
### 1.3.0
78

clickhouse_backend/models/fields/tuple.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,12 @@ def _convert_type(self, value):
151151
if value is None or isinstance(value, self.container_class):
152152
return value
153153
if self.is_named_tuple:
154+
if isinstance(value, dict):
155+
return self.container_class(**value)
154156
return self.container_class(*value)
157+
# From ClickHouse server 24.8 LTS, tuple("a", "b") returns NamedTuple.
158+
if isinstance(value, dict):
159+
return self.container_class(value.values())
155160
return self.container_class(value)
156161

157162
@property

0 commit comments

Comments
 (0)