from impala.util import get_logger_and_init_null from impala.interface import Connection, Cursor, _bind_parameters from impala.error import (NotSupportedError, OperationalError, ProgrammingError, HiveServer2Error) from impala._thrift_api import ( get_socket, get_transport, TTransportException, TBinaryProtocol, TOpenSessionReq, TFetchResultsReq, TCloseSessionReq, TExecuteStatementReq, TGetInfoReq, TGetInfoType, TTypeId, TFetchOrientation, TGetResultSetMetadataReq, TStatusCode, TGetColumnsReq, TGetSchemasReq, TGetTablesReq, TGetFunctionsReq, TGetOperationStatusReq, TOperationState, TCancelOperationReq, TCloseOperationReq, TGetLogReq, TProtocolVersion, TGetRuntimeProfileReq, TGetExecSummaryReq, ImpalaHiveServer2Service, TExecStats, ThriftClient) log = get_logger_and_init_null(__name__) V6_VERSION = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V6 class HiveServer2Connection(Connection): # PEP 249 # HiveServer2Connection objects are associated with a TCLIService.Client # thrift service # it's instantiated with an alive TCLIService.Client def __init__(self, service, default_db=None): log.debug('HiveServer2Connection(service=%s, default_db=%s)', service, default_db) self.service = service self.default_db = default_db
# Thrift gains Py3 compatibility. # pylint: disable=wrong-import-position from __future__ import absolute_import import base64 import getpass import os import six import ssl import sys from impala.util import get_logger_and_init_null log = get_logger_and_init_null(__name__) if six.PY2: # pylint: disable=import-error,unused-import # import Apache Thrift code from thrift.transport.THttpClient import THttpClient from thrift.transport.TSocket import TSocket from thrift.transport.TTransport import (TBufferedTransport, TTransportException) from thrift.Thrift import TApplicationException from thrift.protocol.TBinaryProtocol import (TBinaryProtocolAccelerated as TBinaryProtocol) # import HS2 codegen objects from impala._thrift_gen.TCLIService.ttypes import ( TOpenSessionReq, TFetchResultsReq, TCloseSessionReq,