4.9. Querying Presto

CLI

1. Connect to Cluster
Follow the steps from Accessing the Presto Cluster above to successfully connect to your desired Presto cluster.
2. Open the Presto CLI
Type the following command to access the Presto CLI and press enter. Your cursor will skip to the next line, preceded by presto >.
presto-cli
3. Catalogs and Schemas
View your catalogs and schemas via the following commands. Note, replace tpch with your desired catalog.
show catalogs;
show schemas in tpch;
4. Write Query
Type your SQL query into the Presto CLI. For reference, view the SQL SELECT statement below.
select * from tpch.sf1.nation;
5. Run Query
Once content with your query, press enter to run.
6. Results
When finished processing, you will be presented with the results of your query.

ODBC & JDBC Drivers

The open source Presto JDBC driver can be used with Presto on AWS. This can be downloaded from Starburst’s download page. Additionally, Starburst provides Enterprise ODBC and JDBC drivers, available for Windows, Mac, and Linux platforms for its Enterprise customers. Please refer to the following link for both.

Presto WebUI and ODBC/JDBC Endpoint

To locate the IP address of your cluster’s coordinator node, for your connection string, follow the steps below.

1. CloudFormation Console
Navigate to the CloudFormation Console under “Management Tools” within the Services menu.
2. Outputs

Select your “Stack Name” and click the associated tab labeled “Outputs”.

../_images/presto_cft_outputs.png
3. Presto WebUI
Find and copy the “PrestoCoordinatorURL” key and enter the value into a web browser.
4. ODBC/JDBC Endpoint
Find and copy the “PrestoCoordinatorURL” key and enter the value in the ODBC/JDBC connection string.

Note that because the Coordinator IP address is private it is accessible only within the same VPC which as the Starburst Presto cluster stack.