コード例 #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 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
  user = query_config.user
  password = query_config.password
  use_ssl = query_config.use_ssl
  # 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,
                                 user=user, password=password, use_ssl=use_ssl)
    # 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)))
コード例 #3
0
ファイル: query_executor.py プロジェクト: 1ack/Impala
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)
コード例 #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
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)