e6data-python-connector 2.2.0__py3-none-any.whl → 2.2.0rc0__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.
@@ -53,14 +53,31 @@ def _parse_timestamp(value):
53
53
  value = datetime.datetime.strptime(value, format)
54
54
  else:
55
55
  raise Exception(
56
- 'Cannot convert "{}" into a datetime'.format(value))
56
+ 'Cannot convert "{}" into a datetime'.format(value)
57
+ )
57
58
  else:
58
59
  value = None
59
60
  return value
60
61
 
61
62
 
62
- TYPES_CONVERTER = {"DECIMAL_TYPE": Decimal,
63
- "TIMESTAMP_TYPE": _parse_timestamp}
63
+ TYPES_CONVERTER = {
64
+ "DECIMAL_TYPE": Decimal,
65
+ "TIMESTAMP_TYPE": _parse_timestamp
66
+ }
67
+
68
+
69
+ def re_auth(func):
70
+ def wrapper(self, *args, **kwargs):
71
+ try:
72
+ return func(self, *args, **kwargs)
73
+ except _InactiveRpcError as e:
74
+ if e.code() == grpc.StatusCode.INTERNAL and 'Access denied' in e.details():
75
+ self.connection.get_re_authenticate_session_id()
76
+ return func(self, *args, **kwargs)
77
+ else:
78
+ raise e
79
+
80
+ return wrapper
64
81
 
65
82
 
66
83
  class HiveParamEscaper(ParamEscaper):
@@ -202,6 +219,10 @@ class Connection(object):
202
219
  )
203
220
  self._client = e6x_engine_pb2_grpc.QueryEngineServiceStub(self._channel)
204
221
 
222
+ def get_re_authenticate_session_id(self):
223
+ self._session_id = None
224
+ return self.get_session_id
225
+
205
226
  @property
206
227
  def get_session_id(self):
207
228
  """
@@ -496,6 +517,7 @@ class Cursor(DBAPICursor):
496
517
  )
497
518
  return self.connection.client.status(status_request, metadata=self.metadata)
498
519
 
520
+ @re_auth
499
521
  def execute(self, operation, parameters=None, **kwargs):
500
522
  """Prepare and execute a database operation (query or command).
501
523
  Return values are not defined.
@@ -551,6 +573,7 @@ class Cursor(DBAPICursor):
551
573
 
552
574
  self._query_id = prepare_statement_response.queryId
553
575
  self._engine_ip = prepare_statement_response.engineIP
576
+
554
577
  execute_statement_request = e6x_engine_pb2.ExecuteStatementV2Request(
555
578
  engineIP=self._engine_ip,
556
579
  sessionId=self.connection.get_session_id,
@@ -635,7 +658,6 @@ class Cursor(DBAPICursor):
635
658
  return self._fetch_all()
636
659
 
637
660
  def fetchmany(self, size: int = None):
638
- # _logger.info("fetching all from overriden method")
639
661
  if size is None:
640
662
  size = self.arraysize
641
663
  if self._data is None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: e6data-python-connector
3
- Version: 2.2.0
3
+ Version: 2.2.0rc0
4
4
  Summary: Client for the e6data distributed SQL Engine.
5
5
  Home-page: https://github.com/e6x-labs/e6data-python-connector
6
6
  Author: Uniphi, Inc.
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.8
15
15
  Classifier: Programming Language :: Python :: 3.9
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: sqlalchemy >=1.0.0
18
+ Requires-Dist: sqlalchemy>=1.0.0
19
19
  Requires-Dist: future
20
20
  Requires-Dist: python-dateutil
21
21
  Requires-Dist: pycryptodome
@@ -27,7 +27,7 @@ Requires-Dist: sqlalchemy
27
27
 
28
28
  # e6data Python Connector
29
29
 
30
- ![version](https://img.shields.io/badge/version-2.2.0-blue.svg)
30
+ ![version](https://img.shields.io/badge/version-2.2.0.rc0-blue.svg)
31
31
 
32
32
  ## Introduction
33
33
 
@@ -5,7 +5,7 @@ e6data_python_connector/constants.py,sha256=h5w0lWiFsxz__zUZRlo1f72-8mT_vt9gcWvt
5
5
  e6data_python_connector/datainputstream.py,sha256=2XKW__PCGfTQ55Puqgie2LZdk_WU-YKwpEIUOQEF-sY,12592
6
6
  e6data_python_connector/date_time_utils.py,sha256=zmIwRhEGJwDvCOUjAl6VTDWGppluA-DPl_ioHTNpJKI,14413
7
7
  e6data_python_connector/dialect.py,sha256=hkVRjXxx9DhS8-aHpSoyMVhhHxVs3jdTE60x2aOAf5I,11312
8
- e6data_python_connector/e6data_grpc.py,sha256=aWXyqcvCYwOHZTLw78u9do7HLrHP8B_PdUORKJkupVc,26198
8
+ e6data_python_connector/e6data_grpc.py,sha256=Zk0TMK61IGCII9biNI5GnGVbNF9uzWIuHftwLt4llCM,26695
9
9
  e6data_python_connector/exceptions.py,sha256=vrUqdzMq3LjbCmvr5_TcRq9eKmdqGfe-uVjR0BJQf5U,382
10
10
  e6data_python_connector/typeId.py,sha256=2EMNWK2SO5CBReNuJphma6xp-69r9GDwwys66t-kSk0,1777
11
11
  e6data_python_connector/cluster_server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -21,9 +21,9 @@ e6data_python_connector/server/e6x_engine_pb2.py,sha256=BxJjbijNrEqXQTWEhzLm54Fq
21
21
  e6data_python_connector/server/e6x_engine_pb2.pyi,sha256=_aQDLFbSCQ7ubK0Z5ZKh9_VAHFaXbMV55MXYXr85srg,18693
22
22
  e6data_python_connector/server/e6x_engine_pb2_grpc.py,sha256=n-eTCsAjsmpgPA_bDansKZq_zMmqkK6TlQGn6IdT6L4,46671
23
23
  e6data_python_connector/server/ttypes.py,sha256=uWxwSp4m6e-7SeSEckbZtSduGYmfzXWM09iy5eltBPA,21227
24
- e6data_python_connector-2.2.0.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
25
- e6data_python_connector-2.2.0.dist-info/METADATA,sha256=PvCPU5GLB2honDEnliigIxSf07k71w7E8SHq5ExN6P8,6942
26
- e6data_python_connector-2.2.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
27
- e6data_python_connector-2.2.0.dist-info/entry_points.txt,sha256=MDK4cAOND0preLvq2Tlpnz00wXnP_Y_UopqJsAf3U7Y,77
28
- e6data_python_connector-2.2.0.dist-info/top_level.txt,sha256=ChOS6qLf-SQycXr0uBiVxomIfYfbH2SgwrOWhW79ab0,24
29
- e6data_python_connector-2.2.0.dist-info/RECORD,,
24
+ e6data_python_connector-2.2.0rc0.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
25
+ e6data_python_connector-2.2.0rc0.dist-info/METADATA,sha256=SpImMu_oNyTBJCGYfQshpGuL3_FJeK6sLCNyQMptYrE,6948
26
+ e6data_python_connector-2.2.0rc0.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
27
+ e6data_python_connector-2.2.0rc0.dist-info/entry_points.txt,sha256=MDK4cAOND0preLvq2Tlpnz00wXnP_Y_UopqJsAf3U7Y,77
28
+ e6data_python_connector-2.2.0rc0.dist-info/top_level.txt,sha256=ChOS6qLf-SQycXr0uBiVxomIfYfbH2SgwrOWhW79ab0,24
29
+ e6data_python_connector-2.2.0rc0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (74.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5