clickhouse-driver 0.2.9__cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.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.
Files changed (89) hide show
  1. clickhouse_driver/__init__.py +9 -0
  2. clickhouse_driver/block.py +227 -0
  3. clickhouse_driver/blockstreamprofileinfo.py +22 -0
  4. clickhouse_driver/bufferedreader.cpython-311-powerpc64le-linux-gnu.so +0 -0
  5. clickhouse_driver/bufferedwriter.cpython-311-powerpc64le-linux-gnu.so +0 -0
  6. clickhouse_driver/client.py +812 -0
  7. clickhouse_driver/clientinfo.py +119 -0
  8. clickhouse_driver/columns/__init__.py +0 -0
  9. clickhouse_driver/columns/arraycolumn.py +161 -0
  10. clickhouse_driver/columns/base.py +221 -0
  11. clickhouse_driver/columns/boolcolumn.py +7 -0
  12. clickhouse_driver/columns/datecolumn.py +108 -0
  13. clickhouse_driver/columns/datetimecolumn.py +203 -0
  14. clickhouse_driver/columns/decimalcolumn.py +116 -0
  15. clickhouse_driver/columns/enumcolumn.py +129 -0
  16. clickhouse_driver/columns/exceptions.py +12 -0
  17. clickhouse_driver/columns/floatcolumn.py +34 -0
  18. clickhouse_driver/columns/intcolumn.py +157 -0
  19. clickhouse_driver/columns/intervalcolumn.py +33 -0
  20. clickhouse_driver/columns/ipcolumn.py +118 -0
  21. clickhouse_driver/columns/jsoncolumn.py +37 -0
  22. clickhouse_driver/columns/largeint.cpython-311-powerpc64le-linux-gnu.so +0 -0
  23. clickhouse_driver/columns/lowcardinalitycolumn.py +142 -0
  24. clickhouse_driver/columns/mapcolumn.py +73 -0
  25. clickhouse_driver/columns/nestedcolumn.py +10 -0
  26. clickhouse_driver/columns/nothingcolumn.py +13 -0
  27. clickhouse_driver/columns/nullablecolumn.py +7 -0
  28. clickhouse_driver/columns/nullcolumn.py +15 -0
  29. clickhouse_driver/columns/numpy/__init__.py +0 -0
  30. clickhouse_driver/columns/numpy/base.py +47 -0
  31. clickhouse_driver/columns/numpy/boolcolumn.py +8 -0
  32. clickhouse_driver/columns/numpy/datecolumn.py +19 -0
  33. clickhouse_driver/columns/numpy/datetimecolumn.py +146 -0
  34. clickhouse_driver/columns/numpy/floatcolumn.py +24 -0
  35. clickhouse_driver/columns/numpy/intcolumn.py +43 -0
  36. clickhouse_driver/columns/numpy/lowcardinalitycolumn.py +96 -0
  37. clickhouse_driver/columns/numpy/service.py +58 -0
  38. clickhouse_driver/columns/numpy/stringcolumn.py +78 -0
  39. clickhouse_driver/columns/numpy/tuplecolumn.py +37 -0
  40. clickhouse_driver/columns/service.py +185 -0
  41. clickhouse_driver/columns/simpleaggregatefunctioncolumn.py +7 -0
  42. clickhouse_driver/columns/stringcolumn.py +73 -0
  43. clickhouse_driver/columns/tuplecolumn.py +63 -0
  44. clickhouse_driver/columns/util.py +61 -0
  45. clickhouse_driver/columns/uuidcolumn.py +64 -0
  46. clickhouse_driver/compression/__init__.py +28 -0
  47. clickhouse_driver/compression/base.py +87 -0
  48. clickhouse_driver/compression/lz4.py +21 -0
  49. clickhouse_driver/compression/lz4hc.py +9 -0
  50. clickhouse_driver/compression/zstd.py +20 -0
  51. clickhouse_driver/connection.py +793 -0
  52. clickhouse_driver/context.py +36 -0
  53. clickhouse_driver/dbapi/__init__.py +62 -0
  54. clickhouse_driver/dbapi/connection.py +99 -0
  55. clickhouse_driver/dbapi/cursor.py +370 -0
  56. clickhouse_driver/dbapi/errors.py +40 -0
  57. clickhouse_driver/dbapi/extras.py +73 -0
  58. clickhouse_driver/defines.py +58 -0
  59. clickhouse_driver/errors.py +453 -0
  60. clickhouse_driver/log.py +48 -0
  61. clickhouse_driver/numpy/__init__.py +0 -0
  62. clickhouse_driver/numpy/block.py +8 -0
  63. clickhouse_driver/numpy/helpers.py +28 -0
  64. clickhouse_driver/numpy/result.py +123 -0
  65. clickhouse_driver/opentelemetry.py +43 -0
  66. clickhouse_driver/progress.py +44 -0
  67. clickhouse_driver/protocol.py +130 -0
  68. clickhouse_driver/queryprocessingstage.py +8 -0
  69. clickhouse_driver/reader.py +69 -0
  70. clickhouse_driver/readhelpers.py +26 -0
  71. clickhouse_driver/result.py +144 -0
  72. clickhouse_driver/settings/__init__.py +0 -0
  73. clickhouse_driver/settings/available.py +405 -0
  74. clickhouse_driver/settings/types.py +50 -0
  75. clickhouse_driver/settings/writer.py +34 -0
  76. clickhouse_driver/streams/__init__.py +0 -0
  77. clickhouse_driver/streams/compressed.py +88 -0
  78. clickhouse_driver/streams/native.py +108 -0
  79. clickhouse_driver/util/__init__.py +0 -0
  80. clickhouse_driver/util/compat.py +39 -0
  81. clickhouse_driver/util/escape.py +94 -0
  82. clickhouse_driver/util/helpers.py +171 -0
  83. clickhouse_driver/varint.cpython-311-powerpc64le-linux-gnu.so +0 -0
  84. clickhouse_driver/writer.py +67 -0
  85. clickhouse_driver-0.2.9.dist-info/LICENSE +21 -0
  86. clickhouse_driver-0.2.9.dist-info/METADATA +202 -0
  87. clickhouse_driver-0.2.9.dist-info/RECORD +89 -0
  88. clickhouse_driver-0.2.9.dist-info/WHEEL +6 -0
  89. clickhouse_driver-0.2.9.dist-info/top_level.txt +1 -0
@@ -0,0 +1,39 @@
1
+
2
+ # Drop this when minimum supported version will be 3.7.
3
+ try:
4
+ import threading
5
+ except ImportError:
6
+ import dummy_threading as threading # noqa: F401
7
+
8
+ import json # noqa: F401
9
+ try:
10
+ import orjson as json # noqa: F811
11
+ except ImportError:
12
+ pass
13
+
14
+ try:
15
+ import ujson as json # noqa: F811,F401
16
+ except ImportError:
17
+ pass
18
+
19
+
20
+ try:
21
+ # since tzlocal 4.0+
22
+ # this will avoid warning for get_localzone().key
23
+ from tzlocal import get_localzone_name
24
+
25
+ def get_localzone_name_compat():
26
+ try:
27
+ return get_localzone_name()
28
+ except Exception:
29
+ return None
30
+ except ImportError:
31
+ from tzlocal import get_localzone
32
+
33
+ def get_localzone_name_compat():
34
+ try:
35
+ return get_localzone().key
36
+ except AttributeError:
37
+ return get_localzone().zone
38
+ except Exception:
39
+ return None
@@ -0,0 +1,94 @@
1
+ from datetime import date, datetime, time
2
+ from enum import Enum
3
+ from functools import wraps
4
+ from uuid import UUID
5
+
6
+ from pytz import timezone
7
+
8
+
9
+ escape_chars_map = {
10
+ "\b": "\\b",
11
+ "\f": "\\f",
12
+ "\r": "\\r",
13
+ "\n": "\\n",
14
+ "\t": "\\t",
15
+ "\0": "\\0",
16
+ "\a": "\\a",
17
+ "\v": "\\v",
18
+ "\\": "\\\\",
19
+ "'": "\\'"
20
+ }
21
+
22
+
23
+ def escape_datetime(item, context):
24
+ server_tz = timezone(context.server_info.get_timezone())
25
+
26
+ if item.tzinfo is not None:
27
+ item = item.astimezone(server_tz)
28
+
29
+ return "'%s'" % item.strftime('%Y-%m-%d %H:%M:%S')
30
+
31
+
32
+ def maybe_enquote_for_server(f):
33
+ @wraps(f)
34
+ def wrapper(*args, **kwargs):
35
+ rv = f(*args, **kwargs)
36
+
37
+ if kwargs.get('for_server'):
38
+ is_str = isinstance(rv, str)
39
+
40
+ if not is_str or (is_str and not rv.startswith("'")):
41
+ rv = "'%s'" % rv
42
+
43
+ return rv
44
+
45
+ return wrapper
46
+
47
+
48
+ @maybe_enquote_for_server
49
+ def escape_param(item, context, for_server=False):
50
+ if item is None:
51
+ return 'NULL'
52
+
53
+ elif isinstance(item, datetime):
54
+ return escape_datetime(item, context)
55
+
56
+ elif isinstance(item, date):
57
+ return "'%s'" % item.strftime('%Y-%m-%d')
58
+
59
+ elif isinstance(item, time):
60
+ return "'%s'" % item.strftime('%H:%M:%S')
61
+
62
+ elif isinstance(item, str):
63
+ # We need double escaping for server-side parameters.
64
+ if for_server:
65
+ item = ''.join(escape_chars_map.get(c, c) for c in item)
66
+ return "'%s'" % ''.join(escape_chars_map.get(c, c) for c in item)
67
+
68
+ elif isinstance(item, list):
69
+ return "[%s]" % ', '.join(
70
+ str(escape_param(x, context, for_server=for_server)) for x in item
71
+ )
72
+
73
+ elif isinstance(item, tuple):
74
+ return "(%s)" % ', '.join(
75
+ str(escape_param(x, context, for_server=for_server)) for x in item
76
+ )
77
+
78
+ elif isinstance(item, Enum):
79
+ return escape_param(item.value, context, for_server=for_server)
80
+
81
+ elif isinstance(item, UUID):
82
+ return "'%s'" % str(item)
83
+
84
+ else:
85
+ return item
86
+
87
+
88
+ def escape_params(params, context, for_server=False):
89
+ escaped = {}
90
+
91
+ for key, value in params.items():
92
+ escaped[key] = escape_param(value, context, for_server=for_server)
93
+
94
+ return escaped
@@ -0,0 +1,171 @@
1
+ import ssl
2
+ from itertools import islice, tee
3
+ from urllib.parse import urlparse, parse_qs, unquote
4
+
5
+
6
+ def chunks(seq, n):
7
+ # islice is MUCH slower than slice for lists and tuples.
8
+ if isinstance(seq, (list, tuple)):
9
+ i = 0
10
+ item = seq[i:i+n]
11
+ while item:
12
+ yield list(item)
13
+ i += n
14
+ item = seq[i:i+n]
15
+
16
+ else:
17
+ it = iter(seq)
18
+ item = list(islice(it, n))
19
+ while item:
20
+ yield item
21
+ item = list(islice(it, n))
22
+
23
+
24
+ def pairwise(iterable):
25
+ a, b = tee(iterable)
26
+ next(b, None)
27
+ return zip(a, b)
28
+
29
+
30
+ def column_chunks(columns, n):
31
+ for column in columns:
32
+ if not isinstance(column, (list, tuple)):
33
+ raise TypeError(
34
+ 'Unsupported column type: {}. list or tuple is expected.'
35
+ .format(type(column))
36
+ )
37
+
38
+ # create chunk generator for every column
39
+ g = [chunks(column, n) for column in columns]
40
+
41
+ while True:
42
+ # get next chunk for every column
43
+ item = [next(column, []) for column in g]
44
+ if not any(item):
45
+ break
46
+ yield item
47
+
48
+
49
+ # from paste.deploy.converters
50
+ def asbool(obj):
51
+ if isinstance(obj, str):
52
+ obj = obj.strip().lower()
53
+ if obj in ['true', 'yes', 'on', 'y', 't', '1']:
54
+ return True
55
+ elif obj in ['false', 'no', 'off', 'n', 'f', '0']:
56
+ return False
57
+ else:
58
+ raise ValueError('String is not true/false: %r' % obj)
59
+ return bool(obj)
60
+
61
+
62
+ def parse_url(url):
63
+ """
64
+ Parses url into host and kwargs suitable for further Client construction.
65
+ Return host and kwargs.
66
+
67
+ For example::
68
+
69
+ clickhouse://[user:password]@localhost:9000/default
70
+ clickhouses://[user:password]@localhost:9440/default
71
+
72
+ Three URL schemes are supported:
73
+
74
+ * clickhouse:// creates a normal TCP socket connection
75
+ * clickhouses:// creates a SSL wrapped TCP socket connection
76
+
77
+ Any additional querystring arguments will be passed along to
78
+ the Connection class's initializer.
79
+ """
80
+ url = urlparse(url)
81
+
82
+ settings = {}
83
+ kwargs = {}
84
+
85
+ host = url.hostname
86
+
87
+ if url.port is not None:
88
+ kwargs['port'] = url.port
89
+
90
+ path = url.path.replace('/', '', 1)
91
+ if path:
92
+ kwargs['database'] = path
93
+
94
+ if url.username is not None:
95
+ kwargs['user'] = unquote(url.username)
96
+
97
+ if url.password is not None:
98
+ kwargs['password'] = unquote(url.password)
99
+
100
+ if url.scheme == 'clickhouses':
101
+ kwargs['secure'] = True
102
+
103
+ compression_algs = {'lz4', 'lz4hc', 'zstd'}
104
+ timeouts = {
105
+ 'connect_timeout',
106
+ 'send_receive_timeout',
107
+ 'sync_request_timeout'
108
+ }
109
+
110
+ for name, value in parse_qs(url.query).items():
111
+ if not value or not len(value):
112
+ continue
113
+
114
+ value = value[0]
115
+
116
+ if name == 'compression':
117
+ value = value.lower()
118
+ if value in compression_algs:
119
+ kwargs[name] = value
120
+ else:
121
+ kwargs[name] = asbool(value)
122
+
123
+ elif name == 'secure':
124
+ kwargs[name] = asbool(value)
125
+
126
+ elif name == 'use_numpy':
127
+ settings[name] = asbool(value)
128
+
129
+ elif name == 'round_robin':
130
+ kwargs[name] = asbool(value)
131
+
132
+ elif name == 'client_name':
133
+ kwargs[name] = value
134
+
135
+ elif name in timeouts:
136
+ kwargs[name] = float(value)
137
+
138
+ elif name == 'compress_block_size':
139
+ kwargs[name] = int(value)
140
+
141
+ elif name == 'settings_is_important':
142
+ kwargs[name] = asbool(value)
143
+
144
+ elif name == 'tcp_keepalive':
145
+ try:
146
+ kwargs[name] = asbool(value)
147
+ except ValueError:
148
+ parts = value.split(',')
149
+ kwargs[name] = (
150
+ int(parts[0]), int(parts[1]), int(parts[2])
151
+ )
152
+ elif name == 'client_revision':
153
+ kwargs[name] = int(value)
154
+
155
+ # ssl
156
+ elif name == 'verify':
157
+ kwargs[name] = asbool(value)
158
+ elif name == 'ssl_version':
159
+ kwargs[name] = getattr(ssl, value)
160
+ elif name in ['ca_certs', 'ciphers', 'keyfile', 'certfile',
161
+ 'server_hostname']:
162
+ kwargs[name] = value
163
+ elif name == 'alt_hosts':
164
+ kwargs['alt_hosts'] = value
165
+ else:
166
+ settings[name] = value
167
+
168
+ if settings:
169
+ kwargs['settings'] = settings
170
+
171
+ return host, kwargs
@@ -0,0 +1,67 @@
1
+ import struct
2
+
3
+ from .varint import write_varint
4
+
5
+
6
+ MAX_UINT64 = (1 << 64) - 1
7
+ MAX_INT64 = (1 << 63) - 1
8
+
9
+
10
+ def _byte(b):
11
+ return bytes((b, ))
12
+
13
+
14
+ def write_binary_str(text, buf):
15
+ text = text.encode('utf-8')
16
+ write_binary_bytes(text, buf)
17
+
18
+
19
+ def write_binary_bytes(text, buf):
20
+ write_varint(len(text), buf)
21
+ buf.write(text)
22
+
23
+
24
+ def write_binary_int(number, buf, fmt):
25
+ """
26
+ Writes int from buffer with provided format.
27
+ """
28
+ fmt = '<' + fmt
29
+ buf.write(struct.pack(fmt, number))
30
+
31
+
32
+ def write_binary_int8(number, buf):
33
+ write_binary_int(number, buf, 'b')
34
+
35
+
36
+ def write_binary_int16(number, buf):
37
+ write_binary_int(number, buf, 'h')
38
+
39
+
40
+ def write_binary_int32(number, buf):
41
+ write_binary_int(number, buf, 'i')
42
+
43
+
44
+ def write_binary_int64(number, buf):
45
+ write_binary_int(number, buf, 'q')
46
+
47
+
48
+ def write_binary_uint8(number, buf):
49
+ write_binary_int(number, buf, 'B')
50
+
51
+
52
+ def write_binary_uint16(number, buf):
53
+ write_binary_int(number, buf, 'H')
54
+
55
+
56
+ def write_binary_uint32(number, buf):
57
+ write_binary_int(number, buf, 'I')
58
+
59
+
60
+ def write_binary_uint64(number, buf):
61
+ write_binary_int(number, buf, 'Q')
62
+
63
+
64
+ def write_binary_uint128(number, buf):
65
+ fmt = '<QQ'
66
+ packed = struct.pack(fmt, (number >> 64) & MAX_UINT64, number & MAX_UINT64)
67
+ buf.write(packed)
@@ -0,0 +1,21 @@
1
+ This is the MIT license: http://www.opensource.org/licenses/mit-license.php
2
+
3
+ Copyright (c) 2017 by Konstantin Lebedev.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,202 @@
1
+ Metadata-Version: 2.1
2
+ Name: clickhouse-driver
3
+ Version: 0.2.9
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 :: 3.12
26
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
27
+ Classifier: Topic :: Database
28
+ Classifier: Topic :: Software Development
29
+ Classifier: Topic :: Software Development :: Libraries
30
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
31
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
32
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
33
+ Requires-Python: >=3.7, <4
34
+ License-File: LICENSE
35
+ Requires-Dist: pytz
36
+ Requires-Dist: tzlocal
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'
44
+ Provides-Extra: zstd
45
+ Requires-Dist: zstd ; extra == 'zstd'
46
+ Requires-Dist: clickhouse-cityhash >=1.0.2.1 ; extra == 'zstd'
47
+
48
+ ClickHouse Python Driver
49
+ ========================
50
+
51
+ .. image:: https://img.shields.io/pypi/v/clickhouse-driver.svg
52
+ :target: https://pypi.org/project/clickhouse-driver
53
+
54
+ .. image:: https://coveralls.io/repos/github/mymarilyn/clickhouse-driver/badge.svg?branch=master
55
+ :target: https://coveralls.io/github/mymarilyn/clickhouse-driver?branch=master
56
+
57
+ .. image:: https://img.shields.io/pypi/l/clickhouse-driver.svg
58
+ :target: https://pypi.org/project/clickhouse-driver
59
+
60
+ .. image:: https://img.shields.io/pypi/pyversions/clickhouse-driver.svg
61
+ :target: https://pypi.org/project/clickhouse-driver
62
+
63
+ .. image:: https://img.shields.io/pypi/dm/clickhouse-driver.svg
64
+ :target: https://pypi.org/project/clickhouse-driver
65
+
66
+ .. image:: https://github.com/mymarilyn/clickhouse-driver/actions/workflows/actions.yml/badge.svg
67
+ :target: https://github.com/mymarilyn/clickhouse-driver/actions/workflows/actions.yml
68
+
69
+ ClickHouse Python Driver with native (TCP) interface support.
70
+
71
+ Asynchronous wrapper is available here: https://github.com/mymarilyn/aioch
72
+
73
+ Features
74
+ ========
75
+
76
+ - External data for query processing.
77
+
78
+ - Query settings.
79
+
80
+ - Compression support.
81
+
82
+ - TLS support.
83
+
84
+ - Types support:
85
+
86
+ * Float32/64
87
+ * [U]Int8/16/32/64/128/256
88
+ * Date/Date32/DateTime('timezone')/DateTime64('timezone')
89
+ * String/FixedString(N)
90
+ * Enum8/16
91
+ * Array(T)
92
+ * Nullable(T)
93
+ * Bool
94
+ * UUID
95
+ * Decimal
96
+ * IPv4/IPv6
97
+ * LowCardinality(T)
98
+ * SimpleAggregateFunction(F, T)
99
+ * Tuple(T1, T2, ...)
100
+ * Nested
101
+ * Map(key, value)
102
+
103
+ - Query progress information.
104
+
105
+ - Block by block results streaming.
106
+
107
+ - Reading query profile info.
108
+
109
+ - Receiving server logs.
110
+
111
+ - Multiple hosts support.
112
+
113
+ - Python DB API 2.0 specification support.
114
+
115
+ - Optional NumPy arrays support.
116
+
117
+ Documentation
118
+ =============
119
+
120
+ Documentation is available at https://clickhouse-driver.readthedocs.io.
121
+
122
+ Usage
123
+ =====
124
+
125
+ There are two ways to communicate with server:
126
+
127
+ - using pure Client;
128
+ - using DB API.
129
+
130
+ Pure Client example:
131
+
132
+ .. code-block:: python
133
+
134
+ >>> from clickhouse_driver import Client
135
+ >>>
136
+ >>> client = Client('localhost')
137
+ >>>
138
+ >>> client.execute('SHOW TABLES')
139
+ [('test',)]
140
+ >>> client.execute('DROP TABLE IF EXISTS test')
141
+ []
142
+ >>> client.execute('CREATE TABLE test (x Int32) ENGINE = Memory')
143
+ []
144
+ >>> client.execute(
145
+ ... 'INSERT INTO test (x) VALUES',
146
+ ... [{'x': 100}]
147
+ ... )
148
+ 1
149
+ >>> client.execute('INSERT INTO test (x) VALUES', [[200]])
150
+ 1
151
+ >>> client.execute(
152
+ ... 'INSERT INTO test (x) '
153
+ ... 'SELECT * FROM system.numbers LIMIT %(limit)s',
154
+ ... {'limit': 3}
155
+ ... )
156
+ []
157
+ >>> client.execute('SELECT sum(x) FROM test')
158
+ [(303,)]
159
+
160
+ DB API example:
161
+
162
+ .. code-block:: python
163
+
164
+ >>> from clickhouse_driver import connect
165
+ >>>
166
+ >>> conn = connect('clickhouse://localhost')
167
+ >>> cursor = conn.cursor()
168
+ >>>
169
+ >>> cursor.execute('SHOW TABLES')
170
+ >>> cursor.fetchall()
171
+ [('test',)]
172
+ >>> cursor.execute('DROP TABLE IF EXISTS test')
173
+ >>> cursor.fetchall()
174
+ []
175
+ >>> cursor.execute('CREATE TABLE test (x Int32) ENGINE = Memory')
176
+ >>> cursor.fetchall()
177
+ []
178
+ >>> cursor.executemany(
179
+ ... 'INSERT INTO test (x) VALUES',
180
+ ... [{'x': 100}]
181
+ ... )
182
+ >>> cursor.rowcount
183
+ 1
184
+ >>> cursor.executemany('INSERT INTO test (x) VALUES', [[200]])
185
+ >>> cursor.rowcount
186
+ 1
187
+ >>> cursor.execute(
188
+ ... 'INSERT INTO test (x) '
189
+ ... 'SELECT * FROM system.numbers LIMIT %(limit)s',
190
+ ... {'limit': 3}
191
+ ... )
192
+ >>> cursor.rowcount
193
+ 0
194
+ >>> cursor.execute('SELECT sum(x) FROM test')
195
+ >>> cursor.fetchall()
196
+ [(303,)]
197
+
198
+ License
199
+ =======
200
+
201
+ ClickHouse Python Driver is distributed under the `MIT license
202
+ <http://www.opensource.org/licenses/mit-license.php>`_.
@@ -0,0 +1,89 @@
1
+ clickhouse_driver-0.2.9.dist-info/RECORD,,
2
+ clickhouse_driver-0.2.9.dist-info/WHEEL,sha256=OwBfOjxNzqCDtwkP-Q-f-5himxwcOSIuRzx5y5yss8o,154
3
+ clickhouse_driver-0.2.9.dist-info/LICENSE,sha256=b2SjNa4zGQk6XzJwmeE1dQjjtWRvX_zxJIAl_ZbN_S8,1143
4
+ clickhouse_driver-0.2.9.dist-info/top_level.txt,sha256=PrE0Lrs4d-gRQwzABaABfym9Qvr4nN6uTrDy6Q7zQME,18
5
+ clickhouse_driver-0.2.9.dist-info/METADATA,sha256=a3_fJkZEv8LZiypNUhNi8hqOiLBv2nGtJUU4FnSWIi4,6140
6
+ clickhouse_driver/queryprocessingstage.py,sha256=lbV-bB5jWUp0hqYBTsUcRYkJhCgCTfN2G21AykMoAp0,186
7
+ clickhouse_driver/block.py,sha256=t2zZhtCzwp4aJj0CuDqXlDEgHXgwc6GRsIks2aaIZvI,6311
8
+ clickhouse_driver/result.py,sha256=RpjBUvRQJ70xISye7u6gxgQBJwc2UkNuusLkaZF7SmM,4098
9
+ clickhouse_driver/progress.py,sha256=mom2NRLg8dfE_ObOEthKqjSBIliBvDjt7joePvY_Fdw,1574
10
+ clickhouse_driver/log.py,sha256=P9VS_YDY3a4JQsNOeUNNK0L1AAallTC1GF4FG5gCrac,1091
11
+ clickhouse_driver/bufferedreader.cpython-311-powerpc64le-linux-gnu.so,sha256=XuQfU1E497Sa8603rA_g8Ch5RJbtNe-8HCIiCl68p0M,1204792
12
+ clickhouse_driver/clientinfo.py,sha256=Tw3NbuDHglT6_f0AcT0IdhqW_hVePtzh9pypx5nk5ZE,4260
13
+ clickhouse_driver/reader.py,sha256=PWKOKwjszu0sJbG-dd_TyGn8tQAzxg2gCJVbz27G3-8,1322
14
+ clickhouse_driver/readhelpers.py,sha256=tXOmSL9GSeHLdKE2yBlk0epfy-hGJ3bTOLq3Q6sXIkw,717
15
+ clickhouse_driver/defines.py,sha256=EwrQz7sNNUmGZmZywQFpDpBFc67nB9GAZOBQEvvUJzA,2130
16
+ clickhouse_driver/connection.py,sha256=RYS-s3jjlfloFNeth6Vy7N3g6E-W5dXM1MGJ9F6H1cU,28760
17
+ clickhouse_driver/context.py,sha256=yPkJ_BN4LGODvKCOjNlDGqABwxAMQTQl7w1vIGRPBDg,909
18
+ clickhouse_driver/blockstreamprofileinfo.py,sha256=nYx9QXWAS8aPiRbtAzwLRT5JIlJ8S103JMkudncwpFg,712
19
+ clickhouse_driver/__init__.py,sha256=RK_d8W2wu-969SgQpS3ggN249KbViz6uDBaJLbCYsp4,158
20
+ clickhouse_driver/opentelemetry.py,sha256=GIzHCxdB8LB1ozXtUjIpxsdznmRABAts64G2u2l4C_A,1622
21
+ clickhouse_driver/writer.py,sha256=yf5f1vTr56YFtL-Swpi_jBsPw5bQS56j53joB0Acdyk,1286
22
+ clickhouse_driver/varint.cpython-311-powerpc64le-linux-gnu.so,sha256=RVojjVzOSih45hd6iqG6p20eKVLPOjVE9farVDTma4c,386576
23
+ clickhouse_driver/errors.py,sha256=mffBg-Y2LFOSRzvE9V34RwFcvmfh67yqLeEBhrdjeXE,14343
24
+ clickhouse_driver/protocol.py,sha256=BxCJiZLH0QkFmdNwog1OJm9MEMwdPZ1i5Jv1_NHcLb0,2965
25
+ clickhouse_driver/client.py,sha256=iYSz2DLQC-t6RLmtWJvtHoEWBAFtKDIafl874tz2ebs,32251
26
+ clickhouse_driver/bufferedwriter.cpython-311-powerpc64le-linux-gnu.so,sha256=04I0NVXjxLg2bhAgWAKoW-N4-PLLP1sKBW_BmaSw524,1217816
27
+ clickhouse_driver/settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
+ clickhouse_driver/settings/available.py,sha256=8b1YUjt-_6gO9Cio02VZSMPdhM70zk-NMhE4f_jwFx8,16613
29
+ clickhouse_driver/settings/writer.py,sha256=x0FVdbKZR9lN-hXAT2xxkoqvGo1ojvWWwyP3NaI7ZDA,1099
30
+ clickhouse_driver/settings/types.py,sha256=u_A3FzREqIjj4OSEdKUwm1Xn8jEnGpp-9AvqbcE2G8s,1108
31
+ clickhouse_driver/columns/enumcolumn.py,sha256=zqZkSVVXfWsaPUbP59ayy7w8rG4otS9J51UPD29zs2Y,3674
32
+ clickhouse_driver/columns/service.py,sha256=6nIGwvcG-5LErQFn_3a2GRKZI2OnKYsy2oIIMhxJqlc,6181
33
+ clickhouse_driver/columns/nestedcolumn.py,sha256=7x3xNYR22kEmgV4_3rPVZea2zCTU364O1tlOewMgw3M,303
34
+ clickhouse_driver/columns/nothingcolumn.py,sha256=O1a1K17tPw5DYH49gBQq9urrmm0plDJ34YD2s2y6dhg,259
35
+ clickhouse_driver/columns/decimalcolumn.py,sha256=MBczjN6AtI0jgbVTNguwVE7ZdWql0XuMl-QohxV-sN0,3450
36
+ clickhouse_driver/columns/datecolumn.py,sha256=FT6qzmniFGKw5SpjFITiBf-fJGEwaoUIz7PMZMFxe8M,3209
37
+ clickhouse_driver/columns/boolcolumn.py,sha256=QgVCqbZWoFD1yvpppc92iiXIzReCVEh692efNSNH4UE,127
38
+ clickhouse_driver/columns/uuidcolumn.py,sha256=7CLPxsHJtV6Zt9jxILSkE0LAwffloLmrjjbwCZH34mA,1865
39
+ clickhouse_driver/columns/exceptions.py,sha256=vrZMZ9ORRP7RSSd34azM_xFaeMaaYbwy6h6ZCeFNbIg,163
40
+ clickhouse_driver/columns/mapcolumn.py,sha256=gX7xvwsilfOHDCwmRJu4fW2Y1OrN_1cgZTmbvcyer30,2133
41
+ clickhouse_driver/columns/datetimecolumn.py,sha256=RWucoNtcc4wUGQ6xPL0cTNmxFy8eQ50ZdHzexXBm3XE,6730
42
+ clickhouse_driver/columns/nullcolumn.py,sha256=a8Il310y69JQr-NobcK9WhMAkXlogMvDmJbcueuOozs,331
43
+ clickhouse_driver/columns/largeint.cpython-311-powerpc64le-linux-gnu.so,sha256=zYTAw7g-vp7fNLXifQGHpyIR2Mn_m_woumIp918QpAY,1003944
44
+ clickhouse_driver/columns/nullablecolumn.py,sha256=HF4AyX2UIb6qGqe4aY_Tdcjf1ddisPO2QYte3PCIaRU,169
45
+ clickhouse_driver/columns/ipcolumn.py,sha256=LIt-NiUy70-8u5Amu0v0tlAlrolZ8gXzlFxcJYmjRAk,4095
46
+ clickhouse_driver/columns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
+ clickhouse_driver/columns/floatcolumn.py,sha256=Mci7Fl05dgkpDQRfjGaDP9QraZER5nkYX1lVsTA89Yk,925
48
+ clickhouse_driver/columns/stringcolumn.py,sha256=C-l7HaReg9AcJGQvgpSH07aV-CZMBP1jKArPHZi8Q2k,2059
49
+ clickhouse_driver/columns/simpleaggregatefunctioncolumn.py,sha256=zDWBd_Hc7AktHFZ5JY7SwxIk7G4WBHdJdcPBqihe7q0,235
50
+ clickhouse_driver/columns/base.py,sha256=jRThD8Ol7gwNy3x0M7vvslkm0RDOsCLJqKGf0arsa0w,6504
51
+ clickhouse_driver/columns/jsoncolumn.py,sha256=SeCLSrmRoEg9wlvoehs7-EmrV8XkOL3lknzeOORhbJg,1175
52
+ clickhouse_driver/columns/lowcardinalitycolumn.py,sha256=vMlhYYUPNmFhQiUAS77pE25KjI8TrO6ySz6w0ByBdZQ,4920
53
+ clickhouse_driver/columns/intervalcolumn.py,sha256=oQeybb4qrcp07LeVYfqgeZuHYGH5RaY7KnWVoIsDe1I,600
54
+ clickhouse_driver/columns/util.py,sha256=3q965GjEmKkTmjIva31PhvAEGfuuGulad1amK7kQBEQ,1427
55
+ clickhouse_driver/columns/intcolumn.py,sha256=ntpxyMiu44VQYJ0HyHlglwxMgUtnIgf3JE9LUD9Xwwc,3519
56
+ clickhouse_driver/columns/tuplecolumn.py,sha256=DnwtEwVXzm-YyL5-cPe9MiOLOoTEcDhcYeBY6SuuZZQ,2040
57
+ clickhouse_driver/columns/arraycolumn.py,sha256=UiA48jw3o4-ert8BnzEbl2h1jVmtDH3jtcP1BTPru2w,5322
58
+ clickhouse_driver/columns/numpy/service.py,sha256=ENk26HPfxtbumcO_b2fGTNJdTgaJT0a-l3q_xrRIZZ4,2126
59
+ clickhouse_driver/columns/numpy/datecolumn.py,sha256=xWFsFwiRmszK9A20UWnF4beTE5f8XQDj18x53xtXtSI,482
60
+ clickhouse_driver/columns/numpy/boolcolumn.py,sha256=0_RwEroY2-ZqMuxKeTNG27ZCWN_y9BxYZzbuFKeqoQg,140
61
+ clickhouse_driver/columns/numpy/datetimecolumn.py,sha256=X6XgslCvWOF3dtVP3ogDQ4WLWhQqAkAdw5qAIuE8f1o,4890
62
+ clickhouse_driver/columns/numpy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
+ clickhouse_driver/columns/numpy/floatcolumn.py,sha256=WnnlyR3vabh6ixllXwdyQ_t8y5MSqCddImWityxz6pE,599
64
+ clickhouse_driver/columns/numpy/stringcolumn.py,sha256=FH87XPQv3ga0ZJnngubqu4DgxmUt8bjW8xJcNfOU7EI,2439
65
+ clickhouse_driver/columns/numpy/base.py,sha256=Wk1ADpoQGWQv5X8sWi0esA2jmQGEoDakXZxImuYM2eM,1410
66
+ clickhouse_driver/columns/numpy/lowcardinalitycolumn.py,sha256=ExYtwBBn6WfSQtWC0f79ZqjdqO3ZJ3IL6KtlQOgMh-k,3368
67
+ clickhouse_driver/columns/numpy/intcolumn.py,sha256=ZzmjvjpEaZ_kk-mGEPdBAqUCjqCgGT8tUEzbQKwUVVA,792
68
+ clickhouse_driver/columns/numpy/tuplecolumn.py,sha256=5RqhCIZ-CrWy_D0yyfTmlWBJgrunT5Yk-bM4OvIKZ1o,1233
69
+ clickhouse_driver/compression/lz4.py,sha256=ZTf1zn0uG26O29XHBBZeve26JLPNbbEWWMZe065oa0Y,631
70
+ clickhouse_driver/compression/zstd.py,sha256=yzI1UwKkAudCzvHcznSIRlbAYeGeR3k6xux4hReCnBc,531
71
+ clickhouse_driver/compression/__init__.py,sha256=_XcKSkvWWPvEX4jeefYX1Alee58w6ktFOXrsIFRko_0,714
72
+ clickhouse_driver/compression/lz4hc.py,sha256=zGbj9vnM20W298kgzD0dIAgIeV30e5Kx8NSN8t4SDas,195
73
+ clickhouse_driver/compression/base.py,sha256=MCTK2aOGT3Lkso5r3-U-ilj2ln4r-nnfNI_2Ostsu6Q,2434
74
+ clickhouse_driver/numpy/block.py,sha256=k8CqQxaVSviZvicS03exPZG_LFwbzB5-NnLB2EuBKgQ,180
75
+ clickhouse_driver/numpy/result.py,sha256=D-7IsaIt0u4WJ8iSzXYBB0OiPgPu5ptu-1HiJvTW-No,3563
76
+ clickhouse_driver/numpy/helpers.py,sha256=cwRvBX4a-o-QdccYIxFT3p8DPUaXqyXWsVNTSiG8Cdw,803
77
+ clickhouse_driver/numpy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
78
+ clickhouse_driver/streams/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
79
+ clickhouse_driver/streams/compressed.py,sha256=eyFCuq_sLX6oJLQ_h1QX3IB9IgUx56pPqPfhmeiA6ag,2865
80
+ clickhouse_driver/streams/native.py,sha256=lIJFxLRFrh2zqRAvf8W2JPmXdGtJu3LPDUkfaBrLAfk,3493
81
+ clickhouse_driver/util/helpers.py,sha256=AIKa7UPCiNMjGaMwFjn_n1PTij20PCYtA-YMePBKQFY,4483
82
+ clickhouse_driver/util/compat.py,sha256=wIB_6ULSapKx-Fi64lZ0YJ-TtWOQXePHE90wZopIM1I,876
83
+ clickhouse_driver/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
84
+ clickhouse_driver/util/escape.py,sha256=vL8sY6XdHhjFwtHn8yQ3JbeZfocWt6jyvxFf-nEiRtM,2262
85
+ clickhouse_driver/dbapi/extras.py,sha256=je1tjk6gb-QqLMoWu_iXCqhJK159vyyHsCB_8vXkXyw,2129
86
+ clickhouse_driver/dbapi/connection.py,sha256=VZ27YhRnr4VhKxiFbLFhdeQ-0Nb0IRyZRZ0f0_wrkPU,3032
87
+ clickhouse_driver/dbapi/cursor.py,sha256=MOtVhXVkDYxXTAM_AeesKxrcsR64Rt2tRYVmsWLM_tQ,10517
88
+ clickhouse_driver/dbapi/__init__.py,sha256=Ouv2PV7d6nlY7yBYu71rOfy_JBM7POoG-wPH8kGu0q0,1759
89
+ clickhouse_driver/dbapi/errors.py,sha256=yv2SDIK-ZlWmIxBoF5_igfHRyh9zTUJSgAj9g8S4cXo,440