clickhouse-driver 0.2.1__cp39-cp39-win_amd64.whl → 0.2.10__cp39-cp39-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 -9
- clickhouse_driver/block.py +227 -195
- clickhouse_driver/blockstreamprofileinfo.py +22 -22
- clickhouse_driver/bufferedreader.cp39-win_amd64.pyd +0 -0
- clickhouse_driver/bufferedwriter.cp39-win_amd64.pyd +0 -0
- clickhouse_driver/client.py +812 -666
- clickhouse_driver/clientinfo.py +119 -80
- clickhouse_driver/columns/arraycolumn.py +161 -150
- clickhouse_driver/columns/base.py +221 -147
- clickhouse_driver/columns/boolcolumn.py +7 -0
- clickhouse_driver/columns/datecolumn.py +108 -49
- clickhouse_driver/columns/datetimecolumn.py +203 -207
- clickhouse_driver/columns/decimalcolumn.py +116 -118
- clickhouse_driver/columns/enumcolumn.py +129 -119
- clickhouse_driver/columns/exceptions.py +12 -12
- clickhouse_driver/columns/floatcolumn.py +34 -34
- clickhouse_driver/columns/intcolumn.py +157 -157
- clickhouse_driver/columns/intervalcolumn.py +33 -33
- clickhouse_driver/columns/ipcolumn.py +118 -118
- clickhouse_driver/columns/jsoncolumn.py +37 -0
- clickhouse_driver/columns/largeint.cp39-win_amd64.pyd +0 -0
- clickhouse_driver/columns/lowcardinalitycolumn.py +142 -123
- clickhouse_driver/columns/mapcolumn.py +73 -58
- clickhouse_driver/columns/nestedcolumn.py +10 -0
- clickhouse_driver/columns/nothingcolumn.py +13 -13
- clickhouse_driver/columns/nullablecolumn.py +7 -7
- clickhouse_driver/columns/nullcolumn.py +15 -15
- clickhouse_driver/columns/numpy/base.py +47 -14
- clickhouse_driver/columns/numpy/boolcolumn.py +8 -0
- clickhouse_driver/columns/numpy/datecolumn.py +19 -12
- clickhouse_driver/columns/numpy/datetimecolumn.py +146 -145
- clickhouse_driver/columns/numpy/floatcolumn.py +24 -13
- clickhouse_driver/columns/numpy/intcolumn.py +43 -43
- clickhouse_driver/columns/numpy/lowcardinalitycolumn.py +96 -83
- clickhouse_driver/columns/numpy/service.py +58 -80
- clickhouse_driver/columns/numpy/stringcolumn.py +78 -76
- clickhouse_driver/columns/numpy/tuplecolumn.py +37 -0
- clickhouse_driver/columns/service.py +185 -131
- clickhouse_driver/columns/simpleaggregatefunctioncolumn.py +7 -7
- clickhouse_driver/columns/stringcolumn.py +73 -73
- clickhouse_driver/columns/tuplecolumn.py +63 -65
- clickhouse_driver/columns/util.py +61 -0
- clickhouse_driver/columns/uuidcolumn.py +64 -64
- clickhouse_driver/compression/__init__.py +32 -28
- clickhouse_driver/compression/base.py +87 -52
- clickhouse_driver/compression/lz4.py +21 -55
- clickhouse_driver/compression/lz4hc.py +9 -9
- clickhouse_driver/compression/zstd.py +20 -51
- clickhouse_driver/connection.py +825 -632
- clickhouse_driver/context.py +36 -36
- clickhouse_driver/dbapi/__init__.py +62 -62
- clickhouse_driver/dbapi/connection.py +99 -96
- clickhouse_driver/dbapi/cursor.py +370 -368
- clickhouse_driver/dbapi/errors.py +40 -40
- clickhouse_driver/dbapi/extras.py +73 -0
- clickhouse_driver/defines.py +58 -42
- clickhouse_driver/errors.py +453 -446
- clickhouse_driver/log.py +48 -44
- clickhouse_driver/numpy/block.py +8 -8
- clickhouse_driver/numpy/helpers.py +28 -25
- clickhouse_driver/numpy/result.py +123 -123
- clickhouse_driver/opentelemetry.py +43 -0
- clickhouse_driver/progress.py +44 -32
- clickhouse_driver/protocol.py +130 -105
- clickhouse_driver/queryprocessingstage.py +8 -8
- clickhouse_driver/reader.py +69 -69
- clickhouse_driver/readhelpers.py +26 -26
- clickhouse_driver/result.py +144 -144
- clickhouse_driver/settings/available.py +405 -405
- clickhouse_driver/settings/types.py +50 -50
- clickhouse_driver/settings/writer.py +34 -29
- clickhouse_driver/streams/compressed.py +88 -88
- clickhouse_driver/streams/native.py +108 -90
- clickhouse_driver/util/compat.py +39 -0
- clickhouse_driver/util/escape.py +94 -55
- clickhouse_driver/util/helpers.py +173 -57
- clickhouse_driver/varint.cp39-win_amd64.pyd +0 -0
- clickhouse_driver/writer.py +67 -67
- clickhouse_driver-0.2.10.dist-info/METADATA +215 -0
- clickhouse_driver-0.2.10.dist-info/RECORD +89 -0
- {clickhouse_driver-0.2.1.dist-info → clickhouse_driver-0.2.10.dist-info}/WHEEL +1 -1
- {clickhouse_driver-0.2.1.dist-info → clickhouse_driver-0.2.10.dist-info/licenses}/LICENSE +21 -21
- clickhouse_driver-0.2.1.dist-info/METADATA +0 -24
- clickhouse_driver-0.2.1.dist-info/RECORD +0 -80
- {clickhouse_driver-0.2.1.dist-info → clickhouse_driver-0.2.10.dist-info}/top_level.txt +0 -0
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
class Warning(Exception):
|
|
4
|
-
pass
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Error(Exception):
|
|
8
|
-
pass
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class InterfaceError(Error):
|
|
12
|
-
pass
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class DatabaseError(Error):
|
|
16
|
-
pass
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class InternalError(DatabaseError):
|
|
20
|
-
pass
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class OperationalError(DatabaseError):
|
|
24
|
-
pass
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class ProgrammingError(DatabaseError):
|
|
28
|
-
pass
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class IntegrityError(DatabaseError):
|
|
32
|
-
pass
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
class DataError(DatabaseError):
|
|
36
|
-
pass
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
class NotSupportedError(DatabaseError):
|
|
40
|
-
pass
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
class Warning(Exception):
|
|
4
|
+
pass
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Error(Exception):
|
|
8
|
+
pass
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class InterfaceError(Error):
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class DatabaseError(Error):
|
|
16
|
+
pass
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class InternalError(DatabaseError):
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class OperationalError(DatabaseError):
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ProgrammingError(DatabaseError):
|
|
28
|
+
pass
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class IntegrityError(DatabaseError):
|
|
32
|
+
pass
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class DataError(DatabaseError):
|
|
36
|
+
pass
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class NotSupportedError(DatabaseError):
|
|
40
|
+
pass
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from collections import namedtuple
|
|
3
|
+
from functools import lru_cache
|
|
4
|
+
|
|
5
|
+
from .cursor import Cursor
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class DictCursor(Cursor):
|
|
9
|
+
"""
|
|
10
|
+
A cursor that generates results as :class:`dict`.
|
|
11
|
+
|
|
12
|
+
``fetch*()`` methods will return dicts instead of tuples.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def fetchone(self):
|
|
16
|
+
rv = super(DictCursor, self).fetchone()
|
|
17
|
+
if rv is not None:
|
|
18
|
+
rv = dict(zip(self._columns, rv))
|
|
19
|
+
return rv
|
|
20
|
+
|
|
21
|
+
def fetchmany(self, size=None):
|
|
22
|
+
rv = super(DictCursor, self).fetchmany(size=size)
|
|
23
|
+
return [dict(zip(self._columns, x)) for x in rv]
|
|
24
|
+
|
|
25
|
+
def fetchall(self):
|
|
26
|
+
rv = super(DictCursor, self).fetchall()
|
|
27
|
+
return [dict(zip(self._columns, x)) for x in rv]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class NamedTupleCursor(Cursor):
|
|
31
|
+
"""
|
|
32
|
+
A cursor that generates results as named tuples created by
|
|
33
|
+
:func:`~collections.namedtuple`.
|
|
34
|
+
|
|
35
|
+
``fetch*()`` methods will return named tuples instead of regular tuples, so
|
|
36
|
+
their elements can be accessed both as regular numeric items as well as
|
|
37
|
+
attributes.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
# ascii except alnum and underscore
|
|
41
|
+
_re_clean = re.compile(
|
|
42
|
+
'[' + re.escape(' !"#$%&\'()*+,-./:;<=>?@[\\]^`{|}~') + ']')
|
|
43
|
+
|
|
44
|
+
@classmethod
|
|
45
|
+
@lru_cache(512)
|
|
46
|
+
def _make_nt(self, key):
|
|
47
|
+
fields = []
|
|
48
|
+
for s in key:
|
|
49
|
+
s = self._re_clean.sub('_', s)
|
|
50
|
+
# Python identifier cannot start with numbers, namedtuple fields
|
|
51
|
+
# cannot start with underscore.
|
|
52
|
+
if s[0] == '_' or '0' <= s[0] <= '9':
|
|
53
|
+
s = 'f' + s
|
|
54
|
+
fields.append(s)
|
|
55
|
+
|
|
56
|
+
return namedtuple('Record', fields)
|
|
57
|
+
|
|
58
|
+
def fetchone(self):
|
|
59
|
+
rv = super(NamedTupleCursor, self).fetchone()
|
|
60
|
+
if rv is not None:
|
|
61
|
+
nt = self._make_nt(self._columns)
|
|
62
|
+
rv = nt(*rv)
|
|
63
|
+
return rv
|
|
64
|
+
|
|
65
|
+
def fetchmany(self, size=None):
|
|
66
|
+
rv = super(NamedTupleCursor, self).fetchmany(size=size)
|
|
67
|
+
nt = self._make_nt(self._columns)
|
|
68
|
+
return [nt(*x) for x in rv]
|
|
69
|
+
|
|
70
|
+
def fetchall(self):
|
|
71
|
+
rv = super(NamedTupleCursor, self).fetchall()
|
|
72
|
+
nt = self._make_nt(self._columns)
|
|
73
|
+
return [nt(*x) for x in rv]
|
clickhouse_driver/defines.py
CHANGED
|
@@ -1,42 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
DEFAULT_DATABASE = '
|
|
3
|
-
DEFAULT_USER = 'default'
|
|
4
|
-
DEFAULT_PASSWORD = ''
|
|
5
|
-
|
|
6
|
-
DEFAULT_PORT = 9000
|
|
7
|
-
DEFAULT_SECURE_PORT = 9440
|
|
8
|
-
|
|
9
|
-
DBMS_MIN_REVISION_WITH_TEMPORARY_TABLES = 50264
|
|
10
|
-
DBMS_MIN_REVISION_WITH_TOTAL_ROWS_IN_PROGRESS = 51554
|
|
11
|
-
DBMS_MIN_REVISION_WITH_BLOCK_INFO = 51903
|
|
12
|
-
# Legacy above.
|
|
13
|
-
DBMS_MIN_REVISION_WITH_CLIENT_INFO = 54032
|
|
14
|
-
DBMS_MIN_REVISION_WITH_SERVER_TIMEZONE = 54058
|
|
15
|
-
DBMS_MIN_REVISION_WITH_QUOTA_KEY_IN_CLIENT_INFO = 54060
|
|
16
|
-
DBMS_MIN_REVISION_WITH_SERVER_DISPLAY_NAME = 54372
|
|
17
|
-
DBMS_MIN_REVISION_WITH_VERSION_PATCH = 54401
|
|
18
|
-
DBMS_MIN_REVISION_WITH_SERVER_LOGS = 54406
|
|
19
|
-
DBMS_MIN_REVISION_WITH_COLUMN_DEFAULTS_METADATA = 54410
|
|
20
|
-
DBMS_MIN_REVISION_WITH_CLIENT_WRITE_INFO = 54420
|
|
21
|
-
DBMS_MIN_REVISION_WITH_SETTINGS_SERIALIZED_AS_STRINGS = 54429
|
|
22
|
-
DBMS_MIN_REVISION_WITH_INTERSERVER_SECRET = 54441
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
|
|
2
|
+
DEFAULT_DATABASE = ''
|
|
3
|
+
DEFAULT_USER = 'default'
|
|
4
|
+
DEFAULT_PASSWORD = ''
|
|
5
|
+
|
|
6
|
+
DEFAULT_PORT = 9000
|
|
7
|
+
DEFAULT_SECURE_PORT = 9440
|
|
8
|
+
|
|
9
|
+
DBMS_MIN_REVISION_WITH_TEMPORARY_TABLES = 50264
|
|
10
|
+
DBMS_MIN_REVISION_WITH_TOTAL_ROWS_IN_PROGRESS = 51554
|
|
11
|
+
DBMS_MIN_REVISION_WITH_BLOCK_INFO = 51903
|
|
12
|
+
# Legacy above.
|
|
13
|
+
DBMS_MIN_REVISION_WITH_CLIENT_INFO = 54032
|
|
14
|
+
DBMS_MIN_REVISION_WITH_SERVER_TIMEZONE = 54058
|
|
15
|
+
DBMS_MIN_REVISION_WITH_QUOTA_KEY_IN_CLIENT_INFO = 54060
|
|
16
|
+
DBMS_MIN_REVISION_WITH_SERVER_DISPLAY_NAME = 54372
|
|
17
|
+
DBMS_MIN_REVISION_WITH_VERSION_PATCH = 54401
|
|
18
|
+
DBMS_MIN_REVISION_WITH_SERVER_LOGS = 54406
|
|
19
|
+
DBMS_MIN_REVISION_WITH_COLUMN_DEFAULTS_METADATA = 54410
|
|
20
|
+
DBMS_MIN_REVISION_WITH_CLIENT_WRITE_INFO = 54420
|
|
21
|
+
DBMS_MIN_REVISION_WITH_SETTINGS_SERIALIZED_AS_STRINGS = 54429
|
|
22
|
+
DBMS_MIN_REVISION_WITH_INTERSERVER_SECRET = 54441
|
|
23
|
+
DBMS_MIN_REVISION_WITH_OPENTELEMETRY = 54442
|
|
24
|
+
DBMS_MIN_PROTOCOL_VERSION_WITH_DISTRIBUTED_DEPTH = 54448
|
|
25
|
+
DBMS_MIN_PROTOCOL_VERSION_WITH_INITIAL_QUERY_START_TIME = 54449
|
|
26
|
+
DBMS_MIN_PROTOCOL_VERSION_WITH_INCREMENTAL_PROFILE_EVENTS = 54451
|
|
27
|
+
DBMS_MIN_REVISION_WITH_PARALLEL_REPLICAS = 54453
|
|
28
|
+
DBMS_MIN_REVISION_WITH_CUSTOM_SERIALIZATION = 54454
|
|
29
|
+
DBMS_MIN_PROTOCOL_VERSION_WITH_PROFILE_EVENTS_IN_INSERT = 54456
|
|
30
|
+
DBMS_MIN_PROTOCOL_VERSION_WITH_ADDENDUM = 54458
|
|
31
|
+
DBMS_MIN_PROTOCOL_VERSION_WITH_QUOTA_KEY = 54458
|
|
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
|
|
36
|
+
DBMS_MIN_PROTOCOL_VERSION_WITH_TOTAL_BYTES_IN_PROGRESS = 54463
|
|
37
|
+
DBMS_MIN_PROTOCOL_VERSION_WITH_TIMEZONE_UPDATES = 54464
|
|
38
|
+
DBMS_MIN_REVISION_WITH_SYSTEM_KEYWORDS_TABLE = 54468
|
|
39
|
+
|
|
40
|
+
# Timeouts
|
|
41
|
+
DBMS_DEFAULT_CONNECT_TIMEOUT_SEC = 10
|
|
42
|
+
DBMS_DEFAULT_TIMEOUT_SEC = 300
|
|
43
|
+
|
|
44
|
+
DBMS_DEFAULT_SYNC_REQUEST_TIMEOUT_SEC = 5
|
|
45
|
+
|
|
46
|
+
DEFAULT_COMPRESS_BLOCK_SIZE = 1048576
|
|
47
|
+
DEFAULT_INSERT_BLOCK_SIZE = 1048576
|
|
48
|
+
|
|
49
|
+
DBMS_NAME = 'ClickHouse'
|
|
50
|
+
CLIENT_NAME = 'python-driver'
|
|
51
|
+
CLIENT_VERSION_MAJOR = 20
|
|
52
|
+
CLIENT_VERSION_MINOR = 10
|
|
53
|
+
CLIENT_VERSION_PATCH = 2
|
|
54
|
+
CLIENT_REVISION = DBMS_MIN_REVISION_WITH_SYSTEM_KEYWORDS_TABLE
|
|
55
|
+
|
|
56
|
+
BUFFER_SIZE = 1048576
|
|
57
|
+
|
|
58
|
+
STRINGS_ENCODING = 'utf-8'
|