Quickstart

This document will help you get started with the Rockset Python Client.

Rockset’s entire Python Client is contained within a single Python module called rockset.

APIs defined in the rockset module allow you to:

  1. Securely connect to the Rockset service

  2. Create, manage and administer collections

  3. Load data into collections

  4. Issue queries against collections

In addition, the Python Client SDK also provides a command line utility called rock. See rock CLI documentation for more details.

Installation

Rockset Python client (Python 3.5+) along with the rock CLI tool is contained within a single module called rockset. You can install it using pip3 as follows on all popular Linux, OS X and Windows platforms:

sudo pip3 install rockset

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

sudo pip3 install --upgrade rockset

Tip

If you are running into issues with the above command, please ensure that you are not missing depedendent packages that are required in your system.

Instructions to install dependent packages on various plaforms are listed below:

Configuration

In order to use Rockset Python Client, you will need to create an API Key using Rockset Console.

Once you have your API key and your API server endpoint, you can start using the Python Client as follows:

from rockset import Client
rs = Client(api_server='api.rs2.usw2.rockset.com',
            api_key='rsJKatr23akr52lu3mte_007rEcT42uwm914orc_FBcdD')

You can also setup your API key and API server in your environment using the rock configure command, so that you don’t have to pass it explicity in your Python program or notebook.

When rock configure is run the first time, you should get a prompt to enter your API key and API server as shown below. The specified API key and API server will be added to your default profile. Run rock configure --help to see more information on how to create multiple API key profiles and switch between those:

$ rock configure
Enter Rockset API key
  API Key [None]: rsJKatr23akr52lu3mte_007rEcT42uwm914orc_FBcdD
Enter Rockset API server hostname or IP address
  API Server [https://api.rs2.usw2.rockset.com]: api.rs2.usw2.rockset.com
PROFILE     API_SERVER                 API_KEY
* default   api.rs2.usw2.rockset.com   rsJK**********BcdD
Credentials stored in /Users/veeve/.rockset/credentials

Once your API key is setup, all subsequent rock commands and calls from your Python program or notebook will automatically use those credentials. So, you can start using the Python client simply as:

#!/usr/bin/python3

# connect to rockset and list all collections
from rockset import Client
rs = Client()
print([vars(c) for c in rs.Collection.list()])

Happy hacking!

Module Reference

Indices and tables