e6data-python-connector 2.1.10.dev0__py3-none-any.whl → 2.1.11__py3-none-any.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.
- e6data_python_connector/datainputstream.py +2 -10
- e6data_python_connector/e6data_grpc.py +20 -63
- {e6data_python_connector-2.1.10.dev0.dist-info → e6data_python_connector-2.1.11.dist-info}/METADATA +1 -1
- {e6data_python_connector-2.1.10.dev0.dist-info → e6data_python_connector-2.1.11.dist-info}/RECORD +8 -8
- {e6data_python_connector-2.1.10.dev0.dist-info → e6data_python_connector-2.1.11.dist-info}/LICENSE +0 -0
- {e6data_python_connector-2.1.10.dev0.dist-info → e6data_python_connector-2.1.11.dist-info}/WHEEL +0 -0
- {e6data_python_connector-2.1.10.dev0.dist-info → e6data_python_connector-2.1.11.dist-info}/entry_points.txt +0 -0
- {e6data_python_connector-2.1.10.dev0.dist-info → e6data_python_connector-2.1.11.dist-info}/top_level.txt +0 -0
|
@@ -174,7 +174,7 @@ def read_values_from_array(query_columns_description: list, dis: DataInputStream
|
|
|
174
174
|
return value_array
|
|
175
175
|
|
|
176
176
|
|
|
177
|
-
def
|
|
177
|
+
def read_rows_from_chunk(query_columns_description: list, buffer):
|
|
178
178
|
# Create a transport and protocol instance for deserialization
|
|
179
179
|
transport = TTransport.TMemoryBuffer(buffer)
|
|
180
180
|
protocol = TBinaryProtocol.TBinaryProtocolAccelerated(transport)
|
|
@@ -182,16 +182,8 @@ def reconstruct_chunk(buffer):
|
|
|
182
182
|
# Create an instance of the Thrift struct and read from the protocol
|
|
183
183
|
chunk = Chunk()
|
|
184
184
|
chunk.read(protocol)
|
|
185
|
-
return chunk
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
def read_rows_from_chunk(query_columns_description: list, buffer):
|
|
189
|
-
chunk = reconstruct_chunk(buffer)
|
|
190
|
-
return deserialize_chunk_to_rows(query_columns_description, chunk)
|
|
191
|
-
|
|
192
185
|
|
|
193
|
-
|
|
194
|
-
if chunk is None or chunk.size <= 0:
|
|
186
|
+
if chunk.size <= 0:
|
|
195
187
|
return None
|
|
196
188
|
|
|
197
189
|
rows = list()
|
|
@@ -19,8 +19,7 @@ import grpc
|
|
|
19
19
|
|
|
20
20
|
from e6data_python_connector.common import DBAPITypeObject, ParamEscaper, DBAPICursor
|
|
21
21
|
from e6data_python_connector.constants import *
|
|
22
|
-
from e6data_python_connector.datainputstream import get_query_columns_info, read_rows_from_chunk
|
|
23
|
-
deserialize_chunk_to_rows
|
|
22
|
+
from e6data_python_connector.datainputstream import get_query_columns_info, read_rows_from_chunk
|
|
24
23
|
from e6data_python_connector.server import e6x_engine_pb2_grpc, e6x_engine_pb2
|
|
25
24
|
from e6data_python_connector.typeId import *
|
|
26
25
|
|
|
@@ -73,11 +72,11 @@ class HiveParamEscaper(ParamEscaper):
|
|
|
73
72
|
item = item.decode('utf-8')
|
|
74
73
|
return "'{}'".format(
|
|
75
74
|
item
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
.replace('\\', '\\\\')
|
|
76
|
+
.replace("'", "\\'")
|
|
77
|
+
.replace('\r', '\\r')
|
|
78
|
+
.replace('\n', '\\n')
|
|
79
|
+
.replace('\t', '\\t')
|
|
81
80
|
)
|
|
82
81
|
|
|
83
82
|
|
|
@@ -163,12 +162,14 @@ class Connection(object):
|
|
|
163
162
|
self._keepalive_timeout_ms = 900000
|
|
164
163
|
self._max_receive_message_length = -1
|
|
165
164
|
self._max_send_message_length = 300 * 1024 * 1024 # mb
|
|
165
|
+
self._grpc_prepare_timeout = 10 * 60 # 10 minutes
|
|
166
166
|
|
|
167
167
|
if type(grpc_options) == dict:
|
|
168
168
|
self._keepalive_timeout_ms = grpc_options.get('keepalive_timeout_ms') or self._keepalive_timeout_ms
|
|
169
169
|
self._max_receive_message_length = grpc_options.get(
|
|
170
170
|
'max_receive_message_length') or self._max_receive_message_length
|
|
171
171
|
self._max_send_message_length = grpc_options.get('max_send_message_length') or self._max_send_message_length
|
|
172
|
+
self._grpc_prepare_timeout = grpc_options.get('grpc_prepare_timeout') or self._grpc_prepare_timeout
|
|
172
173
|
self._create_client()
|
|
173
174
|
|
|
174
175
|
def _create_client(self):
|
|
@@ -414,6 +415,10 @@ class Cursor(DBAPICursor):
|
|
|
414
415
|
def close(self):
|
|
415
416
|
"""Close the operation handle"""
|
|
416
417
|
# self.connection.close()
|
|
418
|
+
try:
|
|
419
|
+
self.clear()
|
|
420
|
+
except:
|
|
421
|
+
pass
|
|
417
422
|
self._arraysize = None
|
|
418
423
|
self.connection = None
|
|
419
424
|
self._data = None
|
|
@@ -506,7 +511,8 @@ class Cursor(DBAPICursor):
|
|
|
506
511
|
)
|
|
507
512
|
prepare_statement_response = client.prepareStatementV2(
|
|
508
513
|
prepare_statement_request,
|
|
509
|
-
metadata=self.metadata
|
|
514
|
+
metadata=self.metadata,
|
|
515
|
+
timeout=self._grpc_prepare_timeout
|
|
510
516
|
)
|
|
511
517
|
|
|
512
518
|
self._query_id = prepare_statement_response.queryId
|
|
@@ -520,14 +526,15 @@ class Cursor(DBAPICursor):
|
|
|
520
526
|
execute_statement_request,
|
|
521
527
|
metadata=self.metadata
|
|
522
528
|
)
|
|
523
|
-
self.
|
|
529
|
+
self.update_mete_data()
|
|
524
530
|
return self._query_id
|
|
525
531
|
|
|
526
532
|
@property
|
|
527
533
|
def rowcount(self):
|
|
534
|
+
self.update_mete_data()
|
|
528
535
|
return self._rowcount
|
|
529
536
|
|
|
530
|
-
def
|
|
537
|
+
def update_mete_data(self):
|
|
531
538
|
result_meta_data_request = e6x_engine_pb2.GetResultMetadataRequest(
|
|
532
539
|
engineIP=self._engine_ip,
|
|
533
540
|
sessionId=self.connection.get_session_id,
|
|
@@ -571,7 +578,7 @@ class Cursor(DBAPICursor):
|
|
|
571
578
|
return
|
|
572
579
|
yield rows
|
|
573
580
|
|
|
574
|
-
def
|
|
581
|
+
def fetch_batch(self):
|
|
575
582
|
client = self.connection.client
|
|
576
583
|
get_next_result_batch_request = e6x_engine_pb2.GetNextResultBatchRequest(
|
|
577
584
|
engineIP=self._engine_ip,
|
|
@@ -584,32 +591,17 @@ class Cursor(DBAPICursor):
|
|
|
584
591
|
)
|
|
585
592
|
buffer = get_next_result_batch_response.resultBatch
|
|
586
593
|
if not self._is_metadata_updated:
|
|
587
|
-
self.
|
|
594
|
+
self.update_mete_data()
|
|
588
595
|
if not buffer or len(buffer) == 0:
|
|
589
596
|
return None
|
|
590
|
-
return buffer
|
|
591
|
-
|
|
592
|
-
def fetch_batch(self):
|
|
593
|
-
buffer = self.get_next_batch()
|
|
594
597
|
# one batch retrieves the predefined set of rows
|
|
595
598
|
return read_rows_from_chunk(self._query_columns_description, buffer)
|
|
596
599
|
|
|
597
|
-
def fetch_all_columnar(self):
|
|
598
|
-
list_chunk = list()
|
|
599
|
-
while True:
|
|
600
|
-
buffer = self.get_next_batch()
|
|
601
|
-
if buffer is None:
|
|
602
|
-
break
|
|
603
|
-
chunk = reconstruct_chunk(buffer)
|
|
604
|
-
list_chunk.append(chunk)
|
|
605
|
-
result = ColumnarResult(list_chunk, self._query_columns_description)
|
|
606
|
-
return result
|
|
607
|
-
|
|
608
600
|
def fetchall(self):
|
|
609
601
|
return self._fetch_all()
|
|
610
602
|
|
|
611
603
|
def fetchmany(self, size: int = None):
|
|
612
|
-
# _logger.info("fetching all from
|
|
604
|
+
# _logger.info("fetching all from overriden method")
|
|
613
605
|
if size is None:
|
|
614
606
|
size = self.arraysize
|
|
615
607
|
if self._data is None:
|
|
@@ -689,41 +681,6 @@ class Error(Exception):
|
|
|
689
681
|
pass
|
|
690
682
|
|
|
691
683
|
|
|
692
|
-
class ColumnarResult:
|
|
693
|
-
def __init__(self, list_chunk, list_column_description):
|
|
694
|
-
self.rows = None
|
|
695
|
-
self._list_chunk = list_chunk
|
|
696
|
-
self._cur_chunk = None
|
|
697
|
-
self._list_column_description = list_column_description
|
|
698
|
-
self._cur_chunk_index = 0
|
|
699
|
-
self._cur_chunk_row_idx = 0
|
|
700
|
-
|
|
701
|
-
def get_next_row(self):
|
|
702
|
-
if self._cur_chunk is None or self._cur_chunk_row_idx >= self._cur_chunk.size:
|
|
703
|
-
self.move_to_next_chunk()
|
|
704
|
-
self.rows = deserialize_chunk_to_rows(self._list_column_description, self._cur_chunk)
|
|
705
|
-
_cur_chunk_row_idx = 0
|
|
706
|
-
if self._cur_chunk is None:
|
|
707
|
-
return None
|
|
708
|
-
row = self.rows[self._cur_chunk_row_idx]
|
|
709
|
-
self._cur_chunk_row_idx += 1
|
|
710
|
-
return row
|
|
711
|
-
|
|
712
|
-
def move_to_next_chunk(self):
|
|
713
|
-
if self._cur_chunk_index >= len(self._list_chunk):
|
|
714
|
-
self._cur_chunk = None
|
|
715
|
-
|
|
716
|
-
else:
|
|
717
|
-
self._cur_chunk = self._list_chunk[self._cur_chunk_index]
|
|
718
|
-
self._cur_chunk_index += 1
|
|
719
|
-
|
|
720
|
-
def size(self):
|
|
721
|
-
size = 0
|
|
722
|
-
for chunk in self._list_chunk:
|
|
723
|
-
size += chunk.size
|
|
724
|
-
return size
|
|
725
|
-
|
|
726
|
-
|
|
727
684
|
#
|
|
728
685
|
# Type Objects and Constructors
|
|
729
686
|
#
|
{e6data_python_connector-2.1.10.dev0.dist-info → e6data_python_connector-2.1.11.dist-info}/RECORD
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
e6data_python_connector/__init__.py,sha256=x_VwhPQ7XLlthR-NJL9Vl7lkLBRCG2pSjmyZSBHOBpM,103
|
|
2
2
|
e6data_python_connector/common.py,sha256=nk0CDQ5j1iu8DctBOXX4QypPYmxSgIgoA-Cn1UZXLic,9976
|
|
3
3
|
e6data_python_connector/constants.py,sha256=h5w0lWiFsxz__zUZRlo1f72-8mT_vt9gcWvtWh0viFI,682
|
|
4
|
-
e6data_python_connector/datainputstream.py,sha256=
|
|
4
|
+
e6data_python_connector/datainputstream.py,sha256=DheV5Vo7-UldLAQuhV2payLoFLM8jvaunRTaUhYUhMU,11498
|
|
5
5
|
e6data_python_connector/date_time_utils.py,sha256=ew1CjhfB93trRdu8jBOy2ihZNSecDPcmxS1USmWxqzE,13623
|
|
6
6
|
e6data_python_connector/dialect.py,sha256=M7vMHJgbnGqUdlY-XcDyeeXPwll9O7j1YAaySECLNpA,11177
|
|
7
|
-
e6data_python_connector/e6data_grpc.py,sha256=
|
|
7
|
+
e6data_python_connector/e6data_grpc.py,sha256=arrbGX3sWAl-gDJmdBfMIvMI_PDCaGIDHDqifhChdG4,24461
|
|
8
8
|
e6data_python_connector/exceptions.py,sha256=vrUqdzMq3LjbCmvr5_TcRq9eKmdqGfe-uVjR0BJQf5U,382
|
|
9
9
|
e6data_python_connector/typeId.py,sha256=2EMNWK2SO5CBReNuJphma6xp-69r9GDwwys66t-kSk0,1777
|
|
10
10
|
e6data_python_connector/e6x_vector/__init__.py,sha256=YFcZTT8Cm-6Y4oTiCaqq0DT1lw2W09WqoEc5_pTAwW0,34
|
|
@@ -17,9 +17,9 @@ e6data_python_connector/server/e6x_engine_pb2.py,sha256=BxJjbijNrEqXQTWEhzLm54Fq
|
|
|
17
17
|
e6data_python_connector/server/e6x_engine_pb2.pyi,sha256=_aQDLFbSCQ7ubK0Z5ZKh9_VAHFaXbMV55MXYXr85srg,18693
|
|
18
18
|
e6data_python_connector/server/e6x_engine_pb2_grpc.py,sha256=n-eTCsAjsmpgPA_bDansKZq_zMmqkK6TlQGn6IdT6L4,46671
|
|
19
19
|
e6data_python_connector/server/ttypes.py,sha256=uWxwSp4m6e-7SeSEckbZtSduGYmfzXWM09iy5eltBPA,21227
|
|
20
|
-
e6data_python_connector-2.1.
|
|
21
|
-
e6data_python_connector-2.1.
|
|
22
|
-
e6data_python_connector-2.1.
|
|
23
|
-
e6data_python_connector-2.1.
|
|
24
|
-
e6data_python_connector-2.1.
|
|
25
|
-
e6data_python_connector-2.1.
|
|
20
|
+
e6data_python_connector-2.1.11.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
21
|
+
e6data_python_connector-2.1.11.dist-info/METADATA,sha256=WsWEk2-eeQfu2MGaEJIrtZt-gMiaN9snYwNH-mx3zDY,6944
|
|
22
|
+
e6data_python_connector-2.1.11.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
23
|
+
e6data_python_connector-2.1.11.dist-info/entry_points.txt,sha256=MDK4cAOND0preLvq2Tlpnz00wXnP_Y_UopqJsAf3U7Y,77
|
|
24
|
+
e6data_python_connector-2.1.11.dist-info/top_level.txt,sha256=ChOS6qLf-SQycXr0uBiVxomIfYfbH2SgwrOWhW79ab0,24
|
|
25
|
+
e6data_python_connector-2.1.11.dist-info/RECORD,,
|
{e6data_python_connector-2.1.10.dev0.dist-info → e6data_python_connector-2.1.11.dist-info}/LICENSE
RENAMED
|
File without changes
|
{e6data_python_connector-2.1.10.dev0.dist-info → e6data_python_connector-2.1.11.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|