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:
bash
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)
bash
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:
bash
brew update
brew upgrade supersimpleSetup and authentication
After installation, you'll need to connect the CLI to your Supersimple account.
The easiest way to authenticate with the Supersimple CLI is using the interactive login command:
bash
supersimple loginThis command will guide you through the authentication process and securely store your credentials.
Congratulations! You're now ready to use the CLI.
Basic usage
For a list of available commands, the CLI's installed version, etc.
bash
supersimple --helpEach command also exposes their own --help option, for example
bash
supersimple import --helpImporting data models
To import data models to your Supersimple account (or to update existing data models), use supersimple import.
If your data models are split across multiple YAML files, you need to import them all at once to validate their integrity and relations.
bash
# If you only have a single data model file:
supersimple import config.yaml
# If you have multiple data model files, import them together:
supersimple import config_a.yaml config_b.yaml
# Do NOT import multiple files using separate commands like so:
supersimple import config_a.yaml
supersimple import config_b.yamlDangling data models
If you want to make sure that no data models exist in your account other than the ones you're importing now, you can run the command with the --delete-dangling flag.
This cleans up any "dangling" data models that were previously synced, but are not present in your newly-imported model files.
bash
supersimple import config.yaml --delete-danglingDiscovery
Auto-generating data models
supersimple discover models auto-generates data model YAML files based on your database schema.
It creates one data model per database table and generates relations between them when specified in database schema.
To only include specific tables, use a comma separated list of table names with the --tables tableA,tableB option. Similarly, tables can be excluded from discovery with the --skip-tables tableX,tableY option.
bash
supersimple discover modelsBy default, the command prints out the auto-generated YAML. To write it to a file, run:
bash
supersimple discover models > models.yamlOptionally, you can run discovery on a non-default database schema using the --schema flag (e.g. --schema myschema).
Other CLI commands
Validating models
While the import command does also run validation on your data models, it's often helpful to separately check that everything is OK with your data models, without yet importing them in case of success.
The supersimple validate command checks that every model is properly configured, and that nothing is missing.
bash
supersimple validate config.yamlIf your models are split between multiple files, you should pass all of them to validation at once:
bash
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. This will also output warnings if removing these models would break other models or explorations that are still dependent on them. Note that some of these warnings may have a shared root cause so its best to start addressing the affected models first and re-run the validation as you go.
You can then delete them during import by passing a --delete-dangling flag (see below).
bash
supersimple validate config.yaml --validate-danglingAutofix
To detect missing relations between models, use the fix command.
bash
supersimple fix config.yamlThe output of the fix command can be printed as YAML:
bash
supersimple fix --format=yaml config.yamlWhen feeling lucky, you can overwrite your configuration file in-place:
bash
supersimple fix --format=yaml config.yaml > tmp.$$; mv tmp.$$ config.yaml