clickhouse-driver 0.2.8__cp37-cp37m-win_amd64.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.
- clickhouse_driver/__init__.py +9 -0
- clickhouse_driver/block.py +227 -0
- clickhouse_driver/blockstreamprofileinfo.py +22 -0
- clickhouse_driver/bufferedreader.cp37-win_amd64.pyd +0 -0
- clickhouse_driver/bufferedwriter.cp37-win_amd64.pyd +0 -0
- clickhouse_driver/client.py +896 -0
- clickhouse_driver/clientinfo.py +119 -0
- clickhouse_driver/columns/__init__.py +0 -0
- clickhouse_driver/columns/arraycolumn.py +161 -0
- clickhouse_driver/columns/base.py +221 -0
- clickhouse_driver/columns/boolcolumn.py +7 -0
- clickhouse_driver/columns/datecolumn.py +108 -0
- clickhouse_driver/columns/datetimecolumn.py +202 -0
- clickhouse_driver/columns/decimalcolumn.py +116 -0
- clickhouse_driver/columns/enumcolumn.py +119 -0
- clickhouse_driver/columns/exceptions.py +12 -0
- clickhouse_driver/columns/floatcolumn.py +34 -0
- clickhouse_driver/columns/intcolumn.py +157 -0
- clickhouse_driver/columns/intervalcolumn.py +33 -0
- clickhouse_driver/columns/ipcolumn.py +118 -0
- clickhouse_driver/columns/jsoncolumn.py +37 -0
- clickhouse_driver/columns/largeint.cp37-win_amd64.pyd +0 -0
- clickhouse_driver/columns/lowcardinalitycolumn.py +142 -0
- clickhouse_driver/columns/mapcolumn.py +73 -0
- clickhouse_driver/columns/nestedcolumn.py +10 -0
- clickhouse_driver/columns/nothingcolumn.py +13 -0
- clickhouse_driver/columns/nullablecolumn.py +7 -0
- clickhouse_driver/columns/nullcolumn.py +15 -0
- clickhouse_driver/columns/numpy/__init__.py +0 -0
- clickhouse_driver/columns/numpy/base.py +47 -0
- clickhouse_driver/columns/numpy/boolcolumn.py +8 -0
- clickhouse_driver/columns/numpy/datecolumn.py +19 -0
- clickhouse_driver/columns/numpy/datetimecolumn.py +143 -0
- clickhouse_driver/columns/numpy/floatcolumn.py +24 -0
- clickhouse_driver/columns/numpy/intcolumn.py +43 -0
- clickhouse_driver/columns/numpy/lowcardinalitycolumn.py +96 -0
- clickhouse_driver/columns/numpy/service.py +58 -0
- clickhouse_driver/columns/numpy/stringcolumn.py +78 -0
- clickhouse_driver/columns/numpy/tuplecolumn.py +37 -0
- clickhouse_driver/columns/service.py +185 -0
- clickhouse_driver/columns/simpleaggregatefunctioncolumn.py +7 -0
- clickhouse_driver/columns/stringcolumn.py +73 -0
- clickhouse_driver/columns/tuplecolumn.py +63 -0
- clickhouse_driver/columns/util.py +60 -0
- clickhouse_driver/columns/uuidcolumn.py +64 -0
- clickhouse_driver/compression/__init__.py +28 -0
- clickhouse_driver/compression/base.py +87 -0
- clickhouse_driver/compression/lz4.py +21 -0
- clickhouse_driver/compression/lz4hc.py +9 -0
- clickhouse_driver/compression/zstd.py +20 -0
- clickhouse_driver/connection.py +784 -0
- clickhouse_driver/context.py +36 -0
- clickhouse_driver/dbapi/__init__.py +62 -0
- clickhouse_driver/dbapi/connection.py +99 -0
- clickhouse_driver/dbapi/cursor.py +370 -0
- clickhouse_driver/dbapi/errors.py +40 -0
- clickhouse_driver/dbapi/extras.py +73 -0
- clickhouse_driver/defines.py +55 -0
- clickhouse_driver/errors.py +453 -0
- clickhouse_driver/log.py +48 -0
- clickhouse_driver/numpy/__init__.py +0 -0
- clickhouse_driver/numpy/block.py +8 -0
- clickhouse_driver/numpy/helpers.py +25 -0
- clickhouse_driver/numpy/result.py +123 -0
- clickhouse_driver/opentelemetry.py +43 -0
- clickhouse_driver/progress.py +38 -0
- clickhouse_driver/protocol.py +114 -0
- clickhouse_driver/queryprocessingstage.py +8 -0
- clickhouse_driver/reader.py +69 -0
- clickhouse_driver/readhelpers.py +26 -0
- clickhouse_driver/result.py +144 -0
- clickhouse_driver/settings/__init__.py +0 -0
- clickhouse_driver/settings/available.py +405 -0
- clickhouse_driver/settings/types.py +50 -0
- clickhouse_driver/settings/writer.py +34 -0
- clickhouse_driver/streams/__init__.py +0 -0
- clickhouse_driver/streams/compressed.py +88 -0
- clickhouse_driver/streams/native.py +102 -0
- clickhouse_driver/util/__init__.py +0 -0
- clickhouse_driver/util/compat.py +39 -0
- clickhouse_driver/util/escape.py +94 -0
- clickhouse_driver/util/helpers.py +57 -0
- clickhouse_driver/varint.cp37-win_amd64.pyd +0 -0
- clickhouse_driver/writer.py +67 -0
- clickhouse_driver-0.2.8.dist-info/LICENSE +21 -0
- clickhouse_driver-0.2.8.dist-info/METADATA +201 -0
- clickhouse_driver-0.2.8.dist-info/RECORD +89 -0
- clickhouse_driver-0.2.8.dist-info/WHEEL +5 -0
- clickhouse_driver-0.2.8.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.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,57 @@
|
|
|
1
|
+
from itertools import islice, tee
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def chunks(seq, n):
|
|
5
|
+
# islice is MUCH slower than slice for lists and tuples.
|
|
6
|
+
if isinstance(seq, (list, tuple)):
|
|
7
|
+
i = 0
|
|
8
|
+
item = seq[i:i+n]
|
|
9
|
+
while item:
|
|
10
|
+
yield list(item)
|
|
11
|
+
i += n
|
|
12
|
+
item = seq[i:i+n]
|
|
13
|
+
|
|
14
|
+
else:
|
|
15
|
+
it = iter(seq)
|
|
16
|
+
item = list(islice(it, n))
|
|
17
|
+
while item:
|
|
18
|
+
yield item
|
|
19
|
+
item = list(islice(it, n))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def pairwise(iterable):
|
|
23
|
+
a, b = tee(iterable)
|
|
24
|
+
next(b, None)
|
|
25
|
+
return zip(a, b)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def column_chunks(columns, n):
|
|
29
|
+
for column in columns:
|
|
30
|
+
if not isinstance(column, (list, tuple)):
|
|
31
|
+
raise TypeError(
|
|
32
|
+
'Unsupported column type: {}. list or tuple is expected.'
|
|
33
|
+
.format(type(column))
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
# create chunk generator for every column
|
|
37
|
+
g = [chunks(column, n) for column in columns]
|
|
38
|
+
|
|
39
|
+
while True:
|
|
40
|
+
# get next chunk for every column
|
|
41
|
+
item = [next(column, []) for column in g]
|
|
42
|
+
if not any(item):
|
|
43
|
+
break
|
|
44
|
+
yield item
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# from paste.deploy.converters
|
|
48
|
+
def asbool(obj):
|
|
49
|
+
if isinstance(obj, str):
|
|
50
|
+
obj = obj.strip().lower()
|
|
51
|
+
if obj in ['true', 'yes', 'on', 'y', 't', '1']:
|
|
52
|
+
return True
|
|
53
|
+
elif obj in ['false', 'no', 'off', 'n', 'f', '0']:
|
|
54
|
+
return False
|
|
55
|
+
else:
|
|
56
|
+
raise ValueError('String is not true/false: %r' % obj)
|
|
57
|
+
return bool(obj)
|
|
Binary file
|
|
@@ -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,201 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: clickhouse-driver
|
|
3
|
+
Version: 0.2.8
|
|
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>`_.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
clickhouse_driver/__init__.py,sha256=OmAov0f6GIBaEKyG5T6rvrDLSL4q1Ysnetjt3iEsMZg,158
|
|
2
|
+
clickhouse_driver/block.py,sha256=t2zZhtCzwp4aJj0CuDqXlDEgHXgwc6GRsIks2aaIZvI,6311
|
|
3
|
+
clickhouse_driver/blockstreamprofileinfo.py,sha256=nYx9QXWAS8aPiRbtAzwLRT5JIlJ8S103JMkudncwpFg,712
|
|
4
|
+
clickhouse_driver/bufferedreader.cp37-win_amd64.pyd,sha256=SU-4RudFHN3ge2qUfs6VDeg1po549rEfuaKa0GZ4zkg,100352
|
|
5
|
+
clickhouse_driver/bufferedwriter.cp37-win_amd64.pyd,sha256=itvYvC5-gKjo1YaEBpoYwivN0cojtg-BsVh0YFyrc5c,99840
|
|
6
|
+
clickhouse_driver/client.py,sha256=aMjWyS98BqonoEuZxNC_q4DdUjBf8vADLAAcrkJPmKA,34703
|
|
7
|
+
clickhouse_driver/clientinfo.py,sha256=Tw3NbuDHglT6_f0AcT0IdhqW_hVePtzh9pypx5nk5ZE,4260
|
|
8
|
+
clickhouse_driver/connection.py,sha256=Ol9ZljjN63P840yrUlWPl5g9lRldh9XTD5fVOiloYi8,28403
|
|
9
|
+
clickhouse_driver/context.py,sha256=yPkJ_BN4LGODvKCOjNlDGqABwxAMQTQl7w1vIGRPBDg,909
|
|
10
|
+
clickhouse_driver/defines.py,sha256=hXIR10BvH_sxUN35pk-f-VeIbM7CA0Ll2B2yNuAy10A,1958
|
|
11
|
+
clickhouse_driver/errors.py,sha256=mffBg-Y2LFOSRzvE9V34RwFcvmfh67yqLeEBhrdjeXE,14343
|
|
12
|
+
clickhouse_driver/log.py,sha256=P9VS_YDY3a4JQsNOeUNNK0L1AAallTC1GF4FG5gCrac,1091
|
|
13
|
+
clickhouse_driver/opentelemetry.py,sha256=GIzHCxdB8LB1ozXtUjIpxsdznmRABAts64G2u2l4C_A,1622
|
|
14
|
+
clickhouse_driver/progress.py,sha256=MagDPiLzWG-2Arecu5O6JlK98242ayt9yPa9H7v9o5k,1288
|
|
15
|
+
clickhouse_driver/protocol.py,sha256=ZRJuawN_v8wXFrHrcpSiBqu7idKsPd3tQnCcDuTlIw8,2561
|
|
16
|
+
clickhouse_driver/queryprocessingstage.py,sha256=lbV-bB5jWUp0hqYBTsUcRYkJhCgCTfN2G21AykMoAp0,186
|
|
17
|
+
clickhouse_driver/reader.py,sha256=PWKOKwjszu0sJbG-dd_TyGn8tQAzxg2gCJVbz27G3-8,1322
|
|
18
|
+
clickhouse_driver/readhelpers.py,sha256=tXOmSL9GSeHLdKE2yBlk0epfy-hGJ3bTOLq3Q6sXIkw,717
|
|
19
|
+
clickhouse_driver/result.py,sha256=RpjBUvRQJ70xISye7u6gxgQBJwc2UkNuusLkaZF7SmM,4098
|
|
20
|
+
clickhouse_driver/varint.cp37-win_amd64.pyd,sha256=hTXi3vXbz61MUXjJq5Gq_6Ku8peohDyr76-xlR8N_nE,39936
|
|
21
|
+
clickhouse_driver/writer.py,sha256=yf5f1vTr56YFtL-Swpi_jBsPw5bQS56j53joB0Acdyk,1286
|
|
22
|
+
clickhouse_driver/columns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
+
clickhouse_driver/columns/arraycolumn.py,sha256=UiA48jw3o4-ert8BnzEbl2h1jVmtDH3jtcP1BTPru2w,5322
|
|
24
|
+
clickhouse_driver/columns/base.py,sha256=jRThD8Ol7gwNy3x0M7vvslkm0RDOsCLJqKGf0arsa0w,6504
|
|
25
|
+
clickhouse_driver/columns/boolcolumn.py,sha256=QgVCqbZWoFD1yvpppc92iiXIzReCVEh692efNSNH4UE,127
|
|
26
|
+
clickhouse_driver/columns/datecolumn.py,sha256=FT6qzmniFGKw5SpjFITiBf-fJGEwaoUIz7PMZMFxe8M,3209
|
|
27
|
+
clickhouse_driver/columns/datetimecolumn.py,sha256=pO8g1exACp6EfUO0prra5X3T_gg1MJ8bSoi5Rt2Vxjg,6691
|
|
28
|
+
clickhouse_driver/columns/decimalcolumn.py,sha256=MBczjN6AtI0jgbVTNguwVE7ZdWql0XuMl-QohxV-sN0,3450
|
|
29
|
+
clickhouse_driver/columns/enumcolumn.py,sha256=GCSW-fjtJC4_5YKo9oKtG8GT9UhLcRWCjrBVhEAUp-A,3219
|
|
30
|
+
clickhouse_driver/columns/exceptions.py,sha256=vrZMZ9ORRP7RSSd34azM_xFaeMaaYbwy6h6ZCeFNbIg,163
|
|
31
|
+
clickhouse_driver/columns/floatcolumn.py,sha256=Mci7Fl05dgkpDQRfjGaDP9QraZER5nkYX1lVsTA89Yk,925
|
|
32
|
+
clickhouse_driver/columns/intcolumn.py,sha256=ntpxyMiu44VQYJ0HyHlglwxMgUtnIgf3JE9LUD9Xwwc,3519
|
|
33
|
+
clickhouse_driver/columns/intervalcolumn.py,sha256=oQeybb4qrcp07LeVYfqgeZuHYGH5RaY7KnWVoIsDe1I,600
|
|
34
|
+
clickhouse_driver/columns/ipcolumn.py,sha256=LIt-NiUy70-8u5Amu0v0tlAlrolZ8gXzlFxcJYmjRAk,4095
|
|
35
|
+
clickhouse_driver/columns/jsoncolumn.py,sha256=SeCLSrmRoEg9wlvoehs7-EmrV8XkOL3lknzeOORhbJg,1175
|
|
36
|
+
clickhouse_driver/columns/largeint.cp37-win_amd64.pyd,sha256=Qms8otQjfWSlezHT1UJeJXMv5ykoPnXlUTqwQNX3hOs,62464
|
|
37
|
+
clickhouse_driver/columns/lowcardinalitycolumn.py,sha256=vMlhYYUPNmFhQiUAS77pE25KjI8TrO6ySz6w0ByBdZQ,4920
|
|
38
|
+
clickhouse_driver/columns/mapcolumn.py,sha256=gX7xvwsilfOHDCwmRJu4fW2Y1OrN_1cgZTmbvcyer30,2133
|
|
39
|
+
clickhouse_driver/columns/nestedcolumn.py,sha256=7x3xNYR22kEmgV4_3rPVZea2zCTU364O1tlOewMgw3M,303
|
|
40
|
+
clickhouse_driver/columns/nothingcolumn.py,sha256=O1a1K17tPw5DYH49gBQq9urrmm0plDJ34YD2s2y6dhg,259
|
|
41
|
+
clickhouse_driver/columns/nullablecolumn.py,sha256=HF4AyX2UIb6qGqe4aY_Tdcjf1ddisPO2QYte3PCIaRU,169
|
|
42
|
+
clickhouse_driver/columns/nullcolumn.py,sha256=a8Il310y69JQr-NobcK9WhMAkXlogMvDmJbcueuOozs,331
|
|
43
|
+
clickhouse_driver/columns/service.py,sha256=6nIGwvcG-5LErQFn_3a2GRKZI2OnKYsy2oIIMhxJqlc,6181
|
|
44
|
+
clickhouse_driver/columns/simpleaggregatefunctioncolumn.py,sha256=zDWBd_Hc7AktHFZ5JY7SwxIk7G4WBHdJdcPBqihe7q0,235
|
|
45
|
+
clickhouse_driver/columns/stringcolumn.py,sha256=C-l7HaReg9AcJGQvgpSH07aV-CZMBP1jKArPHZi8Q2k,2059
|
|
46
|
+
clickhouse_driver/columns/tuplecolumn.py,sha256=DnwtEwVXzm-YyL5-cPe9MiOLOoTEcDhcYeBY6SuuZZQ,2040
|
|
47
|
+
clickhouse_driver/columns/util.py,sha256=5DRGBsWSTldqZRZJ53J85zh_jepkwkAsYXhAeDJQW4I,1395
|
|
48
|
+
clickhouse_driver/columns/uuidcolumn.py,sha256=7CLPxsHJtV6Zt9jxILSkE0LAwffloLmrjjbwCZH34mA,1865
|
|
49
|
+
clickhouse_driver/columns/numpy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
50
|
+
clickhouse_driver/columns/numpy/base.py,sha256=Wk1ADpoQGWQv5X8sWi0esA2jmQGEoDakXZxImuYM2eM,1410
|
|
51
|
+
clickhouse_driver/columns/numpy/boolcolumn.py,sha256=0_RwEroY2-ZqMuxKeTNG27ZCWN_y9BxYZzbuFKeqoQg,140
|
|
52
|
+
clickhouse_driver/columns/numpy/datecolumn.py,sha256=xWFsFwiRmszK9A20UWnF4beTE5f8XQDj18x53xtXtSI,482
|
|
53
|
+
clickhouse_driver/columns/numpy/datetimecolumn.py,sha256=XQ3JsxVdAvWJndNek4-i07JO2QJIdUnJQWzOxvF3PMc,4777
|
|
54
|
+
clickhouse_driver/columns/numpy/floatcolumn.py,sha256=WnnlyR3vabh6ixllXwdyQ_t8y5MSqCddImWityxz6pE,599
|
|
55
|
+
clickhouse_driver/columns/numpy/intcolumn.py,sha256=ZzmjvjpEaZ_kk-mGEPdBAqUCjqCgGT8tUEzbQKwUVVA,792
|
|
56
|
+
clickhouse_driver/columns/numpy/lowcardinalitycolumn.py,sha256=ExYtwBBn6WfSQtWC0f79ZqjdqO3ZJ3IL6KtlQOgMh-k,3368
|
|
57
|
+
clickhouse_driver/columns/numpy/service.py,sha256=ENk26HPfxtbumcO_b2fGTNJdTgaJT0a-l3q_xrRIZZ4,2126
|
|
58
|
+
clickhouse_driver/columns/numpy/stringcolumn.py,sha256=FH87XPQv3ga0ZJnngubqu4DgxmUt8bjW8xJcNfOU7EI,2439
|
|
59
|
+
clickhouse_driver/columns/numpy/tuplecolumn.py,sha256=5RqhCIZ-CrWy_D0yyfTmlWBJgrunT5Yk-bM4OvIKZ1o,1233
|
|
60
|
+
clickhouse_driver/compression/__init__.py,sha256=_XcKSkvWWPvEX4jeefYX1Alee58w6ktFOXrsIFRko_0,714
|
|
61
|
+
clickhouse_driver/compression/base.py,sha256=MCTK2aOGT3Lkso5r3-U-ilj2ln4r-nnfNI_2Ostsu6Q,2434
|
|
62
|
+
clickhouse_driver/compression/lz4.py,sha256=ZTf1zn0uG26O29XHBBZeve26JLPNbbEWWMZe065oa0Y,631
|
|
63
|
+
clickhouse_driver/compression/lz4hc.py,sha256=zGbj9vnM20W298kgzD0dIAgIeV30e5Kx8NSN8t4SDas,195
|
|
64
|
+
clickhouse_driver/compression/zstd.py,sha256=yzI1UwKkAudCzvHcznSIRlbAYeGeR3k6xux4hReCnBc,531
|
|
65
|
+
clickhouse_driver/dbapi/__init__.py,sha256=Ouv2PV7d6nlY7yBYu71rOfy_JBM7POoG-wPH8kGu0q0,1759
|
|
66
|
+
clickhouse_driver/dbapi/connection.py,sha256=VZ27YhRnr4VhKxiFbLFhdeQ-0Nb0IRyZRZ0f0_wrkPU,3032
|
|
67
|
+
clickhouse_driver/dbapi/cursor.py,sha256=MOtVhXVkDYxXTAM_AeesKxrcsR64Rt2tRYVmsWLM_tQ,10517
|
|
68
|
+
clickhouse_driver/dbapi/errors.py,sha256=yv2SDIK-ZlWmIxBoF5_igfHRyh9zTUJSgAj9g8S4cXo,440
|
|
69
|
+
clickhouse_driver/dbapi/extras.py,sha256=je1tjk6gb-QqLMoWu_iXCqhJK159vyyHsCB_8vXkXyw,2129
|
|
70
|
+
clickhouse_driver/numpy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
71
|
+
clickhouse_driver/numpy/block.py,sha256=k8CqQxaVSviZvicS03exPZG_LFwbzB5-NnLB2EuBKgQ,180
|
|
72
|
+
clickhouse_driver/numpy/helpers.py,sha256=jKiZ3GOp1G5Q2Y-6S_YG9t9RtdSLa-AH1grz71OWyS0,704
|
|
73
|
+
clickhouse_driver/numpy/result.py,sha256=D-7IsaIt0u4WJ8iSzXYBB0OiPgPu5ptu-1HiJvTW-No,3563
|
|
74
|
+
clickhouse_driver/settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
75
|
+
clickhouse_driver/settings/available.py,sha256=8b1YUjt-_6gO9Cio02VZSMPdhM70zk-NMhE4f_jwFx8,16613
|
|
76
|
+
clickhouse_driver/settings/types.py,sha256=u_A3FzREqIjj4OSEdKUwm1Xn8jEnGpp-9AvqbcE2G8s,1108
|
|
77
|
+
clickhouse_driver/settings/writer.py,sha256=x0FVdbKZR9lN-hXAT2xxkoqvGo1ojvWWwyP3NaI7ZDA,1099
|
|
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=2qAs5deUU4NwLG3zQAyxNwGsKmJO41-qlTRKGRFSAJA,3316
|
|
81
|
+
clickhouse_driver/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
82
|
+
clickhouse_driver/util/compat.py,sha256=wIB_6ULSapKx-Fi64lZ0YJ-TtWOQXePHE90wZopIM1I,876
|
|
83
|
+
clickhouse_driver/util/escape.py,sha256=4RPfNzC5IvatoZB9llmJM4436XArCXQDEqT_cqdwCBk,2256
|
|
84
|
+
clickhouse_driver/util/helpers.py,sha256=1oLkkkILXZnEbdjAe2Ags-Y-T-Bq9rk94W6edh-1ZLU,1448
|
|
85
|
+
clickhouse_driver-0.2.8.dist-info/LICENSE,sha256=b2SjNa4zGQk6XzJwmeE1dQjjtWRvX_zxJIAl_ZbN_S8,1143
|
|
86
|
+
clickhouse_driver-0.2.8.dist-info/METADATA,sha256=nmFh97sS6TF5P2tzzmvKfO-HUNGxXWzyrFwC4D6OkuU,6290
|
|
87
|
+
clickhouse_driver-0.2.8.dist-info/WHEEL,sha256=P6MkoxfArCDjH_Cd27qF5eFfOSJbz6XgNmPOs7M04KU,101
|
|
88
|
+
clickhouse_driver-0.2.8.dist-info/top_level.txt,sha256=PrE0Lrs4d-gRQwzABaABfym9Qvr4nN6uTrDy6Q7zQME,18
|
|
89
|
+
clickhouse_driver-0.2.8.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
clickhouse_driver
|