Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# e6data Python Connector

![version](https://img.shields.io/badge/version-1.1.0-blue.svg)
![version](https://img.shields.io/badge/version-1.1.1-blue.svg)

## Introduction

Expand Down
26 changes: 17 additions & 9 deletions e6data_python_connector/e6xgrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,29 @@ def __init__(
password=None,
check_hostname=None,
ssl_cert=None,
thrift_transport=None
thrift_transport=None,
keepalive_timeout_ms=900000
):
if not username or not password:
raise ValueError("username or password cannot be empty.")
if not host or not port:
raise ValueError("host or port cannot be empty.")
self.__username = username
self.__password = password
self._database = database
self._session_id = None
self._host = host

if not self.__username or not self.__password:
raise ValueError("username or password cannot be empty.")
if port is None:
port = 9000
self._port = port
self._channel = grpc.insecure_channel('{}:{}'.format(host, port))
self._keepalive_timeout_ms = keepalive_timeout_ms
self._create_client()

def _create_client(self):
self._channel = grpc.insecure_channel(
target='{}:{}'.format(self._host, self._port),
options=[
("grpc.keepalive_timeout_ms", self._keepalive_timeout_ms),
],
)
self._client = e6x_engine_pb2_grpc.QueryEngineServiceStub(self._channel)

@property
Expand All @@ -139,7 +148,6 @@ def get_session_id(self):
self._session_id = authenticate_response.sessionId
if not self._session_id:
raise ValueError("Invalid credentials.")
# self._client.setSchema(database)
except Exception as e:
self._channel.close()
raise e
Expand Down Expand Up @@ -183,7 +191,7 @@ def clear(self, query_id, engine_ip=None):

def reopen(self):
self._channel.close()
self._channel = grpc.insecure_channel('{}:{}'.format(self._host, self._port))
self._create_client()

def query_cancel(self, engine_ip, query_id):
cancel_query_request = e6x_engine_pb2.CancelQueryRequest(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

envstring = lambda var: os.environ.get(var) or ""

VERSION = [1, 1, 0]
VERSION = [1, 1, 1]


def get_long_desc():
Expand Down