Question

In: Computer Science

"How can I connect to Hadoop Hive using Python? I've tried using PyHive but always get...

"How can I connect to Hadoop Hive using Python? I've tried using PyHive but always get the error:

...could not start SASL... no mechanism available: unable to find a callback: 2"

Solutions

Expert Solution

  • I believe that the most easiest way is to use PyHive.
  • To install PyHive you need some libraries:
    pip install sasl
    pip install thrift
    pip install thrift-sasl
    pip install PyHive
  • Note- Please keep in mind, although you install the library as PyHive, you need to import the module as pyhive, all in lower-case.
  1. For Linux- If you're on Linux, you may need to install SASL separately before running the above libraries.
  2. For Windows- There are some options on GNU.org, you can download a binary installer.
  3. For Mac- SASL should be available if you've installed xcode developer tools.
  • After installation, you can connect to Hive like this:
    from pyhive import hive
    conn = hive.Connection(host="YOUR_HIVE_HOST", port=PORT, username="TIGER")
  • Hive connection is made.
  • Queries to be given after connection:
    cursor = conn.cursor()
    cursor.execute("SELECT cool_stuff FROM hive_table")
    for result in cursor.fetchall():
      use_result(result)

Related Solutions

How can I prepare the context diagram, DFD and flowchart for payroll system? I've tried few...
How can I prepare the context diagram, DFD and flowchart for payroll system? I've tried few times but I have been asked to redo it again. Can anyone please explain or show me the correct way ?
When using scapy in python how can I get the same result as the snippit bellow?...
When using scapy in python how can I get the same result as the snippit bellow? (which in run in terminal) >>> sr(IP(dst="192.168.8.1")/TCP(dport=[21,22,23])) Received 6 packets, got 3 answers, remaining 0 packets (<Results: UDP:0 TCP:3 ICMP:0 Other:0>, <Unanswered: UDP:0 TCP:0 ICMP:0 Other:0>) >>> ans,unans=_ >>> ans.summary() IP / TCP 192.168.8.14:20 > 192.168.8.1:21 S ==> Ether / IP / TCP 192.168.8.1:21 > 192.168.8.14:20 RA / Padding IP / TCP 192.168.8.14:20 > 192.168.8.1:22 S ==> Ether / IP / TCP 192.168.8.1:22 >...
Early in my auditing career, I always wondered 'how do I know when I've got enough...
Early in my auditing career, I always wondered 'how do I know when I've got enough evidence to render an opinion?' How might you answer this?
I have the following python code. I get the following message when running it using a...
I have the following python code. I get the following message when running it using a test script which I cannot send here: while textstring[iterator].isspace(): # loop until we get other than space character IndexError: string index out of range. Please find out why and correct the code. def createWords(textstrings): createdWords = [] # empty list for textstring in textstrings: # iterate through each string in trxtstrings iterator = 0 begin = iterator # new begin variable while (iterator <...
This is the HW question I cannot get the correct answer for. I've completed the first...
This is the HW question I cannot get the correct answer for. I've completed the first step but I cannot seem to get the correct numbers for EFN for 20, 25 and 30%!?!? See below for given financial statements and my table with the pro forma of 20, 25 and 30% numbers The most recent financial statements for Scott, Inc., appear below. Interest expense will remain constant; the tax rate and the dividend payout rate also will remain constant. Costs,...
How can I get ATP and NADPH from DHAP using glycolysis and PPP?
How can I get ATP and NADPH from DHAP using glycolysis and PPP?
I have tried this multiple times and I can't get the right answer. The 2014 balance...
I have tried this multiple times and I can't get the right answer. The 2014 balance sheet of Jordan’s Golf Shop, Inc., showed long-term debt of $5.2 million, and the 2015 balance sheet showed long-term debt of $5.45 million. The 2015 income statement showed an interest expense of $170,000. The 2014 balance sheet showed $520,000 in the common stock account and $5.5 million in the additional paid-in surplus account. The 2015 balance sheet showed $560,000 and $5.7 million in the...
I'm trying to get the union of two arrays and I tried making a loop that...
I'm trying to get the union of two arrays and I tried making a loop that does so. I tried also making the loop give me the size of the array as well from the union of the two arrays. Please check my loop to see what is wrong with it because it is not doing what I want it to do. I'm also not sure how to get the correct size of the array after the two arrays have...
Can I please get an understanding to benchmarking in healthcare, thanks We are always comparing one...
Can I please get an understanding to benchmarking in healthcare, thanks We are always comparing one thing to another to see if it is somehow better. Whether we know it or not, this practice has a name. It is called benchmarking and that is the topic of this week’s discussion. Discuss what the actual term means. What is the purpose of this technique? Discuss what benchmarking isn’t? Discuss the 5 phases of benchmarking. Do you feel this is a useful...
can you teach me how to implement the ArrayStringList and LinkedStringList using the same interface? I've...
can you teach me how to implement the ArrayStringList and LinkedStringList using the same interface? I've implemented a couple of methods in my ArrayStringList but I'm not sure if I'm doing it correctly and im confused on how to do the splice, reverse, and a couple others. I'm also having trouble getting started on my LinkedStringList. In this project, you will be providing two different implementations of a StringList interface, which defines different operations that one should be able to...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT