ibis.impala.api.connect

ibis.impala.api.connect(host='localhost', port=21050, database='default', timeout=45, use_ssl=False, ca_cert=None, user=None, password=None, auth_mechanism='NOSASL', kerberos_service_name='impala', pool_size=8, hdfs_client=None)

Create an ImpalaClient for use with Ibis.

Parameters
hoststr, optional

Host name of the impalad or HiveServer2 in Hive

portint, optional

Impala’s HiveServer2 port

databasestr, optional

Default database when obtaining new cursors

timeoutint, optional

Connection timeout in seconds when communicating with HiveServer2

use_sslbool, optional

Use SSL when connecting to HiveServer2

ca_certstr, optional

Local path to 3rd party CA certificate or copy of server certificate for self-signed certificates. If SSL is enabled, but this argument is None, then certificate validation is skipped.

userstr, optional

LDAP user to authenticate

passwordstr, optional

LDAP password to authenticate

auth_mechanismstr, optional

{‘NOSASL’ <- default, ‘PLAIN’, ‘GSSAPI’, ‘LDAP’}. Use NOSASL for non-secured Impala connections. Use PLAIN for non-secured Hive clusters. Use LDAP for LDAP authenticated connections. Use GSSAPI for Kerberos-secured clusters.

kerberos_service_namestr, optional

Specify particular impalad service principal.

Returns
ImpalaClient

Examples

>>> import ibis
>>> import os
>>> hdfs_host = os.environ.get('IBIS_TEST_NN_HOST', 'localhost')
>>> hdfs_port = int(os.environ.get('IBIS_TEST_NN_PORT', 50070))
>>> impala_host = os.environ.get('IBIS_TEST_IMPALA_HOST', 'localhost')
>>> impala_port = int(os.environ.get('IBIS_TEST_IMPALA_PORT', 21050))
>>> hdfs = ibis.hdfs_connect(host=hdfs_host, port=hdfs_port)
>>> hdfs  # doctest: +ELLIPSIS
<ibis.filesystems.WebHDFS object at 0x...>
>>> client = ibis.impala.connect(
...     host=impala_host,
...     port=impala_port,
...     hdfs_client=hdfs,
... )
>>> client  # doctest: +ELLIPSIS
<ibis.impala.client.ImpalaClient object at 0x...>