Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #97074 > unrolled thread

querying hive database using python

Started byheenameena1234@gmail.com
First post2015-09-24 06:49 -0700
Last post2015-09-24 21:33 -0400
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  querying hive database using python heenameena1234@gmail.com - 2015-09-24 06:49 -0700
    Re: querying hive database using python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-09-24 21:33 -0400

#97074 — querying hive database using python

Fromheenameena1234@gmail.com
Date2015-09-24 06:49 -0700
Subjectquerying hive database using python
Message-ID<7ea90b3f-5d25-4c70-ac65-40ce140e4564@googlegroups.com>
I have server A and Server B. Server B is a hadoop cluster which has hive database and etc..
Server A has python 2.7. I would like to write a hive query using python on Server A to pull data from Server B. Server A and B has connectivity and no issues with network etc..

I have installed all necessary python packages on Server A. I wrote a python code using hive_utils package but it seems this code doesn't throw error or pull data, just hangs there. Can you please take a look at it and let me know what is the issue with code or suggest if you have better way or package could be used to pull data with example code. Thank you for your help.

here is the code I wrote.
CODE: SELECT ALL
#!/usr/bin/env python
import hive_utils

query = """
    SELECT *
    FROM test
"""
hive_client = hive_utils.HiveClient(
    server='10.25.36.75',
    port=10000,
    db='camp'
)
a = hive_client.execute(query)
a = list(a)

[toc] | [next] | [standalone]


#97111

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2015-09-24 21:33 -0400
Message-ID<mailman.159.1443144814.28679.python-list@python.org>
In reply to#97074
On Thu, 24 Sep 2015 06:49:23 -0700 (PDT), heenameena1234@gmail.com
declaimed the following:

>a = hive_client.execute(query)
>a = list(a)

	1) if "hive_client" behaves anything like a DB-API interface, "a" is
maybe a result code, if anything... Is there a .fetch() method for
"hive_client"?

	2) your example code doesn't print (or anything else) with "a"
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web