A modern, powerful command-line tool for interacting with the Sigma Computing REST API.
β¨ Modern CLI Experience: Built with Typer and Rich for beautiful, intuitive interface π OAuth2 Authentication: Automatic token management with refresh support π¦ JSON-First: Native JSON input/output with syntax highlighting β‘ Fast: Async-ready HTTP client with connection pooling π― Comprehensive: Full API coverage with 123 endpoints π Well-Documented: Inline help for every command
- Python 3.13+
- uv package manager
# 1. Install uv (if needed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# 2. Clone and navigate to repository
git clone https://github.com/joncooper/sigma-cli.git
cd sigma-cli
# 3. Create and activate virtual environment
uv venv
source .venv/bin/activate # Linux/Mac
# OR
.venv\Scripts\activate # Windows
# 4. Install sigma-cli
uv pip install -e .After installation, the sigma command will be available in your PATH.
Enable tab completion for zsh:
# Add to your ~/.zshrc
eval "$(_SIGMA_COMPLETE=zsh_source sigma)"For bash:
# Add to your ~/.bashrc
eval "$(_SIGMA_COMPLETE=bash_source sigma)"After adding, restart your shell or run source ~/.zshrc (or ~/.bashrc).
Save your Sigma API credentials for persistent use:
sigma config \
--client-id "your-client-id" \
--secret "your-secret" \
--base-url "https://aws-api.sigmacomputing.com/v2"Credentials are securely stored in ~/.sigma/config.json with restricted permissions.
sigma config --show# List all workbooks
sigma workbooks list
# List workbooks as a table
sigma workbooks list --table
# Get a specific workbook
sigma workbooks get <workbook-id>
# List connections
sigma connections list --tablesigma-cli supports multiple configuration methods with the following precedence (highest to lowest):
- Command-line options (e.g.,
--client-id,--secret) - Environment variables (
SIGMA_CLIENT_ID,SIGMA_SECRET,SIGMA_BASE_URL) - Config file (
~/.sigma/config.json) - Defaults
export SIGMA_CLIENT_ID="your-client-id"
export SIGMA_SECRET="your-secret"
export SIGMA_BASE_URL="https://aws-api.sigmacomputing.com/v2"Create a .env file in your working directory:
SIGMA_CLIENT_ID=your-client-id
SIGMA_SECRET=your-secret
SIGMA_BASE_URL=https://aws-api.sigmacomputing.com/v2sigma-cli will automatically load these variables.
# List all workbooks
sigma workbooks list
# List with filters
sigma workbooks list --limit 10 --search "Sales"
# Display as table
sigma workbooks list --table
# Get specific workbook
sigma workbooks get wb_abc123
# Create workbook from JSON
sigma workbooks create --json '{"name": "My Workbook"}'
# Create from file
sigma workbooks create --file workbook.json
# Create from stdin
echo '{"name": "My Workbook"}' | sigma workbooks create
# Update workbook
sigma workbooks update wb_abc123 --name "Updated Name"
# Delete workbook
sigma workbooks delete wb_abc123# List all connections
sigma connections list
# List with table view
sigma connections list --table
# Get connection details
sigma connections get conn_abc123
# Test a connection
sigma connections test conn_abc123# List all members
sigma members list --table
# Get member details
sigma members get mem_abc123
# Create a member
sigma members create --email user@example.com --json '{
"firstName": "Jane",
"lastName": "Doe",
"accountType": "Viewer"
}'
# List all teams
sigma teams list --table
# Create a team
sigma teams create --name "Data Analytics Team"
# Add member to team
sigma teams add-member team_abc123 mem_abc123
# Remove member from team
sigma teams remove-member team_abc123 mem_abc123
# List team members
sigma teams members team_abc123 --table# List all datasets
sigma datasets list --table
# Get dataset details
sigma datasets get ds_abc123
# Get dataset grants
sigma datasets grants ds_abc123
# Create a grant for dataset
echo '{"grantee": "team_abc123", "permission": "view"}' | \
sigma datasets create-grant ds_abc123# List files
sigma files list --path "/My Folder" --table
# Get file info
sigma files get inode_abc123
# List workspaces
sigma workspaces list --table
# Create workspace
sigma workspaces create --name "Analytics Workspace"
# Get workspace members
sigma workspaces members ws_abc123# List tags
sigma tags list --table
# Create a tag
sigma tags create --name "Production" --color "#FF0000"
# Assign tag to a document
sigma tags assign tag_abc123 inode_abc123
# List user attributes
sigma user-attributes list --table
# Create user attribute
sigma user-attributes create --name "Department" --json '{
"description": "User department",
"dataType": "string"
}'# List all grants
sigma grants list --table
# Get grant details
sigma grants get grant_abc123
# Create a grant
echo '{
"grantee": "team_abc123",
"permission": "view",
"resource": "workbook_abc123"
}' | sigma grants create
# Delete a grant
sigma grants delete grant_abc123# List account types
sigma account-types list
# List as table
sigma account-types list --table
# Get permissions for an account type
sigma account-types permissions at_abc123# Get a fresh access token
sigma auth token
# Get token (compact output)
sigma auth token --compactFor endpoints not yet wrapped in specific commands, use the raw command:
# GET request
sigma raw GET /v2/workbooks
# GET with query parameters
sigma raw GET /v2/workbooks --params '{"limit": 5}'
# POST request with JSON
sigma raw POST /v2/workbooks --json '{"name": "Test"}'
# POST from file
sigma raw POST /v2/workbooks --file data.json
# POST from stdin
echo '{"name": "Test"}' | sigma raw POST /v2/workbooks
# Other HTTP methods
sigma raw PUT /v2/workbooks/wb_123 --json '{"name": "Updated"}'
sigma raw PATCH /v2/workbooks/wb_123 --json '{"name": "Patched"}'
sigma raw DELETE /v2/workbooks/wb_123sigma-cli is designed for JSON-first workflows:
- Command-line string:
--json '{"key": "value"}' - File:
--file data.json - Stdin:
echo '{"key": "value"}' | sigma ...
# Pretty-printed with syntax highlighting (default)
sigma workbooks list
# Compact output
sigma workbooks list --compact
# Pipe to jq for processing
sigma workbooks list --compact | jq '.entries[0]'# Get all workbooks and filter with jq
sigma workbooks list --compact | jq '.entries[] | select(.name | contains("Sales"))'
# Create workbook from template
cat template.json | jq '.name = "New Name"' | sigma workbooks create
# Get workbook ID and delete it
WORKBOOK_ID=$(sigma workbooks list --compact | jq -r '.entries[0].workbookId')
sigma workbooks delete $WORKBOOK_ID# Use different credentials for one command
sigma workbooks list \
--client-id "other-client-id" \
--secret "other-secret"
# Use different API endpoint
sigma workbooks list --base-url "https://azure-api.sigmacomputing.com/v2"#!/bin/bash
# Export all workbooks
for wb_id in $(sigma workbooks list --compact | jq -r '.entries[].workbookId'); do
sigma workbooks get "$wb_id" > "workbooks/${wb_id}.json"
done
# Bulk create from directory
for file in workbooks/*.json; do
sigma workbooks create --file "$file"
donesigma-cli organizes commands by resource type. All 123+ API endpoints are accessible via command groups or the raw command.
sigma config- Configure credentials and settingssigma version- Show version informationsigma raw- Make raw HTTP requests to any endpoint
-
sigma auth- Authentication commandstoken- Get access token
-
sigma members- Manage organization memberslist,get,create,update,delete,teams
-
sigma teams- Manage teamslist,get,create,update,delete,members,add-member,remove-member
-
sigma account-types- Manage account typeslist,permissions
-
sigma whoami- Get current user information
-
sigma workbooks- Manage workbookslist,get,create,update,delete
-
sigma datasets- Manage datasetslist,get,grants,create-grant,update-grant,delete-grant
-
sigma files- Manage fileslist,get,create,update,delete
-
sigma workspaces- Manage workspaceslist,get,create,update,delete,members
sigma connections- Manage data connectionslist,get,test
-
sigma grants- Manage grants and permissionslist,get,create,update,delete
-
sigma user-attributes- Manage user attributeslist,get,create,update,delete
-
sigma tags- Manage tagslist,create,update,delete,assign
# General help
sigma --help
# Command group help
sigma workbooks --help
sigma members --help
sigma grants --help
# Specific command help
sigma workbooks list --help
sigma teams create --helpsigma-cli provides access to the entire Sigma Computing REST API (123+ endpoints) across 24 resource types:
β Fully Implemented:
- Account Types (2 endpoints)
- Authentication (1 endpoint)
- Connections (21 endpoints)
- Datasets (8 endpoints)
- Files (5 endpoints)
- Grants (4 endpoints)
- Members (10 endpoints)
- Tags (5 endpoints)
- Teams (10 endpoints)
- User Attributes (11 endpoints)
- Workbooks (48 endpoints)
- Workspaces (9 endpoints)
π¦ Via Raw Command:
- Allowed IPs (Beta)
- Credentials
- Data Models
- Favorites
- Query Export
- Shared Templates
- Templates
- Tenants (Beta)
- Translations
For any endpoint, use sigma raw for direct access:
sigma raw GET /v2/templates
sigma raw POST /v2/favorites --json '{"inodeId": "..."}'src/sigma_cli/
βββ __init__.py # Package initialization
βββ __main__.py # Entry point for python -m sigma_cli
βββ cli.py # Main CLI app with Typer
βββ auth.py # OAuth2 authentication handler
βββ client.py # HTTP client wrapper
βββ config.py # Configuration management
βββ openapi.py # OpenAPI spec parser
βββ commands/ # Command modules
β βββ account_types.py
β βββ auth_cmd.py
β βββ connections.py
β βββ workbooks.py
βββ utils/ # Utilities
βββ json_utils.py # JSON input/output
βββ output.py # Rich formatting
- Create a new module in
src/sigma_cli/commands/ - Define commands using Typer
- Register in
src/sigma_cli/cli.py
Example:
# src/sigma_cli/commands/datasets.py
import typer
from sigma_cli.client import SigmaClient
from sigma_cli.config import get_config
app = typer.Typer()
@app.command("list")
def list_datasets():
"""List all datasets."""
cfg = get_config()
client = SigmaClient(cfg)
response = client.get("/v2/datasets")
print_json(response)# In src/sigma_cli/cli.py
from sigma_cli.commands import datasets
app.add_typer(datasets.app, name="datasets", help="Manage datasets")# Install in development mode
uv pip install -e .
# Run CLI directly
sigma --help
# Or via Python module
python -m sigma_cli --helpIf you see "Missing credentials" errors:
- Check your configuration:
sigma config --show - Verify environment variables:
env | grep SIGMA - Re-configure:
sigma config --client-id ... --secret ...
Ensure you're using the correct base URL for your Sigma cloud:
- AWS:
https://aws-api.sigmacomputing.com/v2 - Azure:
https://azure-api.sigmacomputing.com/v2 - GCP:
https://gcp-api.sigmacomputing.com/v2
Tokens are automatically refreshed. If you experience issues:
# Force a new token
sigma auth token- Credentials are stored in
~/.sigma/config.jsonwith 0600 permissions (owner read/write only) - Tokens are cached in memory and automatically refreshed
- Never commit credentials to version control
- Use environment variables or config file for CI/CD
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Submit a pull request
MIT License - see LICENSE file.
For issues or questions:
- GitHub Issues: joncooper/sigma-cli
- Sigma Documentation: help.sigmacomputing.com
- Sigma API Reference: help.sigmacomputing.com/reference
Built with: