clickhouse-driver 0.2.9__cp312-cp312-win32.whl → 0.2.10__cp312-cp312-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ from .client import Client
3
3
  from .dbapi import connect
4
4
 
5
5
 
6
- VERSION = (0, 2, 9)
6
+ VERSION = (0, 2, 10)
7
7
  __version__ = '.'.join(str(x) for x in VERSION)
8
8
 
9
9
  __all__ = ['Client', 'connect']
@@ -39,7 +39,7 @@ class ClientInfo(object):
39
39
 
40
40
  try:
41
41
  self.os_user = getpass.getuser()
42
- except KeyError:
42
+ except (KeyError, OSError):
43
43
  self.os_user = ''
44
44
  self.client_hostname = socket.gethostname()
45
45
  self.client_name = client_name
@@ -1,8 +1,11 @@
1
1
  import importlib
2
+ import logging
2
3
 
3
4
  from .. import errors
4
5
  from ..protocol import CompressionMethodByte
5
6
 
7
+ logger = logging.getLogger(__name__)
8
+
6
9
 
7
10
  def get_compressor_cls(alg):
8
11
  try:
@@ -10,6 +13,7 @@ def get_compressor_cls(alg):
10
13
  return module.Compressor
11
14
 
12
15
  except ImportError:
16
+ logger.warning('Unable to import module %s', alg, exc_info=True)
13
17
  raise errors.UnknownCompressionMethod(
14
18
  "Unknown compression method: '{}'".format(alg)
15
19
  )
@@ -7,6 +7,11 @@ from sys import platform
7
7
  from time import time
8
8
  from urllib.parse import urlparse
9
9
 
10
+ try:
11
+ import certifi
12
+ except ImportError:
13
+ certifi = None
14
+
10
15
  from . import defines
11
16
  from . import errors
12
17
  from .block import RowOrientedBlock
@@ -120,7 +125,10 @@ class Connection(object):
120
125
  :param ca_certs: see :func:`ssl.wrap_socket` docs.
121
126
  :param ciphers: see :func:`ssl.wrap_socket` docs.
122
127
  :param keyfile: see :func:`ssl.wrap_socket` docs.
128
+ :param keypass: see :func:`ssl.wrap_socket` docs.
123
129
  :param certfile: see :func:`ssl.wrap_socket` docs.
130
+ :param check_hostname: see :func:`ssl.wrap_socket` docs.
131
+ Defaults to ``True``.
124
132
  :param server_hostname: Hostname to use in SSL Wrapper construction.
125
133
  Defaults to `None` which will send the passed
126
134
  host param during SSL initialization. This param
@@ -141,6 +149,10 @@ class Connection(object):
141
149
  Defaults to ``False``.
142
150
  :param client_revision: can be used for client version downgrading.
143
151
  Defaults to ``None``.
152
+ :param disable_reconnect: disable automatic reconnect in case of
153
+ failed ``ping``, helpful when every reconnect
154
+ need to be caught in calling code.
155
+ Defaults to ``False``.
144
156
  """
145
157
 
146
158
  def __init__(
@@ -156,12 +168,13 @@ class Connection(object):
156
168
  secure=False,
157
169
  # Secure socket parameters.
158
170
  verify=True, ssl_version=None, ca_certs=None, ciphers=None,
159
- keyfile=None, certfile=None,
171
+ keyfile=None, keypass=None, certfile=None, check_hostname=True,
160
172
  server_hostname=None,
161
173
  alt_hosts=None,
162
174
  settings_is_important=False,
163
175
  tcp_keepalive=False,
164
- client_revision=None
176
+ client_revision=None,
177
+ disable_reconnect=False,
165
178
  ):
166
179
  if secure:
167
180
  default_port = defines.DEFAULT_SECURE_PORT
@@ -187,10 +200,14 @@ class Connection(object):
187
200
  self.client_revision = min(
188
201
  client_revision or defines.CLIENT_REVISION, defines.CLIENT_REVISION
189
202
  )
203
+ self.disable_reconnect = disable_reconnect
190
204
 
191
205
  self.secure_socket = secure
192
206
  self.verify_cert = verify
193
207
 
208
+ if certifi is not None:
209
+ ca_certs = ca_certs or certifi.where()
210
+
194
211
  ssl_options = {}
195
212
  if ssl_version is not None:
196
213
  ssl_options['ssl_version'] = ssl_version
@@ -200,11 +217,14 @@ class Connection(object):
200
217
  ssl_options['ciphers'] = ciphers
201
218
  if keyfile is not None:
202
219
  ssl_options['keyfile'] = keyfile
220
+ if keypass is not None:
221
+ ssl_options['keypass'] = keypass
203
222
  if certfile is not None:
204
223
  ssl_options['certfile'] = certfile
205
224
 
206
225
  self.ssl_options = ssl_options
207
226
 
227
+ self.check_hostname = check_hostname if self.verify_cert else False
208
228
  self.server_hostname = server_hostname
209
229
 
210
230
  # Use LZ4 compression by default.
@@ -258,6 +278,11 @@ class Connection(object):
258
278
  self.connect()
259
279
 
260
280
  elif not self.ping():
281
+ if self.disable_reconnect:
282
+ raise errors.NetworkError(
283
+ "Connection was closed, reconnect is disabled."
284
+ )
285
+
261
286
  logger.warning('Connection was closed, reconnecting.')
262
287
  self.connect()
263
288
 
@@ -307,7 +332,7 @@ class Connection(object):
307
332
 
308
333
  version = ssl_options.get('ssl_version', ssl.PROTOCOL_TLS_CLIENT)
309
334
  context = ssl.SSLContext(version)
310
- context.check_hostname = self.verify_cert
335
+ context.check_hostname = self.check_hostname
311
336
 
312
337
  if 'ca_certs' in ssl_options:
313
338
  context.load_verify_locations(ssl_options['ca_certs'])
@@ -321,7 +346,11 @@ class Connection(object):
321
346
 
322
347
  if 'certfile' in ssl_options:
323
348
  keyfile = ssl_options.get('keyfile')
324
- context.load_cert_chain(ssl_options['certfile'], keyfile=keyfile)
349
+ keypass = ssl_options.get('keypass')
350
+ context.load_cert_chain(
351
+ ssl_options['certfile'],
352
+ keyfile=keyfile, password=keypass
353
+ )
325
354
 
326
355
  return context
327
356
 
@@ -542,6 +571,9 @@ class Connection(object):
542
571
  )
543
572
 
544
573
  def ping(self):
574
+ if not self.socket:
575
+ return None
576
+
545
577
  timeout = self.sync_request_timeout
546
578
 
547
579
  with self.timeout_setter(timeout):
@@ -155,9 +155,11 @@ def parse_url(url):
155
155
  # ssl
156
156
  elif name == 'verify':
157
157
  kwargs[name] = asbool(value)
158
+ elif name == 'check_hostname':
159
+ kwargs[name] = asbool(value)
158
160
  elif name == 'ssl_version':
159
161
  kwargs[name] = getattr(ssl, value)
160
- elif name in ['ca_certs', 'ciphers', 'keyfile', 'certfile',
162
+ elif name in ['ca_certs', 'ciphers', 'keyfile', 'keypass', 'certfile',
161
163
  'server_hostname']:
162
164
  kwargs[name] = value
163
165
  elif name == 'alt_hosts':
Binary file
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: clickhouse-driver
3
- Version: 0.2.9
3
+ Version: 0.2.10
4
4
  Summary: Python driver with native interface for ClickHouse
5
5
  Home-page: https://github.com/mymarilyn/clickhouse-driver
6
6
  Author: Konstantin Lebedev
@@ -17,12 +17,12 @@ Classifier: License :: OSI Approved :: MIT License
17
17
  Classifier: Operating System :: OS Independent
18
18
  Classifier: Programming Language :: SQL
19
19
  Classifier: Programming Language :: Python :: 3
20
- Classifier: Programming Language :: Python :: 3.7
21
- Classifier: Programming Language :: Python :: 3.8
22
20
  Classifier: Programming Language :: Python :: 3.9
23
21
  Classifier: Programming Language :: Python :: 3.10
24
22
  Classifier: Programming Language :: Python :: 3.11
25
23
  Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Programming Language :: Python :: 3.14
26
26
  Classifier: Programming Language :: Python :: Implementation :: PyPy
27
27
  Classifier: Topic :: Database
28
28
  Classifier: Topic :: Software Development
@@ -30,20 +30,33 @@ Classifier: Topic :: Software Development :: Libraries
30
30
  Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
31
31
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
32
32
  Classifier: Topic :: Scientific/Engineering :: Information Analysis
33
- Requires-Python: >=3.7, <4
33
+ Requires-Python: >=3.9, <4
34
34
  License-File: LICENSE
35
35
  Requires-Dist: pytz
36
36
  Requires-Dist: tzlocal
37
37
  Provides-Extra: lz4
38
- Requires-Dist: clickhouse-cityhash >=1.0.2.1 ; extra == 'lz4'
39
- Requires-Dist: lz4 ; (implementation_name != "pypy") and extra == 'lz4'
40
- Requires-Dist: lz4 <=3.0.1 ; (implementation_name == "pypy") and extra == 'lz4'
41
- Provides-Extra: numpy
42
- Requires-Dist: numpy >=1.12.0 ; extra == 'numpy'
43
- Requires-Dist: pandas >=0.24.0 ; extra == 'numpy'
38
+ Requires-Dist: lz4<=3.0.1; implementation_name == "pypy" and extra == "lz4"
39
+ Requires-Dist: lz4; implementation_name != "pypy" and extra == "lz4"
40
+ Requires-Dist: clickhouse-cityhash>=1.0.2.1; extra == "lz4"
44
41
  Provides-Extra: zstd
45
- Requires-Dist: zstd ; extra == 'zstd'
46
- Requires-Dist: clickhouse-cityhash >=1.0.2.1 ; extra == 'zstd'
42
+ Requires-Dist: zstd; extra == "zstd"
43
+ Requires-Dist: clickhouse-cityhash>=1.0.2.1; extra == "zstd"
44
+ Provides-Extra: numpy
45
+ Requires-Dist: numpy>=1.12.0; extra == "numpy"
46
+ Requires-Dist: pandas>=0.24.0; extra == "numpy"
47
+ Dynamic: author
48
+ Dynamic: author-email
49
+ Dynamic: classifier
50
+ Dynamic: description
51
+ Dynamic: home-page
52
+ Dynamic: keywords
53
+ Dynamic: license
54
+ Dynamic: license-file
55
+ Dynamic: project-url
56
+ Dynamic: provides-extra
57
+ Dynamic: requires-dist
58
+ Dynamic: requires-python
59
+ Dynamic: summary
47
60
 
48
61
  ClickHouse Python Driver
49
62
  ========================
@@ -1,11 +1,11 @@
1
- clickhouse_driver/__init__.py,sha256=RK_d8W2wu-969SgQpS3ggN249KbViz6uDBaJLbCYsp4,158
1
+ clickhouse_driver/__init__.py,sha256=-RHHLH8KESN2fiVtQ1br8WM8Hl6CkqkunzvCOJCNkbM,159
2
2
  clickhouse_driver/block.py,sha256=t2zZhtCzwp4aJj0CuDqXlDEgHXgwc6GRsIks2aaIZvI,6311
3
3
  clickhouse_driver/blockstreamprofileinfo.py,sha256=nYx9QXWAS8aPiRbtAzwLRT5JIlJ8S103JMkudncwpFg,712
4
- clickhouse_driver/bufferedreader.cp312-win32.pyd,sha256=SIMn9Yz0a_YWctgErzZ86CPdp_otOTRxPid2Apv3Kwg,87552
5
- clickhouse_driver/bufferedwriter.cp312-win32.pyd,sha256=paIWJVUOTALQG5ekGiVGe29sWlK4n30S-qNvvTm8nCs,86528
4
+ clickhouse_driver/bufferedreader.cp312-win32.pyd,sha256=JklvZWSinVBCtwZ4II-Cte7d_NfmHsFTxdyy08HoRiY,74240
5
+ clickhouse_driver/bufferedwriter.cp312-win32.pyd,sha256=sJkk4YeZ24in30X_odp4e4HwyFIYVhzB-7UI_neD5J4,74752
6
6
  clickhouse_driver/client.py,sha256=iYSz2DLQC-t6RLmtWJvtHoEWBAFtKDIafl874tz2ebs,32251
7
- clickhouse_driver/clientinfo.py,sha256=Tw3NbuDHglT6_f0AcT0IdhqW_hVePtzh9pypx5nk5ZE,4260
8
- clickhouse_driver/connection.py,sha256=RYS-s3jjlfloFNeth6Vy7N3g6E-W5dXM1MGJ9F6H1cU,28760
7
+ clickhouse_driver/clientinfo.py,sha256=cdMA2td6tuYPsN6m4qtGzLzGKY4zQune0s0fZlNRiEA,4271
8
+ clickhouse_driver/connection.py,sha256=1GlehPjkzAPtFaAAzKHlBxyXMAHLyNOtNUKQjG7kjq4,29950
9
9
  clickhouse_driver/context.py,sha256=yPkJ_BN4LGODvKCOjNlDGqABwxAMQTQl7w1vIGRPBDg,909
10
10
  clickhouse_driver/defines.py,sha256=EwrQz7sNNUmGZmZywQFpDpBFc67nB9GAZOBQEvvUJzA,2130
11
11
  clickhouse_driver/errors.py,sha256=mffBg-Y2LFOSRzvE9V34RwFcvmfh67yqLeEBhrdjeXE,14343
@@ -17,7 +17,7 @@ clickhouse_driver/queryprocessingstage.py,sha256=lbV-bB5jWUp0hqYBTsUcRYkJhCgCTfN
17
17
  clickhouse_driver/reader.py,sha256=PWKOKwjszu0sJbG-dd_TyGn8tQAzxg2gCJVbz27G3-8,1322
18
18
  clickhouse_driver/readhelpers.py,sha256=tXOmSL9GSeHLdKE2yBlk0epfy-hGJ3bTOLq3Q6sXIkw,717
19
19
  clickhouse_driver/result.py,sha256=RpjBUvRQJ70xISye7u6gxgQBJwc2UkNuusLkaZF7SmM,4098
20
- clickhouse_driver/varint.cp312-win32.pyd,sha256=io2cDLCdozT3uarNE8hRKu4fRCCt_dsfZT65bi5VJdQ,34304
20
+ clickhouse_driver/varint.cp312-win32.pyd,sha256=FF4eJeVbjqnrNtCae4bBjDtWRGeX08hqTyyTjcA-KQQ,32768
21
21
  clickhouse_driver/writer.py,sha256=yf5f1vTr56YFtL-Swpi_jBsPw5bQS56j53joB0Acdyk,1286
22
22
  clickhouse_driver/columns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  clickhouse_driver/columns/arraycolumn.py,sha256=UiA48jw3o4-ert8BnzEbl2h1jVmtDH3jtcP1BTPru2w,5322
@@ -33,7 +33,7 @@ clickhouse_driver/columns/intcolumn.py,sha256=ntpxyMiu44VQYJ0HyHlglwxMgUtnIgf3JE
33
33
  clickhouse_driver/columns/intervalcolumn.py,sha256=oQeybb4qrcp07LeVYfqgeZuHYGH5RaY7KnWVoIsDe1I,600
34
34
  clickhouse_driver/columns/ipcolumn.py,sha256=LIt-NiUy70-8u5Amu0v0tlAlrolZ8gXzlFxcJYmjRAk,4095
35
35
  clickhouse_driver/columns/jsoncolumn.py,sha256=SeCLSrmRoEg9wlvoehs7-EmrV8XkOL3lknzeOORhbJg,1175
36
- clickhouse_driver/columns/largeint.cp312-win32.pyd,sha256=BNlZzUPy6LEYQX7Q9SuqKZBxojnM9E56jMxTU1zLag8,56320
36
+ clickhouse_driver/columns/largeint.cp312-win32.pyd,sha256=cWp3sM8WzTGfr5hRqQtus2X_BIF4ddL67pgAbjm6FBs,55296
37
37
  clickhouse_driver/columns/lowcardinalitycolumn.py,sha256=vMlhYYUPNmFhQiUAS77pE25KjI8TrO6ySz6w0ByBdZQ,4920
38
38
  clickhouse_driver/columns/mapcolumn.py,sha256=gX7xvwsilfOHDCwmRJu4fW2Y1OrN_1cgZTmbvcyer30,2133
39
39
  clickhouse_driver/columns/nestedcolumn.py,sha256=7x3xNYR22kEmgV4_3rPVZea2zCTU364O1tlOewMgw3M,303
@@ -57,7 +57,7 @@ clickhouse_driver/columns/numpy/lowcardinalitycolumn.py,sha256=ExYtwBBn6WfSQtWC0
57
57
  clickhouse_driver/columns/numpy/service.py,sha256=ENk26HPfxtbumcO_b2fGTNJdTgaJT0a-l3q_xrRIZZ4,2126
58
58
  clickhouse_driver/columns/numpy/stringcolumn.py,sha256=FH87XPQv3ga0ZJnngubqu4DgxmUt8bjW8xJcNfOU7EI,2439
59
59
  clickhouse_driver/columns/numpy/tuplecolumn.py,sha256=5RqhCIZ-CrWy_D0yyfTmlWBJgrunT5Yk-bM4OvIKZ1o,1233
60
- clickhouse_driver/compression/__init__.py,sha256=_XcKSkvWWPvEX4jeefYX1Alee58w6ktFOXrsIFRko_0,714
60
+ clickhouse_driver/compression/__init__.py,sha256=7D3Wk_-KQsnIdaqp9163YCDsQ98Stbl6GF1h1KAFgAg,840
61
61
  clickhouse_driver/compression/base.py,sha256=MCTK2aOGT3Lkso5r3-U-ilj2ln4r-nnfNI_2Ostsu6Q,2434
62
62
  clickhouse_driver/compression/lz4.py,sha256=ZTf1zn0uG26O29XHBBZeve26JLPNbbEWWMZe065oa0Y,631
63
63
  clickhouse_driver/compression/lz4hc.py,sha256=zGbj9vnM20W298kgzD0dIAgIeV30e5Kx8NSN8t4SDas,195
@@ -81,9 +81,9 @@ clickhouse_driver/streams/native.py,sha256=lIJFxLRFrh2zqRAvf8W2JPmXdGtJu3LPDUkfa
81
81
  clickhouse_driver/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
82
82
  clickhouse_driver/util/compat.py,sha256=wIB_6ULSapKx-Fi64lZ0YJ-TtWOQXePHE90wZopIM1I,876
83
83
  clickhouse_driver/util/escape.py,sha256=vL8sY6XdHhjFwtHn8yQ3JbeZfocWt6jyvxFf-nEiRtM,2262
84
- clickhouse_driver/util/helpers.py,sha256=AIKa7UPCiNMjGaMwFjn_n1PTij20PCYtA-YMePBKQFY,4483
85
- clickhouse_driver-0.2.9.dist-info/LICENSE,sha256=b2SjNa4zGQk6XzJwmeE1dQjjtWRvX_zxJIAl_ZbN_S8,1143
86
- clickhouse_driver-0.2.9.dist-info/METADATA,sha256=O7fUc77cROATgATo5BxkO01nhZH1Akh9uoOqOlADWcw,6342
87
- clickhouse_driver-0.2.9.dist-info/WHEEL,sha256=4N7jptPh4OYjkcvBzbL_SyiQfKWhgnHPSC8E7zx3zFw,98
88
- clickhouse_driver-0.2.9.dist-info/top_level.txt,sha256=PrE0Lrs4d-gRQwzABaABfym9Qvr4nN6uTrDy6Q7zQME,18
89
- clickhouse_driver-0.2.9.dist-info/RECORD,,
84
+ clickhouse_driver/util/helpers.py,sha256=IGmaK3L8_i8C-3NJWPWT2VK5hAtLxfflF0ti2z45SHs,4574
85
+ clickhouse_driver-0.2.10.dist-info/licenses/LICENSE,sha256=b2SjNa4zGQk6XzJwmeE1dQjjtWRvX_zxJIAl_ZbN_S8,1143
86
+ clickhouse_driver-0.2.10.dist-info/METADATA,sha256=L7JSolHa_2zc_NGUpJK-fXouxcU8UNJseMQkSxePWYE,6607
87
+ clickhouse_driver-0.2.10.dist-info/WHEEL,sha256=LwxTQZ0gyDP_uaeNCLm-ZIktY9hv6x0e22Q-hgFd-po,97
88
+ clickhouse_driver-0.2.10.dist-info/top_level.txt,sha256=PrE0Lrs4d-gRQwzABaABfym9Qvr4nN6uTrDy6Q7zQME,18
89
+ clickhouse_driver-0.2.10.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp312-cp312-win32
5
5