Can I call external *python* functions from google refine?

543 views Asked by At

I'm investigating Google refine to speed up some of my data work -- never used it before this week, but I like a lot of what I see.

My biggest question so far is whether it's possible to call external python functions from Refine. I know you can call jython internally, but that doesn't provide access to C-based python libraries (e.g. lxml), and I have scripts elsewhere that I'd like to integrate, without lots of copy-paste or rewrite hassle.

What options are there for doing this in Refine? I'm willing to get creative -- I just want a stable, re-usable solution.

2

There are 2 answers

2
reclosedev On BEST ANSWER

As Google Refine Wiki says:

lxml will NOT work in Jython, since lxml has C bindings for CPython (regular Python), hence will not work in Refine which is Jython / Java only, and has no CPython interpreter built-in

But you can try Google Refine Python Client Library to create projects and manipulate your data programmatically.

0
Abe On

I'm going to mark reclosedev's answer as accepted, but there's still a litle more to the story.

The other answer to this question is that you can set up your own python-based API. For this project, I was able to set up a django app running on a local server. It only took an hour or so to build the API to my existing library.

More hassle than I'd have liked, but it fit the bill for this project without soaking up too much time.