コード例 #1
0
def establish_beeswax_connection(query_config):
    """Establish a connection to the user specified impalad.

  Args:
    query_config (QueryExecConfig)

  Returns:
    ImpalaBeeswaxClient is the connection suceeds, None otherwise.
  """
    use_kerberos = query_config.use_kerberos
    # If the impalad is for the form host, convert it to host:port that the Impala beeswax
    # client accepts.
    if len(query_config.impalad.split(":")) == 1:
        query_config.impalad = "{0}:{1}".format(query_config.impalad,
                                                DEFAULT_BEESWAX_PORT)
    client = None
    try:
        client = ImpalaBeeswaxClient(query_config.impalad,
                                     use_kerberos=use_kerberos)
        # Try connect
        client.connect()
        # Set the exec options.
        client.set_query_options(query_config.exec_options)
        LOG.info("Connected to %s" % query_config.impalad)
    except Exception, e:
        LOG.error("Error connecting: {0}".format(str(e)))
コード例 #2
0
 def client_factory():
     impala_client = ImpalaBeeswaxClient(options.impalad,
                                         use_kerberos=options.use_kerberos,
                                         use_ssl=options.use_ssl)
     impala_client.connect()
     yield impala_client
     impala_client.close_connection()
コード例 #3
0
ファイル: impala_connection.py プロジェクト: yx91490/impala-1
 def __init__(self,
              host_port,
              use_kerberos=False,
              user=None,
              password=None,
              use_ssl=False):
     self.__beeswax_client = ImpalaBeeswaxClient(host_port,
                                                 use_kerberos,
                                                 user=user,
                                                 password=password,
                                                 use_ssl=use_ssl)
     self.__host_port = host_port
     self.QUERY_STATES = self.__beeswax_client.query_states
コード例 #4
0
def establish_beeswax_connection(query, query_config):
    """Establish a connection to the user specified impalad.

  Args:
    query_config (QueryExecConfig)

  Returns:
    (boolean, ImpalaBeeswaxClient): True if successful
  """

    # TODO: Make this generic, for hive etc.
    use_kerberos = query_config.use_kerberos
    client = ImpalaBeeswaxClient(query_config.impalad,
                                 use_kerberos=use_kerberos)
    # Try connect
    client.connect()
    # Set the exec options.
    client.set_query_options(query_config.exec_options)
    LOG.info("Connected to %s" % query_config.impalad)
    return (True, client)
コード例 #5
0
def establish_beeswax_connection(query, query_config):
    """Establish a connection to the user specified impalad.

  Args:
    query_config (QueryExecConfig)

  Returns:
    (boolean, ImpalaBeeswaxClient): True if successful
  """
    use_kerberos = query_config.use_kerberos
    # If the impalad is for the form host, convert it to host:port that the Impala beeswax
    # client accepts.
    if len(query_config.impalad.split(":")) == 1:
        query_config.impalad = "{0}:{1}".format(query_config.impalad,
                                                DEFAULT_BEESWAX_PORT)
    client = ImpalaBeeswaxClient(query_config.impalad,
                                 use_kerberos=use_kerberos)
    # Try connect
    client.connect()
    # Set the exec options.
    client.set_query_options(query_config.exec_options)
    LOG.info("Connected to %s" % query_config.impalad)
    return (True, client)
コード例 #6
0
ファイル: impala_connection.py プロジェクト: ycaihua/Impala
 def __init__(self, host_port, use_kerberos=False):
     self.__beeswax_client = ImpalaBeeswaxClient(host_port, use_kerberos)
     self.__host_port = host_port
     self.QUERY_STATES = self.__beeswax_client.query_states