Discussion:
[Tutor] Access HBase
Michelle Meiduo Wu
2015-07-11 13:01:15 UTC
Permalink
Hi there,
I'm just starting to use Python. I'd like to ask which Library is good for Python to access HBASE?

Besides Happybase and Python HBase, is there any other one? Which is more robotic and better functional?

Any advice would be greatly appreciated.

Thank you,
Michelle

_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Laura Creighton
2015-07-11 17:53:19 UTC
Permalink
In a message of Sat, 11 Jul 2015 09:01:15 -0400, Michelle Meiduo Wu writes:
>Hi there,
>I'm just starting to use Python. I'd like to ask which Library is good for Python to access HBASE?
>
>Besides Happybase and Python HBase, is there any other one? Which is more robotic and better functional?
>
>Any advice would be greatly appreciated.
>
>Thank you,
>Michelle

One thing that people I know of are doing is connecting using Jython,
instead of CPython. see: http://wiki.apache.org/hadoop/Hbase/Jython

They say it is a _lot_ faster.

Laura

_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Michelle Meiduo Wu
2015-07-12 03:46:56 UTC
Permalink
Thanks a lot!

Do you know anything about HappyBase compared with Jython?

Best,
Michelle

> To: ***@hotmail.com
> CC: ***@python.org; ***@openend.se
> From: ***@openend.se
> Subject: Re: [Tutor] Access HBase
> Date: Sat, 11 Jul 2015 19:53:19 +0200
>
> In a message of Sat, 11 Jul 2015 09:01:15 -0400, Michelle Meiduo Wu writes:
> >Hi there,
> >I'm just starting to use Python. I'd like to ask which Library is good for Python to access HBASE?
> >
> >Besides Happybase and Python HBase, is there any other one? Which is more robotic and better functional?
> >
> >Any advice would be greatly appreciated.
> >
> >Thank you,
> >Michelle
>
> One thing that people I know of are doing is connecting using Jython,
> instead of CPython. see: http://wiki.apache.org/hadoop/Hbase/Jython
>
> They say it is a _lot_ faster.
>
> Laura
>

_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Laura Creighton
2015-07-12 10:46:15 UTC
Permalink
In a message of Sat, 11 Jul 2015 23:46:56 -0400, Michelle Meiduo Wu writes:
>Thanks a lot!
>
>Do you know anything about HappyBase compared with Jython?
>
>Best,
>Michelle

I don't know anything at all about HappyBase, and next to nothing about
Hadoop. But I know quite a bit about Jython.

The Python you get from python.org (and from ActiveState) is written
in the C programming language. That is why some of us often call it
CPython. However, there are other implementations of Python that
are not written in C, and one of them is called Jython. Jython is
the Python Programming lanaguage written in Java.

Now, in the Greater Python Programming World, most libraries you
would like to import and include in your own programs are written
in Python itself. They will be perfectly happy running under CPython
or under Jython. There are also a whole lot of libraries that are
written in C. Getting other things written in C to talk to CPython
is work, but it is a pretty straight forward business to wrap your
C libraries and getting them to work with CPython.

Getting something written in some other language than C to work with
CPython is much harder. C++ libraries get wrapped often enough that
we have standard ways of doing that, too, but it is a lot more work.
And C++ is, by design, a whole lot like C.

It is very rare that CPython developers bother to wrap something
written in any other language at all. So the world is full of
perfectly great libraries written in Java and the CPython world
basically never uses them because going from the Java world to the C
world is even harder.

On the Java side things are similar. If you like your Java world,
but want Python syntax, not Java syntax -- you would like to program
in Python -- you use Jython. If you want to use a library and it is
written in Python, you import that, and it just works. If you want
to use a library and it is written in Java, usually -- not all of the
time, but most of the time -- you can wrap it very easily, import it,
and it works. And if you want to use a C or a C++ library, things
get harder.

But your goal here is to talk to apache HBase, and that is a java
library. Somebody wanted that enough that they made CPython bindings
for that, and that is called Thrift, and all I know about that is that
it was so hard to use and error prone that the HappyBase developers
wrote HappyBase to wrap Thrift in something easier to use. If you
want to develop in CPython this is probably where you will end up.
(But somebody tomorrow could come by with information on a library
I have never heard of, of course.)

The other way to go after this is to develop your code with Jython
not CPython. Then you follow the instructions here:
http://wiki.apache.org/hadoop/Hbase/Jython

and you are good to go.

You just write to Hbase directly using Python syntax.

The next thing you need to do is see what other libraries you need to
use for your work, and see if they exist for Jython. For instance,
if you need NumPy, you cannot use Jython at this time. People are
working on this problem over here: http://jyni.org/ where they are
trying to build a better way to interface Jython with C and C++
programs, but they aren't close to being done yet.

Laura

_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Laura Creighton
2015-07-12 11:02:04 UTC
Permalink
In a message of Sun, 12 Jul 2015 12:46:15 +0200, Laura Creighton writes:
>If you want
>to use a library and it is written in Java, usually -- not all of the
>time, but most of the time -- you can wrap it very easily, import it,
>and it works.

I mispoke here. Most of the time you don't even have to wrap your
java libraries. They just work.

So this is the main reason for using Jython at all -- I want to use
these very nice java libraries, but I don't want to program in Java,
but in Python.

Laura
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Alan Gauld
2015-07-12 15:55:07 UTC
Permalink
On 12/07/15 12:02, Laura Creighton wrote:
> In a message of Sun, 12 Jul 2015 12:46:15 +0200, Laura Creighton writes:
>> If you want
>> to use a library and it is written in Java, usually -- not all of the
>> time, but most of the time -- you can wrap it very easily, import it,
>> and it works.
>
> I mispoke here. Most of the time you don't even have to wrap your
> java libraries. They just work.
>
> So this is the main reason for using Jython at all -- I want to use
> these very nice java libraries, but I don't want to program in Java,
> but in Python.

I'll just add slightly to that. I used to use Pyton in my days as an
architect because our development teams wrote their code in Java. I
could fire up Jython and just import a new library and use the
interactive prompt to test the new code. That was cool.

But there's another trick which is that Jython also has a compiler
so you can write a class in Python test it interactively, then
compile it so that it looks to Java like a native Java class and
Java code an use it. As an architect I could prototype ideas in
Python, and give the code for the Java guys to use. Once they
were happy they recoded it in native Java. Even more cool!

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Alan Gauld
2015-07-12 16:33:44 UTC
Permalink
On 12/07/15 16:55, Alan Gauld wrote:
> ... I used to use Pyton

Doh!
Pyton -> Jython...


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Michelle Meiduo Wu
2015-07-13 20:51:01 UTC
Permalink
Thanks a lot!Your information is very helpful. I believe it's easier to try HappyBase at beginning.
Thanks,Michelle
> To: ***@hotmail.com
> CC: ***@openend.se; ***@python.org; ***@openend.se
> From: ***@openend.se
> Subject: Re: [Tutor] Access HBase
> Date: Sun, 12 Jul 2015 12:46:15 +0200
>
> In a message of Sat, 11 Jul 2015 23:46:56 -0400, Michelle Meiduo Wu writes:
> >Thanks a lot!
> >
> >Do you know anything about HappyBase compared with Jython?
> >
> >Best,
> >Michelle
>
> I don't know anything at all about HappyBase, and next to nothing about
> Hadoop. But I know quite a bit about Jython.
>
> The Python you get from python.org (and from ActiveState) is written
> in the C programming language. That is why some of us often call it
> CPython. However, there are other implementations of Python that
> are not written in C, and one of them is called Jython. Jython is
> the Python Programming lanaguage written in Java.
>
> Now, in the Greater Python Programming World, most libraries you
> would like to import and include in your own programs are written
> in Python itself. They will be perfectly happy running under CPython
> or under Jython. There are also a whole lot of libraries that are
> written in C. Getting other things written in C to talk to CPython
> is work, but it is a pretty straight forward business to wrap your
> C libraries and getting them to work with CPython.
>
> Getting something written in some other language than C to work with
> CPython is much harder. C++ libraries get wrapped often enough that
> we have standard ways of doing that, too, but it is a lot more work.
> And C++ is, by design, a whole lot like C.
>
> It is very rare that CPython developers bother to wrap something
> written in any other language at all. So the world is full of
> perfectly great libraries written in Java and the CPython world
> basically never uses them because going from the Java world to the C
> world is even harder.
>
> On the Java side things are similar. If you like your Java world,
> but want Python syntax, not Java syntax -- you would like to program
> in Python -- you use Jython. If you want to use a library and it is
> written in Python, you import that, and it just works. If you want
> to use a library and it is written in Java, usually -- not all of the
> time, but most of the time -- you can wrap it very easily, import it,
> and it works. And if you want to use a C or a C++ library, things
> get harder.
>
> But your goal here is to talk to apache HBase, and that is a java
> library. Somebody wanted that enough that they made CPython bindings
> for that, and that is called Thrift, and all I know about that is that
> it was so hard to use and error prone that the HappyBase developers
> wrote HappyBase to wrap Thrift in something easier to use. If you
> want to develop in CPython this is probably where you will end up.
> (But somebody tomorrow could come by with information on a library
> I have never heard of, of course.)
>
> The other way to go after this is to develop your code with Jython
> not CPython. Then you follow the instructions here:
> http://wiki.apache.org/hadoop/Hbase/Jython
>
> and you are good to go.
>
> You just write to Hbase directly using Python syntax.
>
> The next thing you need to do is see what other libraries you need to
> use for your work, and see if they exist for Jython. For instance,
> if you need NumPy, you cannot use Jython at this time. People are
> working on this problem over here: http://jyni.org/ where they are
> trying to build a better way to interface Jython with C and C++
> programs, but they aren't close to being done yet.
>
> Laura
>

_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Alan Gauld
2015-07-12 15:57:36 UTC
Permalink
On 11/07/15 14:01, Michelle Meiduo Wu wrote:
> Hi there,
> I'm just starting to use Python. I'd like to ask which Library is good for Python to access HBASE?

I know next to nothing about HBase (I read the IBM blurb) but it looks
like it has a RESTful interface so you could access that directly via
the standard "urllib" library or the "requests" third party package.
I guess it depends on what you want to do and which API supports that.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Laura Creighton
2015-07-12 17:38:37 UTC
Permalink
In a message of Sun, 12 Jul 2015 16:57:36 +0100, Alan Gauld writes:
>On 11/07/15 14:01, Michelle Meiduo Wu wrote:
>> Hi there,
>> I'm just starting to use Python. I'd like to ask which Library is good for Python to access HBASE?
>
>I know next to nothing about HBase (I read the IBM blurb) but it looks
>like it has a RESTful interface so you could access that directly via
>the standard "urllib" library or the "requests" third party package.
>I guess it depends on what you want to do and which API supports that.
>
>--
>Alan G

Maybe, and somebody tried over here using urlib:
https://github.com/tousif/Hwrapper/tree/master/Hwrapper
(which I have never used, so I have no idea if the code even works)
but since HBase is all about really, really, really big tables
I suspect there are some optimisations that you need to have to
get decent performance at all. But again, I haven't used the thing
so my opinion isn't worth much.

Laura

_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Francois Dion
2015-07-14 16:05:24 UTC
Permalink
On Sat, Jul 11, 2015 at 9:01 AM, Michelle Meiduo Wu <***@hotmail.com>
wrote:

> Hi there,
> I'm just starting to use Python. I'd like to ask which Library is good for
> Python to access HBASE?
>

I think the Python for Data Science group would be a good place to ask:

https://groups.google.com/forum/?fromgroups#!forum/pydata

If you are just starting out in Python, though, I would suggest you learn
core python first.

Francois
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Continue reading on narkive:
Loading...