Appearance
💻 Using the CLI
The Supersimple CLI offers convenient tools to validate & import your data models.
Installation
The Supersimple CLI can be installed in different ways depending on your operating system and preferences.
macOS
Download the CLI for macOS:
Alternatively, macOS users can install the CLI using Homebrew:
sh
brew tap gosupersimple/cli
brew install supersimpleLinux
Download the CLI for Linux.
Windows
Windows users can set up the CLI by installing the Linux version with WSL (Windows Subsystem for Linux). Once WSL is configured, follow the Linux installation instructions above.
TIP
After installing the CLI, make sure to include it in your PATH. Here's an example to get you going, but your setup might require something more permanent (e.g. updating your ~/.profile, ~/.bashrc or similar config file)
sh
export PATH=$PATH:~/path/to/supersimple-cliTIP
If the CLI notifies you about an upgrade being available, it can be downloaded via the same link.
If you installed via Homebrew, you can upgrade with:
sh
brew update
brew upgrade supersimpleSetup
Create a .env file in your project's root directory and add the following environment variables:
sh
export SUPERSIMPLE_TOKEN='<token>'
export SUPERSIMPLE_ACCOUNT_ID='<account_id>'
export SUPERSIMPLE_HOST='https://app.supersimple.io'Visit the account settings page to generate the token and find your account ID. Because this file contains sensitive credentials, make sure to add it to your .gitignore file.
Before running any commands, make sure to load in the environment variables by running:
sh
source .envCongratulations! You're now ready to use the CLI.
Commands
For a list of available commands, the CLI's installed version, etc.
sh
supersimple --helpEach command also exposes their own --help option, for example
sh
supersimple import --helpValidating models
sh
supersimple validate config.yamlIf your models are split between multiple files, you can pass all of them to validation
sh
supersimple validate config_a.yaml config_b.yamlIf you remove any existing models from your configuration, they won't get automatically deleted from Supersimple. You can check if you have any such "dangling" models with the following flag. You can then delete them during import by passing a --delete-dangling flag (see below).
sh
supersimple validate config.yaml --validate-danglingImporting
Use the Supersimple API to upload a new version of your data models. Even though your configuration can be split into multiple files, they'll need to be imported all at once to validate their integrity and relations.
sh
supersimple import config.yaml # OK for a single-file setup
# bad in case of multiple files
supersimple import config_a.yaml
supersimple import config_b.yaml
# good for a multi-file setup
supersimple import config_a.yaml config_b.yamlDangling objects can be deleted automatically during import with the --delete-dangling flag
sh
supersimple import config.yaml --delete-danglingAutofix
To detect missing relations between models, use the fix command.
sh
supersimple fix config.yamlThe output of the fix command can be printed as YAML:
sh
supersimple fix --format=yaml config.yamlWhen feeling lucky, you can overwrite your configuration file in-place:
sh
supersimple fix --format=yaml config.yaml > tmp.$$; mv tmp.$$ config.yamlDiscovery
The CLI has commands to generate models from existing database schema. It creates one data model per database table and generates relations between them when specified in database schema. Discovery outputs YAML that can be imported to Supersimple by using the import command.
To include only specific tables, use comma separated list of table names with --tables tableA,tableB option. Similarly, tables can be excluded from discovery with --skip-tables tableX,tableY option.
sh
supersimple discover models > supersimple.yamlOptionally, you can specify Postgres database schema using the --schema option.
Discover all possible values for enum column:
sh
supersimple discover enum --table <table> --column <column>Optionally, you can specify label for the enum option by using --label-column option.
