Skip to content

Run a SQL script from CLI #6

Description

@lakruzz

Given that you have you CLI authorization set up correct you can run a SQL script against your PlanetScale database like this:

pscale shell sample main --org lakruzz < createdb.sql

In the command above, sample is the name of the Planetscale database you want to connect to, main is the name of the branch you want to connect to, --org lakruzz specifies the organization (a.k.a you user handle) and < createdb.sql redirects the contents of the SQL script to the shell subcommand, which is used by pscale shell to connect to the database and open a prompt - or in this case - execute the script.

The branch is not required, if the database only have one. And you can use the same command ot open an interactive SQL prompt like this:

pscale shell sample --org lakruzz

For more details see:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions