Skip to content

Commit 2e3581e

Browse files
committed
Intermediate changes
commit_hash:ff119d5d465aa66bb60906ff86071695dcd210e3
1 parent ad8a91b commit 2e3581e

File tree

13 files changed

+58
-41
lines changed

13 files changed

+58
-41
lines changed

contrib/python/aiosignal/.dist-info/METADATA

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.1
22
Name: aiosignal
3-
Version: 1.3.1
3+
Version: 1.3.2
44
Summary: aiosignal: a list of registered asynchronous callbacks
55
Home-page: https://github.com/aio-libs/aiosignal
66
Maintainer: aiohttp team <team@aiohttp.org>
@@ -17,20 +17,15 @@ Classifier: Intended Audience :: Developers
1717
Classifier: Programming Language :: Python
1818
Classifier: Programming Language :: Python :: 3
1919
Classifier: Programming Language :: Python :: 3 :: Only
20-
Classifier: Programming Language :: Python :: 3.7
21-
Classifier: Programming Language :: Python :: 3.8
22-
Classifier: Programming Language :: Python :: 3.9
23-
Classifier: Programming Language :: Python :: 3.10
24-
Classifier: Programming Language :: Python :: 3.11
2520
Classifier: Development Status :: 5 - Production/Stable
2621
Classifier: Operating System :: POSIX
2722
Classifier: Operating System :: MacOS :: MacOS X
2823
Classifier: Operating System :: Microsoft :: Windows
2924
Classifier: Framework :: AsyncIO
30-
Requires-Python: >=3.7
25+
Requires-Python: >=3.9
3126
Description-Content-Type: text/x-rst
3227
License-File: LICENSE
33-
Requires-Dist: frozenlist (>=1.1.0)
28+
Requires-Dist: frozenlist>=1.1.0
3429

3530
=========
3631
aiosignal
@@ -91,7 +86,7 @@ Installation
9186

9287
$ pip install aiosignal
9388

94-
The library requires Python 3.6 or newer.
89+
The library requires Python 3.8 or newer.
9590

9691

9792
Documentation
@@ -107,7 +102,7 @@ Communication channels
107102
Requirements
108103
============
109104

110-
- Python >= 3.6
105+
- Python >= 3.8
111106
- frozenlist >= 1.0.0
112107

113108
License

contrib/python/aiosignal/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Installation
5757

5858
$ pip install aiosignal
5959

60-
The library requires Python 3.6 or newer.
60+
The library requires Python 3.8 or newer.
6161

6262

6363
Documentation
@@ -73,7 +73,7 @@ Communication channels
7373
Requirements
7474
============
7575

76-
- Python >= 3.6
76+
- Python >= 3.8
7777
- frozenlist >= 1.0.0
7878

7979
License

contrib/python/aiosignal/aiosignal/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from frozenlist import FrozenList
22

3-
__version__ = "1.3.1"
3+
__version__ = "1.3.2"
44

55
__all__ = ("Signal",)
66

contrib/python/aiosignal/ya.make

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

33
PY3_LIBRARY()
44

5-
VERSION(1.3.1)
5+
VERSION(1.3.2)
66

77
LICENSE(Apache-2.0)
88

contrib/python/clickhouse-connect/.dist-info/METADATA

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.1
22
Name: clickhouse-connect
3-
Version: 0.8.9
3+
Version: 0.8.10
44
Summary: ClickHouse Database Core Driver for Python, Pandas, and Superset
55
Home-page: https://github.com/ClickHouse/clickhouse-connect
66
Author: ClickHouse Inc.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = '0.8.9'
1+
version = '0.8.10'

contrib/python/clickhouse-connect/clickhouse_connect/datatypes/dynamic.py

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from clickhouse_connect.datatypes.base import ClickHouseType, TypeDef
44
from clickhouse_connect.datatypes.registry import get_from_name
5-
from clickhouse_connect.driver.common import unescape_identifier, first_value
5+
from clickhouse_connect.driver.common import unescape_identifier, first_value, write_uint64
66
from clickhouse_connect.driver.ctypes import data_conv
77
from clickhouse_connect.driver.errors import handle_error
88
from clickhouse_connect.driver.exceptions import DataError
@@ -14,6 +14,8 @@
1414
SHARED_DATA_TYPE: ClickHouseType
1515
STRING_DATA_TYPE: ClickHouseType
1616

17+
json_serialization_format = 0x1
18+
1719
class Variant(ClickHouseType):
1820
_slots = 'element_types'
1921
python_type = object
@@ -86,9 +88,11 @@ def write_column_data(self, column: Sequence, dest: bytearray, ctx: InsertContex
8688

8789

8890
def read_dynamic_prefix(source: ByteSource) -> List[ClickHouseType]:
89-
if source.read_uint64() != 1: # dynamic structure serialization version, currently only 1 is recognized
91+
serialize_version = source.read_uint64()
92+
if serialize_version == 1:
93+
source.read_leb128() # max dynamic types, we ignore this value
94+
elif serialize_version != 2:
9095
raise DataError('Unrecognized dynamic structure version')
91-
source.read_leb128() # max dynamic types, we ignore this value
9296
num_variants = source.read_leb128()
9397
variant_types = [get_from_name(source.read_leb128_str()) for _ in range(num_variants)]
9498
variant_types.append(STRING_DATA_TYPE)
@@ -188,13 +192,23 @@ def __init__(self, type_def:TypeDef):
188192

189193
@property
190194
def insert_name(self):
191-
return 'String'
195+
if json_serialization_format == 0:
196+
return 'String'
197+
return super().insert_name
198+
199+
def write_column_prefix(self, dest: bytearray):
200+
if json_serialization_format > 0:
201+
write_uint64(json_serialization_format, dest)
202+
203+
def read_column_prefix(self, source: ByteSource, ctx: QueryContext):
204+
serialize_version = source.read_uint64()
205+
if serialize_version == 0:
206+
source.read_leb128() # max dynamic types, we ignore this value
207+
elif serialize_version != 2:
208+
raise DataError(f'Unrecognized dynamic structure version: {serialize_version} column: `{ctx.column_name}`')
192209

193210
# pylint: disable=too-many-locals
194-
def read_column(self, source: ByteSource, num_rows: int, ctx: QueryContext):
195-
if source.read_uint64() != 0: # object serialization version, currently only 0 is recognized
196-
raise DataError(f'unrecognized object serialization version, column `{ctx.column_name}`')
197-
source.read_leb128() # the max number of dynamic paths. Used to preallocate storage in ClickHouse; we ignore it
211+
def _read_column_binary(self, source: ByteSource, num_rows: int, ctx: QueryContext):
198212
dynamic_path_cnt = source.read_leb128()
199213
dynamic_paths = [source.read_leb128_str() for _ in range(dynamic_path_cnt)]
200214
for typed in self.typed_types:

contrib/python/clickhouse-connect/clickhouse_connect/driver/buffer.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,8 @@ def read_array(self, array_type: str, num_rows: int) -> Iterable[Any]:
129129
return column
130130

131131
@property
132-
def last_message(self):
133-
if len(self.buffer) == 0:
134-
return None
135-
return self.buffer.decode()
132+
def last_message(self) -> bytes:
133+
return self.buffer
136134

137135
def close(self):
138136
if self.source:

contrib/python/clickhouse-connect/clickhouse_connect/driver/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from clickhouse_connect.common import version
1313
from clickhouse_connect.datatypes.registry import get_from_name
1414
from clickhouse_connect.datatypes.base import ClickHouseType
15+
from clickhouse_connect.datatypes import dynamic as dynamic_module
1516
from clickhouse_connect.driver import tzutil
1617
from clickhouse_connect.driver.common import dict_copy, StreamContext, coerce_int, coerce_bool
1718
from clickhouse_connect.driver.constants import CH_VERSION_WITH_PROTOCOL, PROTOCOL_VERSION_WITH_LOW_CARD
@@ -90,7 +91,7 @@ def _init_common_settings(self, apply_server_timezone:Optional[Union[str, bool]]
9091
server_settings = self.query(f'SELECT name, value, {readonly} as readonly FROM system.settings LIMIT 10000')
9192
self.server_settings = {row['name']: SettingDef(**row) for row in server_settings.named_results()}
9293

93-
if self.min_version(CH_VERSION_WITH_PROTOCOL):
94+
if self.min_version(CH_VERSION_WITH_PROTOCOL) and common.get_setting('use_protocol_version'):
9495
# Unfortunately we have to validate that the client protocol version is actually used by ClickHouse
9596
# since the query parameter could be stripped off (in particular, by CHProxy)
9697
test_data = self.raw_query('SELECT 1 AS check', fmt='Native', settings={
@@ -103,6 +104,8 @@ def _init_common_settings(self, apply_server_timezone:Optional[Union[str, bool]]
103104
if self._setting_status('allow_experimental_json_type').is_set and \
104105
self._setting_status('cast_string_to_dynamic_user_inference').is_writable:
105106
self.set_client_setting('cast_string_to_dynamic_use_inference', '1')
107+
if self.min_version('24.8') and not self.min_version('24.10'):
108+
dynamic_module.json_serialization_format = 0
106109

107110

108111
def _validate_settings(self, settings: Optional[Dict[str, Any]]) -> Dict[str, str]:

contrib/python/clickhouse-connect/clickhouse_connect/driver/transform.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,7 @@ def get_block():
5555
# We ran out of data before it was expected, this could be ClickHouse reporting an error
5656
# in the response
5757
if source.last_message:
58-
message = source.last_message
59-
if len(message) > 1024:
60-
message = message[-1024:]
61-
error_start = message.find('Code: ')
62-
if error_start != -1:
63-
message = message[error_start:]
64-
raise StreamFailureError(message) from None
58+
raise StreamFailureError(extract_error_message(source.last_message)) from None
6559
raise
6660
block_num += 1
6761
return result_block
@@ -119,3 +113,16 @@ def chunk_gen():
119113
yield footer
120114

121115
return chunk_gen()
116+
117+
118+
def extract_error_message(message: bytes) -> str:
119+
if len(message) > 1024:
120+
message = message[-1024:]
121+
error_start = message.find('Code: '.encode())
122+
if error_start != -1:
123+
message = message[error_start:]
124+
try:
125+
message_str = message.decode()
126+
except UnicodeError:
127+
message_str = f'unrecognized data found in stream: `{message.hex()[128:]}`'
128+
return message_str

0 commit comments

Comments
 (0)