Running SQL queries by using developer utilities

You can use Presto engine to run the SQL queries by using developer utilities.

watsonx.data Developer edition

About this task

Complete the following steps to work with the Presto engine host:

Procedure

  1. Establish the connection with Presto engine by using the developer utilities. For more information about installation, see Installing the watsonx.data developer version.
  2. Use any of the following methods to run the SQL query:
    Using an interactive session
    Use the argument --catalog to select a catalog as a default for the query. For example, to select the tpch catalog, run the following command:
    /bin/presto-cli --catalog=tpch
    Using a non-interactive session
    Use the argument --catalog to select a catalog as a default for the query and pass in a query string on the command line as input. For example, to run a query against the tpch catalog, run the following command:
    /bin/presto-cli --catalog=tpch <<< "select * from tiny.customer limit 10;"
    Using an SQL file
    Set the LH_SANDBOX_DIR mount. For more information, see Sandbox directory.
    Use the following command to run an SQL file from your LH_SANDBOX_DIR mount:
    bin/presto-run -f PATH_SANDBOX_DIR_SQL_FILE
    Parameter value:
    • PATH_SANDBOX_DIR_SQL_FILE: Specify the SQL query file location available in your sandbox directory.

      For example: /home/jmouse/mysandbox/sample.sql