Rockset CLI

Usage
The Rockset cli can be used as an alternative to the console,
and is built as a UNIX tool to allow it to be used in pipes.

Query

There are three ways to query a collection, either using the first argument as the SQL
$ rockset query 'SELECT COUNT(*) FROM _events'
+--------+
| ?COUNT |
+--------+
| 1016 |
+--------+
Elapsed time: 26 ms
Or using interactive mode
$ rockset query
[R]> SELECT COUNT(*)
>>> FROM _events;
+--------+
| ?COUNT |
+--------+
| 1016 |
+--------+
Elapsed time: 26 ms
^D
And reading the SQL from stdin
$ rockset query < query.sql
+--------+
| ?COUNT |
+--------+
| 1016 |
+--------+
Elapsed time: 26 ms
Cloning a collection
A common workflow is to want to clone a collection, but change a few settings, e.g. the retention.
This can be done using two commands
rockset get collection --output - movies | rockset create collection --input - --retention 12h movies2

Configuration
The Rockset CLI requires having access to an API key and an API server, which can be configured using either
environment variables or a configuration file.
$ rockset list config
available configs:
-> dev (api.usw2a1.rockset.com)
prod (api.usw2a1.rockset.com)
$ rockset update config prod
using prod
$ rockset list config
available configs:
dev (api.usw2a1.rockset.com)
-> prod (api.usw2a1.rockset.com)
Environment variables
ROCKSET_APIKEY
ROCKSET_APISERVER
Configuration File
~/.config/rockset/cli.yaml
---
current: dev
configs:
dev:
apikey: ...
apiserver: api.usw2a1.rockset.com
prod:
apikey: ...
apiserver: api.use1a1.rockset.com
Building
go build -o rockset
Testing
go test ./...
Integration testing
Requires the environment variable ROCKSET_APIKEY
to be set
go test ./...
Create recordings
We use vhs to record terminal sessions
vhs vhs/demo.tape