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:
- Securely connect to the Rockset service
- Create, manage and administer collections
- Load data into collections
- Issue queries against collections
In addition, the Python Client SDK also provides a command line utility called
See rock CLI documentation <http://docs.rockset.com/cli> for more details.
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:
sudo pip3 install rockset
If you have an older version already installed, run with
--upgrade as follows:
sudo pip3 install --upgrade rockset
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:
After installation, setup your API key and API server endpoint using the
rock configure command.
You can generate your API key by logging into `Rockset Console`_. Your API server endpoint should also be shown in the same page that lists all your API keys.
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()])
- Load Data
- Query using Query Builder