Skip to content

PlanetScale CLI commands: data-imports

Use the PlanetScale CLI “data-imports” command to create, and manage database imports.

Getting Started

Make sure to first set up your PlanetScale developer environment. Once you've installed the pscale CLI, you can interact with PlanetScale and manage your databases straight from the command line.

The service-token command

This command allows you to manage your database import from the PlanetScale CLI.

Usage:

Terminal
pscale data-imports <SUB-COMMAND> <FLAG>

Available sub-commands

Sub-commandSub-command flagsDescription
cancel <DATABASE_NAME>--name*, --forceCancel data import request
detach-external-database--name*, --forceDetach external database that is used as a source for PlanetScale database
get <DATABASE_NAME>--name*Get the current state of a data import request into a PlanetScale database
lint--database <EXTERNAL_DATABASE_NAME>*, --host <EXTERNAL_HOST_NAME>*, --password <EXTERNAL_DATABASE_PASS>*, --ssl-mode <SSL_MODE>*, --username <EXTERNAL_DATABASE_USER>*, --port <PORT>, --ssl-certificate-authority <SSL_CA>, --ssl-client-certificate <SSL_CERT>, --ssl-client-key <SSL_CLIENT_KEY>, --ssl-server-name <SSL_SERVER_NAME>Lint external database for compatibility with PlanetScale
make-primary--name*, --forceMark PlanetScale's database as the Primary, and the external database as Replica
make-replica--name*, --forceMark PlanetScale's database as the Replica, and the external database as Primary
start--database <EXTERNAL_DATABASE_NAME>*, --host <EXTERNAL_HOST_NAME_>*, --port <EXTERNAL_PORT_NUMBER>, --name <PLANETSCALE_DATABASE_NAME>*, --username <EXTERNAL_DATABASE_USERNAME>*, --password <EXTERNAL_DATABASE_PASSWORD>*, --region <PLANETSCALE_DATABASE_REGION>, --ssl-certificate-authority <SSL_CA>, --ssl-client-certificate <SSL_CERT>, --ssl-client-key <SSL_CLIENT_KEY>, --ssl-mode <SSL_MODE>*, --ssl-server-name <SSL_SERVER_NAME>, --dry-runStart importing data from an external database

* Flag is required

Sub-command flag descriptions

Some of the sub-commands have additional flags unique to the sub-command. This section covers what each of those does. See the above table for which context.

Sub-command flagDescriptionApplicable sub-commands
--database <PLANETSCALE_DATABASE_NAME>Name of the PlanetScale database for which you wish to cancel the importcancel, lint
--name <PLANETSCALE_DATABASE_NAME>Name of the PlanetScale database you are importing intocancel, get, detach-external-database, make-primary, make-replica, start
--forceMake PlanetScale database replica or primary without confirmationcancel, detach-external-database, make-primary, make-replica
--database <EXTERNAL_DATABASE_NAME>Name of the external databaselint, start
--dry-runOnly run compatibility check; do not start the import (true by default)start
--host <EXTERNAL_HOST_NAME_>Host name of the external databasestart, lint
--port <EXTERNAL_PORT_NUMBER>Port number to connect to external database (default 3306)start, lint
--username <EXTERNAL_DATABASE_USERNAME>Username of the external database you are importing fromstart, lint
--password <EXTERNAL_DATABASE_PASSWORD>External database passwordstart, lint
--region <PLANETSCALE_DATABASE_REGION>Region of the PlanetScale database you're importing intostart
--ssl-certificate-authority <SSL_CA>The full CA certificate chainstart, lint
--ssl-client-certificate <SSL_CERT>Client Certificate to authenticate PlanetScale with your database serverstart, lint
--ssl-client-key <SSL_CLIENT_KEY>Private key for the client certificatestart, lint
--ssl-mode <SSL_MODE>SSL verification mode, allowed values: disabled, preferred, required, verify_ca, verify_identitystart, lint
--ssl-server-name <SSL_SERVER_NAME>SSL server name overridestart, lint

Available flags

FlagDescription
-h, --helpView help for service-token command
--org <ORGANIZATION_NAME>The organization for the current user

Global flags

CommandDescription
--api-token <TOKEN>The API token to use for authenticating against the PlanetScale API.
--api-url <URL>The base URL for the PlanetScale API. Default is https://api.planetscale.com/.
--config <CONFIG_FILE>Config file. Default is $HOME/.config/planetscale/pscale.yml.
--debugEnable debug mode.
-f, --format <FORMAT>Show output in a specific format. Possible values: human (default), json, csv.
--no-colorDisable color output.
--orgThe organization for the current user.
--service-token <TOKEN>The service token for authenticating.
--service-token-id <TOKEN_ID>The service token ID for authenticating.

Need help?

Get help from the PlanetScale support team, or join our GitHub discussion board to see how others are using PlanetScale.

Was this page useful?
Last updated on Help us improve this page