Presto Integration with Hue

I am deploying Hue-4.4.
I wanted to know that, if currently Hue supports connector to presto ?

There are some connectors https://docs.gethue.com/latest/administrator/configuration/editor/#presto

Hi Romain,

Thanks for the link.

As per the link. I can see that presto connector is available.
When I tried to add the configuration in hue.ini and re run HUE.
On clicking the Editor -> Presto button I am getting the following error.

An error occurred while calling z:java.sql.DriverManager.getConnection. : java.sql.SQLException: Authentication using username/password requires SSL to be enabled at com.facebook.presto.jdbc.PrestoDriverUri.setupClient(PrestoDriverUri.java:160) at com.facebook.presto.jdbc.PrestoDriver.connect(PrestoDriver.java:90) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) …l.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:231) at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:381) at py4j.Gateway.invoke(Gateway.java:259) at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:133) at py4j.commands.CallCommand.execute(CallCommand.java:79) at py4j.GatewayConnection.run(GatewayConnection.java:209) at java.lang.Thread.run(Thread.java:748)

It is asking for SSL to be enabled. But I don’t want to user SSL.
Is there a way to integrate presto in Hue with SSL being disabled?

Thanks Again.

Could you use the SqlAlchemy interface and not JDBC?

This is the most used one:

The dialect should be added to the Python system or Hue Python virtual environment:

  ./build/env/bin/pip install pyhive

Then give Hue the information about the database source:

[[[presto]]]
   name = Presto
   interface=sqlalchemy
   options='{"url": "presto://localhost:8080/hive/default"}'

@Romain i used SqlAlchemy interface , but when i am running query in presto editor its running the query as the user by which hue is running and not as end user.
Hence i am getting permission issues on hdfs.

am i missing anything?

Thanks

I see, I guess we would need to patch the sqlalchemy interface to allow setting a principal: https://github.com/dropbox/PyHive/pull/309/files

Hi @Romain,

I already have this patch in my pyhive/presto.py file.
still impersonation is not happening and queries are not running with end user.
queries are running with the user by which hue process is running

Yes, https://github.com/cloudera/hue/blob/master/desktop/libs/notebook/src/notebook/connectors/sql_alchemy.py#L148 might need to be changed to allow to propagate it.

What do you specify for the connection URL?

Hi @Romain,

I copied the above sql_alchemy.py and replaced it with my sql_alchemy.py file.
still the queries are not executing with end user.

This is my connection url.

[[[presto]]]
name=Presto
interface=sqlalchemy
options=’{“url”: “presto://xxxx:8285/hive/default”}’

Want to try https://issues.cloudera.org/browse/HUE-9270 ?

@Romain,

Thanks for this suggestion. I applied this patch on 4.6 version manually and now impersonation in presto is working .
Thanks again.

1 Like