Skip to content
Open
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
22 changes: 21 additions & 1 deletion pyhive/hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import thrift.transport.THttpClient
import thrift.protocol.TBinaryProtocol
import thrift.transport.TSocket
import thrift.transport.TSSLSocket
import thrift.transport.TTransport

# PEP 249 module globals
Expand Down Expand Up @@ -101,6 +102,19 @@ def connect(*args, **kwargs):

:returns: a :py:class:`Connection` object.
"""
configuration = {}

keylist = list(kwargs)

if 'configuration' in keylist:
configuration = kwargs['configuration']

for arg in keylist:
if re.match('^EXTRA_',arg):
configuration[arg] = kwargs.pop(arg)

kwargs['configuration'] = configuration

return Connection(*args, **kwargs)


Expand Down Expand Up @@ -194,7 +208,13 @@ def __init__(
port = 10000
if auth is None:
auth = 'NONE'
socket = thrift.transport.TSocket.TSocket(host, port)

if 'EXTRA_USE_SSL' in configuration.keys():
socket = thrift.transport.TSSLSocket.TSSLSocket(host, port, cert_reqs=CERT_NONE)
configuration.pop("EXTRA_USE_SSL")
else:
socket = thrift.transport.TSocket.TSocket(host, port)

if auth == 'NOSASL':
# NOSASL corresponds to hive.server2.authentication=NOSASL in hive-site.xml
self._transport = thrift.transport.TTransport.TBufferedTransport(socket)
Expand Down