Add and use an interpreter in HUE
Connectors used by HUE
HUE in ADH has pre-set connectors for the Hive, Impala, Spark3 SQL, and Kyuubi[Spark3] data sources. Many more can be added via the Custom hue.ini section available at the HUE service configuration page; the full list can be found in the HUE documentation.
NOTE
Pre-set connectors only appear in the HUE UI if corresponding service components are present in the ADH cluster:
After adding necessary services and/or components, you need to restart the HUE service for the changes to take effect. |
To configure a connector, go to ADCM UI, select your ADH cluster, and navigate to Services → HUE → Components → HUE Server. Select the required interpreter section and adjust the parameters as needed. Refer to HUE configuration parameters reference for assistance.
Connect to ADB (Greenplum)
This is an example of how to add and configure a connector for the ADB database, which is based on Greenplum.
To be able to connect HUE to ADB database instance make sure that it expects connection on a certain network interface with certain credentials. Go to the ADCM UI and select your ADB cluster, then navigate to Services → ADB → Primary configuration. Open the Custom pg_hba section parameter and add a string of the following kind to it:
host <dbname> <user> <IP-address>/<mask> trust
where:
-
<dbname>
— name of the database being connected to. -
<user>
— username of that database. -
<IP-address>/<mask>
— address of the ADH host where HUE Server is installed.
Example:
host adb admin 10.10.10.21/0 trust
Save the configuration, then click Actions and select Reconfigure.
Next, you need to add connection parameters to the HUE configuration. Select your ADH cluster in ADCM UI, and navigate to Services → HUE → Components → HUE Server. In the Primary configuration tab that appears, click Show advanced. Open the Custom hue.ini section and add three parameters by clicking Add property:
-
notebook.interpreters.greenplum.name
=Greenplum
-
notebook.interpreters.greenplum.interface
=sqlalchemy
-
notebook.interpreters.greenplum.options
='{"url": "postgresql+psycopg2://<user>:<password>@<dbaddress>:<port>/<dbname>"}'
where:
-
<password>
— database user password. -
<dbaddress>
— address of the database host awaiting connection (ADB master). -
<port>
— database listen port.
Standard Greenplum port in ADB is 5432. Example for the options
parameter: '{"url": "postgresql+psycopg2://admin:Secure_pass35@10.10.10.10:5432/adb"}'
.
Save the configuration and click Restart HUE Server in the Actions menu. Wait for the restart to complete and go to the HUE UI. The Greenplum data source should appear in the quick browse menu and in the Editor list.
You can perform queries against the selected table. Type in the query in the application area and click Execute (or press Ctrl+Enter
).
If ADB parameter Custom pg_hba section wasn’t configured correctly, or invalid credentials were specified on the HUE Server configuration side, the connection will fail and an error message will appear.
If a wrong port was specified on the HUE Server configuration side, the connection will fail and an error message will appear.