5.7. 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 IP

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. Public Presto Presto WebUI
Find and copy the “Public Presto WebUI” and enter the value into a web browser.