CLI
Install rtree, create a database, ingest data, and query it.
Quickstart with the CLI
The rtree CLI accesses RawTree through the service API from your terminal.
This quickstart uses RawTree Cloud.
1) Install
curl -fsSL https://rawtree.com/install.sh | bash2) Log in
rtree loginrtree statusIn an agent session or another shell without a terminal on stdin, rtree login
uses JSON automatically.
It prints a device_approval_required event with an approval link to stderr.
It then waits for you to open the link and approve in a browser.
Read that event while the command is running.
After approval, the CLI selects resources automatically when there is only one
choice. Otherwise, it returns JSON with needs and the available choices on
stdout, then exits with code 2. Rerun with the requested flags, or supply all
three if you already know them:
rtree login --org team-alpha --cluster production --database analyticsEach retry requires approval again. Credentials are saved only when login completes. See the CLI reference for the JSON responses.
3) Create and select a database
rtree database create analytics
rtree database use analytics4) Insert data
rtree insert --table events \
--data '[{"action":"click","user":"alice","value":42}]'You can also ingest files and public URLs:
rtree insert --table events --file ./events.jsonlrtree insert --table events --url https://example.com/events.jsonl5) Query data
rtree query "SELECT action, count() AS total FROM events GROUP BY action ORDER BY total DESC LIMIT 10"