clickhouse-driver 0.2.6__cp311-cp311-win32.whl → 0.2.7__cp311-cp311-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.

Potentially problematic release.


This version of clickhouse-driver might be problematic. Click here for more details.

@@ -3,7 +3,7 @@ from .client import Client
3
3
  from .dbapi import connect
4
4
 
5
5
 
6
- VERSION = (0, 2, 6)
6
+ VERSION = (0, 2, 7)
7
7
  __version__ = '.'.join(str(x) for x in VERSION)
8
8
 
9
9
  __all__ = ['Client', 'connect']
@@ -63,6 +63,11 @@ class Client(object):
63
63
  tuple set ``namedtuple_as_json`` to ``False``.
64
64
  Default: True.
65
65
  New in version *0.2.6*.
66
+ * ``server_side_params`` -- Species on which side query parameters
67
+ should be rendered into placeholders.
68
+ Default: False. Means that parameters are rendered
69
+ on driver's side.
70
+ New in version *0.2.7*.
66
71
  """
67
72
 
68
73
  available_client_settings = (
@@ -74,7 +79,8 @@ class Client(object):
74
79
  'opentelemetry_tracestate',
75
80
  'quota_key',
76
81
  'input_format_null_as_default',
77
- 'namedtuple_as_json'
82
+ 'namedtuple_as_json',
83
+ 'server_side_params'
78
84
  )
79
85
 
80
86
  def __init__(self, *args, **kwargs):
@@ -107,6 +113,9 @@ class Client(object):
107
113
  ),
108
114
  'namedtuple_as_json': self.settings.pop(
109
115
  'namedtuple_as_json', True
116
+ ),
117
+ 'server_side_params': self.settings.pop(
118
+ 'server_side_params', False
110
119
  )
111
120
  }
112
121
 
@@ -592,12 +601,12 @@ class Client(object):
592
601
  self.connection.send_query(query_without_data, query_id=query_id)
593
602
  self.connection.send_external_tables(external_tables,
594
603
  types_check=types_check)
595
-
596
604
  sample_block = self.receive_sample_block()
605
+
597
606
  if sample_block:
598
607
  rv = self.send_data(sample_block, data,
599
608
  types_check=types_check, columnar=columnar)
600
- self.receive_end_of_query()
609
+ self.receive_end_of_insert_query()
601
610
  return rv
602
611
 
603
612
  def receive_sample_block(self):
@@ -651,8 +660,15 @@ class Client(object):
651
660
  self.connection.send_data(block)
652
661
  inserted_rows += block.num_rows
653
662
 
663
+ # Starting from the specific revision there are profile events
664
+ # sent by server in response to each inserted block
665
+ self.receive_profile_events()
666
+
654
667
  # Empty block means end of data.
655
668
  self.connection.send_data(block_cls())
669
+ # If enabled by revision profile events are also sent after empty block
670
+ self.receive_profile_events()
671
+
656
672
  return inserted_rows
657
673
 
658
674
  def receive_end_of_query(self):
@@ -663,7 +679,7 @@ class Client(object):
663
679
  break
664
680
 
665
681
  elif packet.type == ServerPacketTypes.PROGRESS:
666
- continue
682
+ self.last_query.store_progress(packet.progress)
667
683
 
668
684
  elif packet.type == ServerPacketTypes.EXCEPTION:
669
685
  raise packet.exception
@@ -675,11 +691,64 @@ class Client(object):
675
691
  pass
676
692
 
677
693
  elif packet.type == ServerPacketTypes.PROFILE_EVENTS:
678
- pass
694
+ self.last_query.store_profile(packet.profile_info)
695
+
696
+ else:
697
+ message = self.connection.unexpected_packet_message(
698
+ 'Exception, EndOfStream, Progress, TableColumns, '
699
+ 'ProfileEvents or Log', packet.type
700
+ )
701
+ raise errors.UnexpectedPacketFromServerError(message)
702
+
703
+ def receive_end_of_insert_query(self):
704
+ while True:
705
+ packet = self.connection.receive_packet()
706
+
707
+ if packet.type == ServerPacketTypes.END_OF_STREAM:
708
+ break
709
+
710
+ elif packet.type == ServerPacketTypes.LOG:
711
+ log_block(packet.block)
712
+
713
+ elif packet.type == ServerPacketTypes.PROGRESS:
714
+ self.last_query.store_progress(packet.progress)
715
+
716
+ elif packet.type == ServerPacketTypes.EXCEPTION:
717
+ raise packet.exception
679
718
 
680
719
  else:
681
720
  message = self.connection.unexpected_packet_message(
682
- 'Exception, EndOfStream or Log', packet.type
721
+ 'EndOfStream, Log, Progress or Exception', packet.type
722
+ )
723
+ raise errors.UnexpectedPacketFromServerError(message)
724
+
725
+ def receive_profile_events(self):
726
+ revision = self.connection.server_info.used_revision
727
+ if (
728
+ revision <
729
+ defines.DBMS_MIN_PROTOCOL_VERSION_WITH_PROFILE_EVENTS_IN_INSERT
730
+ ):
731
+ return None
732
+
733
+ while True:
734
+ packet = self.connection.receive_packet()
735
+
736
+ if packet.type == ServerPacketTypes.PROFILE_EVENTS:
737
+ self.last_query.store_profile(packet.profile_info)
738
+ break
739
+
740
+ elif packet.type == ServerPacketTypes.PROGRESS:
741
+ self.last_query.store_progress(packet.progress)
742
+
743
+ elif packet.type == ServerPacketTypes.LOG:
744
+ log_block(packet.block)
745
+
746
+ elif packet.type == ServerPacketTypes.EXCEPTION:
747
+ raise packet.exception
748
+
749
+ else:
750
+ message = self.connection.unexpected_packet_message(
751
+ 'ProfileEvents, Progress, Log or Exception', packet.type
683
752
  )
684
753
  raise errors.UnexpectedPacketFromServerError(message)
685
754
 
@@ -706,6 +775,10 @@ class Client(object):
706
775
  # prints: SELECT 1234, 'bar'
707
776
  print(substituted_query)
708
777
  """
778
+ # In case of server side templating we don't substitute here.
779
+ if self.connection.context.client_settings['server_side_params']:
780
+ return query
781
+
709
782
  if not isinstance(params, dict):
710
783
  raise ValueError('Parameters are expected in dict form')
711
784
 
@@ -6,7 +6,7 @@ from .base import FormatColumn
6
6
  epoch_start = date(1970, 1, 1)
7
7
  epoch_end = date(2149, 6, 6)
8
8
 
9
- epoch_start_date32 = date(1925, 1, 1)
9
+ epoch_start_date32 = date(1900, 1, 1)
10
10
  epoch_end_date32 = date(2283, 11, 11)
11
11
 
12
12
 
@@ -34,7 +34,7 @@ class DateColumn(FormatColumn):
34
34
  items[i] = null_value
35
35
  continue
36
36
 
37
- if type(item) != date:
37
+ if item is not date:
38
38
  item = date(item.year, item.month, item.day)
39
39
 
40
40
  if min_value <= item <= max_value:
@@ -54,7 +54,7 @@ class UUIDColumn(FormatColumn):
54
54
 
55
55
  try:
56
56
  if not isinstance(item, UUID):
57
- item = UUID(item)
57
+ item = UUID(int=item) if item is null_value else UUID(item)
58
58
 
59
59
  except ValueError:
60
60
  raise errors.CannotParseUuidError(
@@ -20,7 +20,7 @@ from .log import log_block
20
20
  from .progress import Progress
21
21
  from .protocol import Compression, ClientPacketTypes, ServerPacketTypes
22
22
  from .queryprocessingstage import QueryProcessingStage
23
- from .reader import read_binary_str
23
+ from .reader import read_binary_str, read_binary_uint64
24
24
  from .readhelpers import read_exception
25
25
  from .settings.writer import write_settings, SettingsFlags
26
26
  from .streams.native import BlockInputStream, BlockOutputStream
@@ -303,6 +303,7 @@ class Connection(object):
303
303
 
304
304
  version = ssl_options.get('ssl_version', ssl.PROTOCOL_TLS)
305
305
  context = ssl.SSLContext(version)
306
+ context.check_hostname = self.verify_cert
306
307
 
307
308
  if 'ca_certs' in ssl_options:
308
309
  context.load_verify_locations(ssl_options['ca_certs'])
@@ -496,6 +497,17 @@ class Connection(object):
496
497
  defines.DBMS_MIN_REVISION_WITH_VERSION_PATCH:
497
498
  server_version_patch = read_varint(self.fin)
498
499
 
500
+ if used_revision >= defines. \
501
+ DBMS_MIN_PROTOCOL_VERSION_WITH_PASSWORD_COMPLEXITY_RULES:
502
+ rules_size = read_varint(self.fin)
503
+ for _i in range(rules_size):
504
+ read_binary_str(self.fin) # original_pattern
505
+ read_binary_str(self.fin) # exception_message
506
+
507
+ if used_revision >= defines. \
508
+ DBMS_MIN_REVISION_WITH_INTERSERVER_SECRET_V2:
509
+ read_binary_uint64(self.fin) # read_nonce
510
+
499
511
  self.server_info = ServerInfo(
500
512
  server_name, server_version_major, server_version_minor,
501
513
  server_version_patch, server_revision,
@@ -702,10 +714,13 @@ class Connection(object):
702
714
  write_binary_str(query, self.fout)
703
715
 
704
716
  if revision >= defines.DBMS_MIN_PROTOCOL_VERSION_WITH_PARAMETERS:
705
- # Always settings_as_strings = True
706
- escaped = escape_params(
707
- params or {}, self.context, for_server=True
708
- )
717
+ if self.context.client_settings['server_side_params']:
718
+ # Always settings_as_strings = True
719
+ escaped = escape_params(
720
+ params or {}, self.context, for_server=True
721
+ )
722
+ else:
723
+ escaped = {}
709
724
  write_settings(escaped, self.fout, True, SettingsFlags.CUSTOM)
710
725
 
711
726
  logger.debug('Query: %s', query)
@@ -26,9 +26,13 @@ DBMS_MIN_PROTOCOL_VERSION_WITH_INITIAL_QUERY_START_TIME = 54449
26
26
  DBMS_MIN_PROTOCOL_VERSION_WITH_INCREMENTAL_PROFILE_EVENTS = 54451
27
27
  DBMS_MIN_REVISION_WITH_PARALLEL_REPLICAS = 54453
28
28
  DBMS_MIN_REVISION_WITH_CUSTOM_SERIALIZATION = 54454
29
+ DBMS_MIN_PROTOCOL_VERSION_WITH_PROFILE_EVENTS_IN_INSERT = 54456
29
30
  DBMS_MIN_PROTOCOL_VERSION_WITH_ADDENDUM = 54458
30
31
  DBMS_MIN_PROTOCOL_VERSION_WITH_QUOTA_KEY = 54458
31
32
  DBMS_MIN_PROTOCOL_VERSION_WITH_PARAMETERS = 54459
33
+ DBMS_MIN_PROTOCOL_VERSION_WITH_SERVER_QUERY_TIME_IN_PROGRESS = 54460
34
+ DBMS_MIN_PROTOCOL_VERSION_WITH_PASSWORD_COMPLEXITY_RULES = 54461
35
+ DBMS_MIN_REVISION_WITH_INTERSERVER_SECRET_V2 = 54462
32
36
 
33
37
  # Timeouts
34
38
  DBMS_DEFAULT_CONNECT_TIMEOUT_SEC = 10
@@ -44,7 +48,7 @@ CLIENT_NAME = 'python-driver'
44
48
  CLIENT_VERSION_MAJOR = 20
45
49
  CLIENT_VERSION_MINOR = 10
46
50
  CLIENT_VERSION_PATCH = 2
47
- CLIENT_REVISION = DBMS_MIN_PROTOCOL_VERSION_WITH_PARAMETERS
51
+ CLIENT_REVISION = DBMS_MIN_REVISION_WITH_INTERSERVER_SECRET_V2
48
52
 
49
53
  BUFFER_SIZE = 1048576
50
54
 
clickhouse_driver/log.py CHANGED
@@ -2,7 +2,8 @@ import logging
2
2
 
3
3
  logger = logging.getLogger(__name__)
4
4
 
5
-
5
+ # Keep in sync with ClickHouse priorities
6
+ # https://github.com/ClickHouse/ClickHouse/blob/master/src/Interpreters/InternalTextLogsQueue.cpp
6
7
  log_priorities = (
7
8
  'Unknown',
8
9
  'Fatal',
@@ -12,9 +13,12 @@ log_priorities = (
12
13
  'Notice',
13
14
  'Information',
14
15
  'Debug',
15
- 'Trace'
16
+ 'Trace',
17
+ 'Test',
16
18
  )
17
19
 
20
+ num_priorities = len(log_priorities)
21
+
18
22
 
19
23
  def log_block(block):
20
24
  if block is None:
@@ -25,7 +29,7 @@ def log_block(block):
25
29
  for row in block.get_rows():
26
30
  row = dict(zip(column_names, row))
27
31
 
28
- if 1 <= row['priority'] <= 8:
32
+ if 1 <= row['priority'] <= num_priorities:
29
33
  priority = log_priorities[row['priority']]
30
34
  else:
31
35
  priority = row[0]
@@ -9,6 +9,7 @@ class Progress(object):
9
9
  self.total_rows = 0
10
10
  self.written_rows = 0
11
11
  self.written_bytes = 0
12
+ self.elapsed_ns = 0
12
13
 
13
14
  super(Progress, self).__init__()
14
15
 
@@ -24,9 +25,14 @@ class Progress(object):
24
25
  self.written_rows = read_varint(fin)
25
26
  self.written_bytes = read_varint(fin)
26
27
 
28
+ if revision >= defines. \
29
+ DBMS_MIN_PROTOCOL_VERSION_WITH_SERVER_QUERY_TIME_IN_PROGRESS:
30
+ self.elapsed_ns = read_varint(fin)
31
+
27
32
  def increment(self, another_progress):
28
33
  self.rows += another_progress.rows
29
34
  self.bytes += another_progress.bytes
30
35
  self.total_rows += another_progress.total_rows
31
36
  self.written_rows += another_progress.written_rows
32
37
  self.written_bytes += another_progress.written_bytes
38
+ self.elapsed_ns += another_progress.elapsed_ns
Binary file
@@ -1,201 +1,201 @@
1
- Metadata-Version: 2.1
2
- Name: clickhouse-driver
3
- Version: 0.2.6
4
- Summary: Python driver with native interface for ClickHouse
5
- Home-page: https://github.com/mymarilyn/clickhouse-driver
6
- Author: Konstantin Lebedev
7
- Author-email: kostyan.lebedev@gmail.com
8
- License: MIT
9
- Project-URL: Documentation, https://clickhouse-driver.readthedocs.io
10
- Project-URL: Changes, https://github.com/mymarilyn/clickhouse-driver/blob/master/CHANGELOG.md
11
- Keywords: ClickHouse db database cloud analytics
12
- Classifier: Development Status :: 4 - Beta
13
- Classifier: Environment :: Console
14
- Classifier: Intended Audience :: Developers
15
- Classifier: Intended Audience :: Information Technology
16
- Classifier: License :: OSI Approved :: MIT License
17
- Classifier: Operating System :: OS Independent
18
- Classifier: Programming Language :: SQL
19
- Classifier: Programming Language :: Python :: 3
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
25
- Classifier: Programming Language :: Python :: Implementation :: PyPy
26
- Classifier: Topic :: Database
27
- Classifier: Topic :: Software Development
28
- Classifier: Topic :: Software Development :: Libraries
29
- Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
30
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
31
- Classifier: Topic :: Scientific/Engineering :: Information Analysis
32
- Requires-Python: >=3.7, <4
33
- License-File: LICENSE
34
- Requires-Dist: pytz
35
- Requires-Dist: tzlocal
36
- Provides-Extra: lz4
37
- Requires-Dist: clickhouse-cityhash (>=1.0.2.1) ; extra == 'lz4'
38
- Requires-Dist: lz4 ; (implementation_name != "pypy") and extra == 'lz4'
39
- Requires-Dist: lz4 (<=3.0.1) ; (implementation_name == "pypy") and extra == 'lz4'
40
- Provides-Extra: numpy
41
- Requires-Dist: numpy (>=1.12.0) ; extra == 'numpy'
42
- Requires-Dist: pandas (>=0.24.0) ; extra == 'numpy'
43
- Provides-Extra: zstd
44
- Requires-Dist: zstd ; extra == 'zstd'
45
- Requires-Dist: clickhouse-cityhash (>=1.0.2.1) ; extra == 'zstd'
46
-
47
- ClickHouse Python Driver
48
- ========================
49
-
50
- .. image:: https://img.shields.io/pypi/v/clickhouse-driver.svg
51
- :target: https://pypi.org/project/clickhouse-driver
52
-
53
- .. image:: https://coveralls.io/repos/github/mymarilyn/clickhouse-driver/badge.svg?branch=master
54
- :target: https://coveralls.io/github/mymarilyn/clickhouse-driver?branch=master
55
-
56
- .. image:: https://img.shields.io/pypi/l/clickhouse-driver.svg
57
- :target: https://pypi.org/project/clickhouse-driver
58
-
59
- .. image:: https://img.shields.io/pypi/pyversions/clickhouse-driver.svg
60
- :target: https://pypi.org/project/clickhouse-driver
61
-
62
- .. image:: https://img.shields.io/pypi/dm/clickhouse-driver.svg
63
- :target: https://pypi.org/project/clickhouse-driver
64
-
65
- .. image:: https://github.com/mymarilyn/clickhouse-driver/actions/workflows/actions.yml/badge.svg
66
- :target: https://github.com/mymarilyn/clickhouse-driver/actions/workflows/actions.yml
67
-
68
- ClickHouse Python Driver with native (TCP) interface support.
69
-
70
- Asynchronous wrapper is available here: https://github.com/mymarilyn/aioch
71
-
72
- Features
73
- ========
74
-
75
- - External data for query processing.
76
-
77
- - Query settings.
78
-
79
- - Compression support.
80
-
81
- - TLS support.
82
-
83
- - Types support:
84
-
85
- * Float32/64
86
- * [U]Int8/16/32/64/128/256
87
- * Date/Date32/DateTime('timezone')/DateTime64('timezone')
88
- * String/FixedString(N)
89
- * Enum8/16
90
- * Array(T)
91
- * Nullable(T)
92
- * Bool
93
- * UUID
94
- * Decimal
95
- * IPv4/IPv6
96
- * LowCardinality(T)
97
- * SimpleAggregateFunction(F, T)
98
- * Tuple(T1, T2, ...)
99
- * Nested
100
- * Map(key, value)
101
-
102
- - Query progress information.
103
-
104
- - Block by block results streaming.
105
-
106
- - Reading query profile info.
107
-
108
- - Receiving server logs.
109
-
110
- - Multiple hosts support.
111
-
112
- - Python DB API 2.0 specification support.
113
-
114
- - Optional NumPy arrays support.
115
-
116
- Documentation
117
- =============
118
-
119
- Documentation is available at https://clickhouse-driver.readthedocs.io.
120
-
121
- Usage
122
- =====
123
-
124
- There are two ways to communicate with server:
125
-
126
- - using pure Client;
127
- - using DB API.
128
-
129
- Pure Client example:
130
-
131
- .. code-block:: python
132
-
133
- >>> from clickhouse_driver import Client
134
- >>>
135
- >>> client = Client('localhost')
136
- >>>
137
- >>> client.execute('SHOW TABLES')
138
- [('test',)]
139
- >>> client.execute('DROP TABLE IF EXISTS test')
140
- []
141
- >>> client.execute('CREATE TABLE test (x Int32) ENGINE = Memory')
142
- []
143
- >>> client.execute(
144
- ... 'INSERT INTO test (x) VALUES',
145
- ... [{'x': 100}]
146
- ... )
147
- 1
148
- >>> client.execute('INSERT INTO test (x) VALUES', [[200]])
149
- 1
150
- >>> client.execute(
151
- ... 'INSERT INTO test (x) '
152
- ... 'SELECT * FROM system.numbers LIMIT %(limit)s',
153
- ... {'limit': 3}
154
- ... )
155
- []
156
- >>> client.execute('SELECT sum(x) FROM test')
157
- [(303,)]
158
-
159
- DB API example:
160
-
161
- .. code-block:: python
162
-
163
- >>> from clickhouse_driver import connect
164
- >>>
165
- >>> conn = connect('clickhouse://localhost')
166
- >>> cursor = conn.cursor()
167
- >>>
168
- >>> cursor.execute('SHOW TABLES')
169
- >>> cursor.fetchall()
170
- [('test',)]
171
- >>> cursor.execute('DROP TABLE IF EXISTS test')
172
- >>> cursor.fetchall()
173
- []
174
- >>> cursor.execute('CREATE TABLE test (x Int32) ENGINE = Memory')
175
- >>> cursor.fetchall()
176
- []
177
- >>> cursor.executemany(
178
- ... 'INSERT INTO test (x) VALUES',
179
- ... [{'x': 100}]
180
- ... )
181
- >>> cursor.rowcount
182
- 1
183
- >>> cursor.executemany('INSERT INTO test (x) VALUES', [[200]])
184
- >>> cursor.rowcount
185
- 1
186
- >>> cursor.execute(
187
- ... 'INSERT INTO test (x) '
188
- ... 'SELECT * FROM system.numbers LIMIT %(limit)s',
189
- ... {'limit': 3}
190
- ... )
191
- >>> cursor.rowcount
192
- 0
193
- >>> cursor.execute('SELECT sum(x) FROM test')
194
- >>> cursor.fetchall()
195
- [(303,)]
196
-
197
- License
198
- =======
199
-
200
- ClickHouse Python Driver is distributed under the `MIT license
201
- <http://www.opensource.org/licenses/mit-license.php>`_.
1
+ Metadata-Version: 2.1
2
+ Name: clickhouse-driver
3
+ Version: 0.2.7
4
+ Summary: Python driver with native interface for ClickHouse
5
+ Home-page: https://github.com/mymarilyn/clickhouse-driver
6
+ Author: Konstantin Lebedev
7
+ Author-email: kostyan.lebedev@gmail.com
8
+ License: MIT
9
+ Project-URL: Documentation, https://clickhouse-driver.readthedocs.io
10
+ Project-URL: Changes, https://github.com/mymarilyn/clickhouse-driver/blob/master/CHANGELOG.md
11
+ Keywords: ClickHouse db database cloud analytics
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Information Technology
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: SQL
19
+ Classifier: Programming Language :: Python :: 3
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
25
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
26
+ Classifier: Topic :: Database
27
+ Classifier: Topic :: Software Development
28
+ Classifier: Topic :: Software Development :: Libraries
29
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
30
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
31
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
32
+ Requires-Python: >=3.7, <4
33
+ License-File: LICENSE
34
+ Requires-Dist: pytz
35
+ Requires-Dist: tzlocal
36
+ Provides-Extra: lz4
37
+ Requires-Dist: clickhouse-cityhash >=1.0.2.1 ; extra == 'lz4'
38
+ Requires-Dist: lz4 ; (implementation_name != "pypy") and extra == 'lz4'
39
+ Requires-Dist: lz4 <=3.0.1 ; (implementation_name == "pypy") and extra == 'lz4'
40
+ Provides-Extra: numpy
41
+ Requires-Dist: numpy >=1.12.0 ; extra == 'numpy'
42
+ Requires-Dist: pandas >=0.24.0 ; extra == 'numpy'
43
+ Provides-Extra: zstd
44
+ Requires-Dist: zstd ; extra == 'zstd'
45
+ Requires-Dist: clickhouse-cityhash >=1.0.2.1 ; extra == 'zstd'
46
+
47
+ ClickHouse Python Driver
48
+ ========================
49
+
50
+ .. image:: https://img.shields.io/pypi/v/clickhouse-driver.svg
51
+ :target: https://pypi.org/project/clickhouse-driver
52
+
53
+ .. image:: https://coveralls.io/repos/github/mymarilyn/clickhouse-driver/badge.svg?branch=master
54
+ :target: https://coveralls.io/github/mymarilyn/clickhouse-driver?branch=master
55
+
56
+ .. image:: https://img.shields.io/pypi/l/clickhouse-driver.svg
57
+ :target: https://pypi.org/project/clickhouse-driver
58
+
59
+ .. image:: https://img.shields.io/pypi/pyversions/clickhouse-driver.svg
60
+ :target: https://pypi.org/project/clickhouse-driver
61
+
62
+ .. image:: https://img.shields.io/pypi/dm/clickhouse-driver.svg
63
+ :target: https://pypi.org/project/clickhouse-driver
64
+
65
+ .. image:: https://github.com/mymarilyn/clickhouse-driver/actions/workflows/actions.yml/badge.svg
66
+ :target: https://github.com/mymarilyn/clickhouse-driver/actions/workflows/actions.yml
67
+
68
+ ClickHouse Python Driver with native (TCP) interface support.
69
+
70
+ Asynchronous wrapper is available here: https://github.com/mymarilyn/aioch
71
+
72
+ Features
73
+ ========
74
+
75
+ - External data for query processing.
76
+
77
+ - Query settings.
78
+
79
+ - Compression support.
80
+
81
+ - TLS support.
82
+
83
+ - Types support:
84
+
85
+ * Float32/64
86
+ * [U]Int8/16/32/64/128/256
87
+ * Date/Date32/DateTime('timezone')/DateTime64('timezone')
88
+ * String/FixedString(N)
89
+ * Enum8/16
90
+ * Array(T)
91
+ * Nullable(T)
92
+ * Bool
93
+ * UUID
94
+ * Decimal
95
+ * IPv4/IPv6
96
+ * LowCardinality(T)
97
+ * SimpleAggregateFunction(F, T)
98
+ * Tuple(T1, T2, ...)
99
+ * Nested
100
+ * Map(key, value)
101
+
102
+ - Query progress information.
103
+
104
+ - Block by block results streaming.
105
+
106
+ - Reading query profile info.
107
+
108
+ - Receiving server logs.
109
+
110
+ - Multiple hosts support.
111
+
112
+ - Python DB API 2.0 specification support.
113
+
114
+ - Optional NumPy arrays support.
115
+
116
+ Documentation
117
+ =============
118
+
119
+ Documentation is available at https://clickhouse-driver.readthedocs.io.
120
+
121
+ Usage
122
+ =====
123
+
124
+ There are two ways to communicate with server:
125
+
126
+ - using pure Client;
127
+ - using DB API.
128
+
129
+ Pure Client example:
130
+
131
+ .. code-block:: python
132
+
133
+ >>> from clickhouse_driver import Client
134
+ >>>
135
+ >>> client = Client('localhost')
136
+ >>>
137
+ >>> client.execute('SHOW TABLES')
138
+ [('test',)]
139
+ >>> client.execute('DROP TABLE IF EXISTS test')
140
+ []
141
+ >>> client.execute('CREATE TABLE test (x Int32) ENGINE = Memory')
142
+ []
143
+ >>> client.execute(
144
+ ... 'INSERT INTO test (x) VALUES',
145
+ ... [{'x': 100}]
146
+ ... )
147
+ 1
148
+ >>> client.execute('INSERT INTO test (x) VALUES', [[200]])
149
+ 1
150
+ >>> client.execute(
151
+ ... 'INSERT INTO test (x) '
152
+ ... 'SELECT * FROM system.numbers LIMIT %(limit)s',
153
+ ... {'limit': 3}
154
+ ... )
155
+ []
156
+ >>> client.execute('SELECT sum(x) FROM test')
157
+ [(303,)]
158
+
159
+ DB API example:
160
+
161
+ .. code-block:: python
162
+
163
+ >>> from clickhouse_driver import connect
164
+ >>>
165
+ >>> conn = connect('clickhouse://localhost')
166
+ >>> cursor = conn.cursor()
167
+ >>>
168
+ >>> cursor.execute('SHOW TABLES')
169
+ >>> cursor.fetchall()
170
+ [('test',)]
171
+ >>> cursor.execute('DROP TABLE IF EXISTS test')
172
+ >>> cursor.fetchall()
173
+ []
174
+ >>> cursor.execute('CREATE TABLE test (x Int32) ENGINE = Memory')
175
+ >>> cursor.fetchall()
176
+ []
177
+ >>> cursor.executemany(
178
+ ... 'INSERT INTO test (x) VALUES',
179
+ ... [{'x': 100}]
180
+ ... )
181
+ >>> cursor.rowcount
182
+ 1
183
+ >>> cursor.executemany('INSERT INTO test (x) VALUES', [[200]])
184
+ >>> cursor.rowcount
185
+ 1
186
+ >>> cursor.execute(
187
+ ... 'INSERT INTO test (x) '
188
+ ... 'SELECT * FROM system.numbers LIMIT %(limit)s',
189
+ ... {'limit': 3}
190
+ ... )
191
+ >>> cursor.rowcount
192
+ 0
193
+ >>> cursor.execute('SELECT sum(x) FROM test')
194
+ >>> cursor.fetchall()
195
+ [(303,)]
196
+
197
+ License
198
+ =======
199
+
200
+ ClickHouse Python Driver is distributed under the `MIT license
201
+ <http://www.opensource.org/licenses/mit-license.php>`_.
@@ -1,29 +1,29 @@
1
- clickhouse_driver/__init__.py,sha256=QRMXgeBnkcW_DpTqqIh29_xG072_EPoTyLy-1ik1MP0,158
1
+ clickhouse_driver/__init__.py,sha256=Zc8GO1dmRR77BGXAzQx9tuX5pBumMtqQzQ4SH3xmBfU,158
2
2
  clickhouse_driver/block.py,sha256=t2zZhtCzwp4aJj0CuDqXlDEgHXgwc6GRsIks2aaIZvI,6311
3
3
  clickhouse_driver/blockstreamprofileinfo.py,sha256=nYx9QXWAS8aPiRbtAzwLRT5JIlJ8S103JMkudncwpFg,712
4
- clickhouse_driver/bufferedreader.cp311-win32.pyd,sha256=ZNn9tr_UfgmcIvMwGNwo2zLY5wMvH2wIeKqSy6pWCTM,58880
5
- clickhouse_driver/bufferedwriter.cp311-win32.pyd,sha256=rp0PhQSMM4uNmPmdaUqnT6OwiSWNl-LgutytZU04nrc,59392
6
- clickhouse_driver/client.py,sha256=c0IyAj5wxiHZgJLbFXvZm6ym5DIg1UXgPIsM2xuR3Mo,31798
4
+ clickhouse_driver/bufferedreader.cp311-win32.pyd,sha256=0-rJtsw2Mg-y-VJLpOXI-wELbhzIXztZO4sN_5eMiAQ,82944
5
+ clickhouse_driver/bufferedwriter.cp311-win32.pyd,sha256=Cl2UI4LTBY_r4JzCt1vRw9EKR2cuACmOcf8CB4Yf0U0,82944
6
+ clickhouse_driver/client.py,sha256=Zk_gnfqOSz1_3uaTsBLtOHNGX0rsiklJUPpk-1aqnXQ,34707
7
7
  clickhouse_driver/clientinfo.py,sha256=Tw3NbuDHglT6_f0AcT0IdhqW_hVePtzh9pypx5nk5ZE,4260
8
- clickhouse_driver/connection.py,sha256=DTw_NofAVNS5spk5E0G-BkX-0H4gp3LZEJ59nmW8WZc,27679
8
+ clickhouse_driver/connection.py,sha256=Lzx6bjPDEZleEtFaede4_BcRmALIbJyQLymSmj7zAHY,28399
9
9
  clickhouse_driver/context.py,sha256=yPkJ_BN4LGODvKCOjNlDGqABwxAMQTQl7w1vIGRPBDg,909
10
- clickhouse_driver/defines.py,sha256=jM3nFdT4EPUIIj1add1BOu7T9DJv_-UOzfdbX6k3uEk,1704
10
+ clickhouse_driver/defines.py,sha256=hXIR10BvH_sxUN35pk-f-VeIbM7CA0Ll2B2yNuAy10A,1958
11
11
  clickhouse_driver/errors.py,sha256=mffBg-Y2LFOSRzvE9V34RwFcvmfh67yqLeEBhrdjeXE,14343
12
- clickhouse_driver/log.py,sha256=VLeOYXn5DW2hJ53m2w5bPsMrWG5cWnq5whE4e6euK_M,888
12
+ clickhouse_driver/log.py,sha256=P9VS_YDY3a4JQsNOeUNNK0L1AAallTC1GF4FG5gCrac,1091
13
13
  clickhouse_driver/opentelemetry.py,sha256=GIzHCxdB8LB1ozXtUjIpxsdznmRABAts64G2u2l4C_A,1622
14
- clickhouse_driver/progress.py,sha256=aQUPzOg0S1kRthV1aYo-KsTmlcdM0uXVZDLDtoyKSUY,1045
14
+ clickhouse_driver/progress.py,sha256=MagDPiLzWG-2Arecu5O6JlK98242ayt9yPa9H7v9o5k,1288
15
15
  clickhouse_driver/protocol.py,sha256=ZRJuawN_v8wXFrHrcpSiBqu7idKsPd3tQnCcDuTlIw8,2561
16
16
  clickhouse_driver/queryprocessingstage.py,sha256=lbV-bB5jWUp0hqYBTsUcRYkJhCgCTfN2G21AykMoAp0,186
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.cp311-win32.pyd,sha256=kqEDS8fKaeTatZwfniN5fOGj_4ii_LvD4vdz421Ht28,21504
20
+ clickhouse_driver/varint.cp311-win32.pyd,sha256=KraGjAjFuAJrbpKWLAPeMnuTGpO0F6yIrUW8r1l8wps,32256
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
24
24
  clickhouse_driver/columns/base.py,sha256=jRThD8Ol7gwNy3x0M7vvslkm0RDOsCLJqKGf0arsa0w,6504
25
25
  clickhouse_driver/columns/boolcolumn.py,sha256=QgVCqbZWoFD1yvpppc92iiXIzReCVEh692efNSNH4UE,127
26
- clickhouse_driver/columns/datecolumn.py,sha256=Xg6qHb7Lj5twtMa0jL74qoffgYMt2gK_AY9mycRxBqQ,1931
26
+ clickhouse_driver/columns/datecolumn.py,sha256=FzgS5ayxW6zfyM5qD1NXXiR4PTKz0tXEC48TwtQvbyI,1929
27
27
  clickhouse_driver/columns/datetimecolumn.py,sha256=pO8g1exACp6EfUO0prra5X3T_gg1MJ8bSoi5Rt2Vxjg,6691
28
28
  clickhouse_driver/columns/decimalcolumn.py,sha256=MBczjN6AtI0jgbVTNguwVE7ZdWql0XuMl-QohxV-sN0,3450
29
29
  clickhouse_driver/columns/enumcolumn.py,sha256=GCSW-fjtJC4_5YKo9oKtG8GT9UhLcRWCjrBVhEAUp-A,3219
@@ -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.cp311-win32.pyd,sha256=EN5xh0RIOTBuR6qE8n-AFyfO9eT47v83Sxc7r_D4mjE,39424
36
+ clickhouse_driver/columns/largeint.cp311-win32.pyd,sha256=PlMuWugzWGzsqY1cALUcrjp3M3WreIs4EyBY9-zry-s,52736
37
37
  clickhouse_driver/columns/lowcardinalitycolumn.py,sha256=vMlhYYUPNmFhQiUAS77pE25KjI8TrO6ySz6w0ByBdZQ,4920
38
38
  clickhouse_driver/columns/mapcolumn.py,sha256=tKr9R0JvW1_7ExKs7XfRhHI6Z6UgBW76A0jaCMM_TLk,2084
39
39
  clickhouse_driver/columns/nestedcolumn.py,sha256=7x3xNYR22kEmgV4_3rPVZea2zCTU364O1tlOewMgw3M,303
@@ -45,7 +45,7 @@ clickhouse_driver/columns/simpleaggregatefunctioncolumn.py,sha256=zDWBd_Hc7AktHF
45
45
  clickhouse_driver/columns/stringcolumn.py,sha256=C-l7HaReg9AcJGQvgpSH07aV-CZMBP1jKArPHZi8Q2k,2059
46
46
  clickhouse_driver/columns/tuplecolumn.py,sha256=DnwtEwVXzm-YyL5-cPe9MiOLOoTEcDhcYeBY6SuuZZQ,2040
47
47
  clickhouse_driver/columns/util.py,sha256=5DRGBsWSTldqZRZJ53J85zh_jepkwkAsYXhAeDJQW4I,1395
48
- clickhouse_driver/columns/uuidcolumn.py,sha256=d-dR_CIgtQd-CzCO90HJoeR86j7ejVchOnAKu73rVoQ,1823
48
+ clickhouse_driver/columns/uuidcolumn.py,sha256=7CLPxsHJtV6Zt9jxILSkE0LAwffloLmrjjbwCZH34mA,1865
49
49
  clickhouse_driver/columns/numpy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
50
  clickhouse_driver/columns/numpy/base.py,sha256=Wk1ADpoQGWQv5X8sWi0esA2jmQGEoDakXZxImuYM2eM,1410
51
51
  clickhouse_driver/columns/numpy/boolcolumn.py,sha256=0_RwEroY2-ZqMuxKeTNG27ZCWN_y9BxYZzbuFKeqoQg,140
@@ -82,8 +82,8 @@ clickhouse_driver/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
82
82
  clickhouse_driver/util/compat.py,sha256=wIB_6ULSapKx-Fi64lZ0YJ-TtWOQXePHE90wZopIM1I,876
83
83
  clickhouse_driver/util/escape.py,sha256=4RPfNzC5IvatoZB9llmJM4436XArCXQDEqT_cqdwCBk,2256
84
84
  clickhouse_driver/util/helpers.py,sha256=1oLkkkILXZnEbdjAe2Ags-Y-T-Bq9rk94W6edh-1ZLU,1448
85
- clickhouse_driver-0.2.6.dist-info/LICENSE,sha256=b2SjNa4zGQk6XzJwmeE1dQjjtWRvX_zxJIAl_ZbN_S8,1143
86
- clickhouse_driver-0.2.6.dist-info/METADATA,sha256=zbQaiQr4hkzP8Zhce0EIpgAEfKgD7YuYQvtdrerVFvk,6099
87
- clickhouse_driver-0.2.6.dist-info/WHEEL,sha256=ZFq5jXtyqHWnKeYLzD3mUo8rAiNhy_FNqiMNKNc1pHA,98
88
- clickhouse_driver-0.2.6.dist-info/top_level.txt,sha256=PrE0Lrs4d-gRQwzABaABfym9Qvr4nN6uTrDy6Q7zQME,18
89
- clickhouse_driver-0.2.6.dist-info/RECORD,,
85
+ clickhouse_driver-0.2.7.dist-info/LICENSE,sha256=b2SjNa4zGQk6XzJwmeE1dQjjtWRvX_zxJIAl_ZbN_S8,1143
86
+ clickhouse_driver-0.2.7.dist-info/METADATA,sha256=nm1U-XpLBm_B8vyg_AS7v8GFDNOkjKLo0cCR_U06VFk,6290
87
+ clickhouse_driver-0.2.7.dist-info/WHEEL,sha256=1hQMSMLa8wpOIN866ksgBSFaZ-xM7VQgzYiKWe8vFok,98
88
+ clickhouse_driver-0.2.7.dist-info/top_level.txt,sha256=PrE0Lrs4d-gRQwzABaABfym9Qvr4nN6uTrDy6Q7zQME,18
89
+ clickhouse_driver-0.2.7.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.37.1)
2
+ Generator: bdist_wheel (0.41.2)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp311-cp311-win32
5
5