The Command Line Interface (CLI) allows you to execute Commonwealth queries from your shell.
It gives you autocomplete to help you write queries, and gives you immediate feedback when something isn't right.
Download from the link above or from the command line. Once downloaded, make the file executable and then run it.
wget -O commonwealth https://commonwealth.io/static/cli/commonwealth-macos
# or download using link above
chmod +x commonwealth # make it executable
./commonwealth # execute it!
The CLI will prompt you to enter a token to verify your identity.
Lets connect to Commonwealth. Enter the following.
Commonwealth Token
Enter a value:
Create an identity token on the Account Page, then paste it into the CLI.
Enter | Add newline to current query, or execute query if it ends with ; (semicolon) |
Ctrl+Enter | Execute current query |
Tab | Trigger autocomplete |
Ctrl+c | Cancel current query |
Ctrl+c+Ctrl+c | Exit CLI |
Basic Operation: Write SQL, add semicolon to the end, press Enter.
The CLI also supports these commands:
help | Show the CLI help page |
show tables | List tables that you own |
show table [tablename] | Show the schema for a specific table |
start transaction | Open new transaction. All queries will see the same view of the data. Writes (insert, update, delete) commit at the end. |
commit | Commit all pending queries and close transaction |
rollback | Drop all pending queries and close transaction |