MCPcopy Create free account
hub / github.com/apache/impala / ImpalaConnection

Class ImpalaConnection

tests/comparison/db_connection.py:850–895  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

848
849
850class ImpalaConnection(DbConnection):
851
852 PORT = 21050 # For HS2
853
854 _DB_TYPE = IMPALA
855 _CURSOR_CLASS = ImpalaCursor
856 _KERBEROS_SERVICE_NAME = 'impala'
857 _NON_KERBEROS_AUTH_MECH = 'NOSASL'
858
859 def __init__(self, use_kerberos=False, use_ssl=False, ca_cert=None, **kwargs):
860 self._use_kerberos = use_kerberos
861 self.cluster = None
862 self._use_ssl = use_ssl
863 self._ca_cert = ca_cert
864 DbConnection.__init__(self, **kwargs)
865
866 def clone(self, db_name):
867 clone = self._clone(db_name, use_kerberos=self._use_kerberos)
868 clone.cluster = self.cluster
869 return clone
870
871 @property
872 def data_types_are_implictly_nullable(self):
873 return True
874
875 @property
876 def supports_index_creation(self):
877 return False
878
879 def cursor(self):
880 cursor = super(ImpalaConnection, self).cursor()
881 cursor.arraysize = 1024 # Try to match the default batch size
882 return cursor
883
884 def _connect(self):
885 self._conn = impala.dbapi.connect(
886 host=self._host_name,
887 port=self._port,
888 user=self._user_name,
889 password=self._password,
890 database=self.db_name,
891 timeout=(60 * 60),
892 auth_mechanism=('GSSAPI' if self._use_kerberos else self._NON_KERBEROS_AUTH_MECH),
893 kerberos_service_name=self._KERBEROS_SERVICE_NAME,
894 use_ssl=self._use_ssl,
895 ca_cert=self._ca_cert)
896
897
898class HiveCursor(ImpalaCursor):

Callers 3

impala_testinfra_cursorFunction · 0.90
connectMethod · 0.90
start_impalaMethod · 0.90

Calls

no outgoing calls

Tested by 1

impala_testinfra_cursorFunction · 0.72