Query Presto Cluster with Apache Superset
Each Ahana Compute Plane includes an instance of Apache Superset. For more information about Apache Superset's provisioning in the Ahana Compute Plane, see Apache Superset Information.
To configure Apache Superset to query your Ahana-managed Presto cluster, follow these steps.
Configure Apache Superset
Create a Presto User
- In the Ahana SaaS Console, create a new Presto user. Remember the username and password. See Create a Presto User.
- Add the new Presto user to the Ahana-managed Presto cluster. See Managing Presto Users.
Find Apache Superset Connection information
In the Ahana SaaS Console, select Clusters, select Manage for the cluster, then select Superset.
Select the copy icon to copy the text string in Apache Superset connection.
Sign In to Apache Superset
In Ahana SaaS Console, select the link in step 1 adding a new database.
In Apache Superset, select Sign In.
If an Ahana Sign In window is displayed, enter your Ahana credentials then select Sign In.
Enter the connection string in Apache Superset
In Add Database, configure Superset to connect to your Presto cluster.
Database: Enter a descriptive name. This name is a label used only in Superset. It does not need to match any other name.
SQLAlchemy URI: Enter the connection string that you copied from Apache Superset connection in your Ahana SaaS Console, then edit it for your Presto cluster.
The format of the SQLAlchemy URI is
presto://<username>:<password>@<host>/<catalog_name>
Edit the connection string copied from Ahana SaaS Console:
- <username> and <password> - Replace <username> and <password> with the name and the password of the Presto user account you created in Create a Presto User.
- <host> - The <host> part of the connection string copied from Apache Superset connection should not need editing. <host> includes the hostname and a port number separated by a colon. The default port in the connection string copied from Apache Superset connection is 443.
- <catalog_name> - A catalog name is required. To connect to the Ahana-managed Hive Metastore of your Presto cluster, add
/ahana_hive
at the end of the connection string.
Enter the Apache Superset JSON configuration for the Presto cluster
Ahana provides cluster-specific configuration in JSON format for Apache Superset.
In Ahana SaaS Console, in Apache Superset extra configuration, select Copy Config.
In Apache Superset Add Database, delete the text in Extra, then paste into Extra the copied configuration from Ahana.
Test the Connection
Select Test Connection to test if Superset can connect to and get a response from the Presto cluster.
Enable SQL Lab Features
In Apache Superset Add Database, select the following checkboxes to enable these features in SQL Lab.
Expose in SQL Lab - Makes the new database visible in SQL Lab of Apache Superset.
Asynch Execution - Operate the database in asynchronous mode, meaning that the queries are executed on remote workers.
Allow CREATE TABLE AS - Allow creation of new tables by user queries in SQL Lab.
Allow CREATE VIEW AS - Allow creation of new views by user queries in SQL Lab.
Allow DML - Allow users to run non-SELECT statements such as UPDATE, DELETE, or CREATE in SQL Lab.
Save the Database Configuration
Select Save.
Query Presto with Apache Superset
Use SQL Lab in Apache Superset to query your Ahana-managed Presto cluster.
Open SQL Editor
In Apache Superset, select SQL Lab, then select SQL Editor.
Select the Presto cluster
In the left of the window, use Database to select the database that you configured.
Query the Presto cluster
In the left of the window, select the schema and the table to query, or in the query editor field on the right enter a query, then select Run.