hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Suhail Doshi <digitalwarf...@gmail.com>
Subject Re: Java/Python examples
Date Sun, 22 Mar 2009 00:14:58 GMT
Perhaps I am incorrectly setting/using my pythonpath:

PYTHONPATH=/home/hadoop/hive/build/dist/lib/py/

li57-125 ~/hive: python hive_test.py
Traceback (most recent call last):
  File "hive_test.py", line 13, in <module>
    from hive import ThriftHive
ImportError: No module named hive

li57-125 ~/hive/build/dist/lib/py: ls -l
total 32
-rw-r--r-- 1 hadoop hadoop    0 Mar 15 01:35 __init__.py
drwxr-xr-x 2 hadoop hadoop 4096 Mar 22 00:10 fb303
drwxr-xr-x 2 hadoop hadoop 4096 Mar 20 23:06 fb303_scripts
drwxr-xr-x 2 hadoop hadoop 4096 Mar 22 00:10 hive_metastore
drwxr-xr-x 2 hadoop hadoop 4096 Mar 20 23:06 hive_serde
drwxr-xr-x 2 hadoop hadoop 4096 Mar 20 23:06 hive_service
drwxr-xr-x 2 hadoop hadoop 4096 Mar 15 01:35 org_apache_hadoop_hive_serde
drwxr-xr-x 2 hadoop hadoop 4096 Mar 15 01:35 serde
drwxr-xr-x 6 hadoop hadoop 4096 Mar 22 00:10 thrift


On Sat, Mar 21, 2009 at 5:04 PM, Raghu Murthy <raghu@facebook.com> wrote:

> Use build/dist/lib/py instead of gen-py. All modules are copied to that
> directory once you run ant package.
>
>
> On 3/21/09 2:17 PM, "Suhail Doshi" <digitalwarfare@gmail.com> wrote:
>
> > I seem to be getting the following error:
> >
> > Traceback (most recent call last):
> >   File "hive_test.py", line 13, in <module>
> >     from hive import ThriftHive
> >   File "ThriftHive.py", line 8, in <module>
> > ImportError: No module named hive_metastore.ThriftHiveMetastore
> >
> > There's a symlink gen-py -> /home/hadoop/hive/service/src/gen-py in the
> folder
> > with the py script.
> >
> > With the following code:
> >
> > #!/usr/bin/evn python
> > import sys
> > import os
> >
> > dir = os.path.dirname(os.path.realpath(sys.argv[0]))
> > sys.path.insert(0, dir + '/gen-py')
> >
> > from thrift import Thrift
> > from thrift.transport import TSocket
> > from thrift.transport import TTransport
> > from thrift.protocol import TBinaryProtocol
> >
> > from hive import ThriftHive
> >
> > transport = TSocket.TSocket('localhost', 9090)
> > transport = TTransport.TBufferedTransport(transport)
> > protocol = TBinaryProtocol.TBinaryProtocol(transport)
> >
> > client = ThriftHive.Client(protocol)
> >
> > print client
> >
> >
> >
> > On Fri, Mar 20, 2009 at 4:06 PM, Suhail Doshi <digitalwarfare@gmail.com>
> > wrote:
> >> Whoops, silly mistake, nevermind =)
> >>
> >>
> >> On Fri, Mar 20, 2009 at 3:55 PM, Suhail Doshi <digitalwarfare@gmail.com
> >
> >> wrote:
> >>> Namit,
> >>>
> >>> For some reason when I apply:
> >>> li57-125 ~/hive: patch -p0 hive-py.patch
> >>>
> >>> It seems just hang for a while.
> >>>
> >>> Suhail
> >>>
> >>>
> >>> On Fri, Mar 20, 2009 at 12:58 PM, Namit Jain <njain@facebook.com>
> wrote:
> >>>> Download the patch file <patch_file>
> >>>>
> >>>>
> >>>>
> >>>> Go to the truck directory, and perform
> >>>>
> >>>>
> >>>>
> >>>> patch  -p0 < <patch_file>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> Then compile and run tests.
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> From: Suhail Doshi [mailto:digitalwarfare@gmail.com]
> >>>> Sent: Friday, March 20, 2009 12:52 PM
> >>>> To: hive-user@hadoop.apache.org
> >>>> Subject: Re: Java/Python examples
> >>>>
> >>>>
> >>>>
> >>>> Ragu,
> >>>>
> >>>> How is exactly do you apply the patches?
> >>>>
> >>>> Suhail
> >>>>
> >>>> On Sun, Mar 15, 2009 at 3:57 PM, Raghu Murthy <raghu@facebook.com>
> wrote:
> >>>>
> >>>> You can call Hive in Java either directly or in client-server mode
> where
> >>>> you
> >>>> would have to run a thrift server.
> >>>> Python and php clients are currently only available in patches at
> >>>> https://issues.apache.org/jira/browse/HIVE-343 and
> >>>> https://issues.apache.org/jira/browse/HIVE-299 respectively.
> >>>>
> >>>> If you apply the patches and then run ant package, the documentation
> at
> >>>> http://wiki.apache.org/hadoop/Hive/HiveServer should be useful. Hope
> this
> >>>> helps.
> >>>>
> >>>> raghu
> >>>>
> >>>>
> >>>> On 3/15/09 12:22 PM, "Suhail Doshi" <suhail@mixpanel.com> wrote:
> >>>>
> >>>>>> I was browsing around the Hive wiki and couldn't manage to find
any
> >>>>> examples
> >>>>>> on how people might be connecting to hive and executing queries
> through
> >>>>>> java/python. Anyone have anything available? (Python preferable)
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> http://mixpanel.com
> >>>> Blog: http://blog.mixpanel.com
> >>>
> >>>
> >>>
> >>> --
> >>> http://mixpanel.com
> >>> Blog: http://blog.mixpanel.com
> >>
> >>
> >>
> >> --
> >> http://mixpanel.com
> >> Blog: http://blog.mixpanel.com
> >
> >
>
>


-- 
http://mixpanel.com
Blog: http://blog.mixpanel.com

Mime
View raw message