> For the complete documentation index, see [llms.txt](https://upsolver.gitbook.io/content/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://upsolver.gitbook.io/content/how-to-guides-1/setup/install-the-upsolver-cli.md).

# Install the Upsolver CLI

Upsolver CLI is a command line client that provides a terminal-based interactive shell for running queries. It connects to Upsolver to execute SQL statements and perform all DDL and DML operations, including loading data as a continuous stream to various data destinations.&#x20;

Upsolver CLI provides a command line interface to interact with the Upsolver API service over HTTP.

## Install Upsolver CLI

### Install using Brew (MacOS only)

```
brew tap upsolver/cli https://github.com/Upsolver/cli
brew install upsolver-cli
```

### Install using pip

{% hint style="warning" %}
python 3.8+ is required for installing Upsolver CLI.
{% endhint %}

Make sure you have Python 3.8+ installed, and then use pip or brew to install the CLI tool:

```
pip3 install -U upsolver-cli
```

You can grab the latest archive link from <https://github.com/Upsolver/cli/releases>

## Use Upsolver CLI

### Help

For a complete description of every command and its flags, you can run it without any arguments or with a `--help` flag.

#### Examples

```bash
> upsolver
# Help will be displayed
> upsolver --help
# Help will be displayed
> upsolver execute
# Help will be displayed
> upsolver execute --help
# Help will be displayed
```

### Execute

To execute a SQL statement, you should provide an API token. You can choose whether to provide a file or a command to run.

#### Examples

Run an inline command:

```bash
> upsolver execute \
    -t mytoken
    -c 'CREATE TABLE default_glue_catalog.upsolver_samples.orders_raw_data()'
# Result will be displayed
```

Run command from a file:

```bash
> upsolver execute -t mytoken -f create_table_command.usql
# Result will be displayed
```

If you want to avoid passing the token (and perhaps other optional flags) on every command, you can create a profile with the `configure` command.

### Configure

You can use the configure command to save a configuration file, so you won't have to provide a token and other optional flags to the `execute` command every time.

```
upsolver configure -t <token>
```

The configuration profile will be located under `~/.upsolver/config`.

#### Examples

Create a default profile with an API token and CSV as output format:

```bash
> upsolver configure -t mytoken -o csv
> cat ~/.upsolver/config
[profile]
token = mytoken
output = CSV
```

Create another profile with an API URL and a different token:

{% code overflow="wrap" %}

```bash
> upsolver -p anotherpofile configure -t anothertoken -u https://specificapi.upsolver.com
> cat ~/.upsolver/config
[profile]
token = mytoken
output = CSV

[profile.anotherpofile]
token = anothertoken
base_url = https://specificapi.upsolver.com
```

{% endcode %}

#### Using Profiles

You can perform `execute` command using different profiles by passing the `-p` or `--profile` flag to the `upsolver` command.

#### Examples

{% code overflow="wrap" %}

```bash
upsolver -p anotherpofile execute -c 'CREATE TABLE default_glue_catalog.upsolver_samples.orders_raw_data()'
```

{% endcode %}

\
Without the -p flag the default profile will be used:

```bash
> upsolver execute -c 'CREATE TABLE default_glue_catalog.upsolver_samples.orders_
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://upsolver.gitbook.io/content/how-to-guides-1/setup/install-the-upsolver-cli.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
