Overview > Rockset CLI

Rockset CLI

This document describes how to install, configure and use the rock command-line tool and the corresponding Python client libraries for Rockset.

Installation

The rock command-line tool is packaged as part of the Rockset Python client (Python 3.5+). You can install it using pip3 as follows on all popular Linux, OS X and Windows platforms:

$ pip3 install rockset

If you do not already have pip3 installed, you may install it following instructions here.

If you have an older version already installed, run with --upgrade as follows:

$ pip3 install --upgrade rockset

rockset depends on the cryptography package, which depends on OpenSSL (libssl-dev) and libffi-dev. The following command will ensure that all required dependencies are installed.

sudo apt-get install libffi-dev libssl-dev python3-dev python3-pip

Usage

To learn how to use the Rockset CLI and Python client, see the following guides.

Introduction

Once you have installed the client, you can see a list of all available commands by simply running:

$ rock

Configuration

To configure your client, follow these steps:

  1. Create an API key in the Rockset console.
  2. Run the rock configure --api_key <YOUR-API-KEY> command.

You can add additional profiles using the rock configure add <profile> command. You can also update, delete, list or switch between profiles. Run rock configure --help for instructions.

Creating and Querying Collections

Let us create a collection, upload a set of local JSON files, and query them using the rock command-line tool:

$ echo '{"move": "rock", "wins_against": ["paper", "scissors"]}' > documents.json
$ rock create collection rules
$ rock upload rules documents.json --format=JSON
$ rock sql 'SELECT * FROM rules LIMIT 10'

You can also make queries in an interactive SQL REPL by running:

$ rock sql

Help

If you need help text for rock or any of the commands, run:

$ rock --help
$ rock {command} --help

Play

All work and no play makes Jack a dull boy

So play with some rocks today:

$ rock play