Installation and Configuration¶
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 set up 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/{user}/.rockset/credentials
Once your authentication profile is set up, all subsequent rock
commands and calls from your Python program or notebook will automatically use those credentials. 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!