Chapter 3. Using Trino

Congratulations! In the prior chapters, you were introduced to Trino and learned how to get it installed, configured, and started. Now you get to use it.

Trino Command-Line Interface

The Trino command-line interface (CLI) provides a terminal-based, interactive shell for running queries and for interacting with the Trino server to inspect its metadata.

Getting Started

Just like the Trino server itself, the Trino CLI release binaries are distributed on the Maven Central Repository. The CLI application is available as an executable JAR file, which allows you to use it like a normal Unix executable.

You can see the list of available versions at https://repo.maven.apache.org/maven2/io/trino/trino-cli.

Locate the version of the CLI that is identical to the Trino server version you are running. Download the *-executable.jar file from the versioned directory, and rename it to trino; for example, with wget and version 354:

$ wget -O trino \
https://repo.maven.apache.org/maven2/\
io/trino/trino-cli/354/trino-cli-354-executable.jar

Ensure that the file is set to be executable. For convenience, make it available on the PATH; for example, by copying it to ~/bin and adding that folder to the PATH:

$ chmod +x trino
$ mv trino ~/bin
$ export PATH=~/bin/:$PATH

You can now run the Trino CLI and confirm the version:

$ trino --version
Trino CLI 354

Documentation for all available options and commands is available with the help option:

$ trino --help

Before you start using ...

Get Trino: The Definitive Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.