S Technologies's Logo

Color

Green
Teal
Indigo
Blue
Purple
Red
Rose

Mode

Light

datastore

Create, inspect, start, stop, link and query the managed databases that applications use.

A datastore is a managed database. The panel runs it, and hands its connection string to every application linked to it. Use these commands to create a database, check that it is answering, and connect an application to it. Every command also takes --json, --quiet and --help.

CommandWhat it does
stechbd datastore lsEvery datastore, its engine, state and address
stechbd datastore inspectOne datastore: engine, state, address and whether it is reachable from outside
stechbd datastore createCreate a database, stating the engine and the major version
stechbd datastore rmDelete a datastore and everything in it
stechbd datastore startStart a stopped datastore
stechbd datastore stopStop a datastore; everything using it loses its database
stechbd datastore connectionPrint the connection string, password included, and nothing else
stechbd datastore linkPut the connection string in an application's environment
stechbd datastore unlinkTake the connection string out of an application's environment
stechbd datastore queryRun one statement with the engine's own client

Quick start

Create a database, link it into the application in the current directory, and look at its backup schedule.

bash
stechbd datastore create main --engine postgres --version 16
stechbd datastore link main
stechbd backup ls
  • datastore create names the database, the engine and the major version. The version is required.
  • datastore link writes the connection string into the application this directory is linked to.
  • backup ls shows the schedules for the database, and when each last backed up and was last restored.

stechbd datastore ls

Lists every datastore your credential can see, with its engine, state and address. Pass --project to show only one project. A datastore in the failed state is flagged below the table, with the command to inspect it.

bash
stechbd datastore ls [--project <project>]
OptionDescription
--project <project>Show only the datastores in this project.
bash
# Every datastore
stechbd datastore ls

# One project, as JSON
stechbd datastore ls --project blog --json

stechbd datastore inspect

Shows one datastore: its engine, state, address, and whether it can be reached from outside the panel. Use it when ls reports a state you do not expect.

bash
stechbd datastore inspect <datastore>
OptionDescription
<datastore>The datastore, by slug, name or id. Required.
bash
stechbd datastore inspect main
stechbd datastore inspect main --json

stechbd datastore create

Creates a database. --engine and --version are both required. The major version is not defaulted, because it decides what the data can be read by, and "latest" changes every month. --server and --size are sent only when given.

bash
stechbd datastore create <name> --engine <engine> --version <version> [--project <project>] [--server <server>] [--size <size>]
OptionDescription
<name>The name of the new datastore. Required.
--engine <engine>One of postgres, mysql, mariadb, mongodb or redis. Required.
--version <version>The major version, such as 16 for postgres. Required.
--project <project>The project the datastore belongs to.
--server <server>The server to create it on.
--size <size>A size, by name or id. See stechbd size ls.
bash
stechbd datastore create main --engine postgres --version 16
stechbd datastore create cache --engine redis --version 7 --project blog

stechbd datastore rm

Deletes a datastore and everything in it. At a terminal the command asks first. Outside one it refuses, and changes nothing, unless --yes is passed.

bash
stechbd datastore rm <datastore> [--yes]
OptionDescription
<datastore>The datastore, by slug, name or id. Required.
--yesSkip the question.
bash
stechbd datastore rm scratch
stechbd datastore rm scratch --yes

stechbd datastore start

Starts a datastore that is stopped, and prints its state afterwards.

bash
stechbd datastore start <datastore>
OptionDescription
<datastore>The datastore, by slug, name or id. Required.
bash
stechbd datastore start main

stechbd datastore stop

Stops a datastore. Every application using it loses its database until it is started again. At a terminal the command asks first; outside one it refuses unless --yes is passed.

bash
stechbd datastore stop <datastore> [--yes]
OptionDescription
<datastore>The datastore, by slug, name or id. Required.
--yesSkip the question.
bash
stechbd datastore stop main
stechbd datastore stop main --yes

stechbd datastore connection

Prints the connection string, password included, to stdout and nothing else, so a shell can capture exactly that value. The panel records each read. To put the string into an application without printing it, use link instead.

bash
stechbd datastore connection <datastore>
OptionDescription
<datastore>The datastore, by slug, name or id. Required.
bash
DATABASE_URL=$(stechbd datastore connection main)
stechbd datastore connection main --json

stechbd datastore query

Runs one statement with the engine's own client. The statement is an argument, or it is read from stdin when none is given. The command exits with the client's status: 0 when the statement succeeds, and 1 when the database refuses it. A statement that is cut short by the panel is reported with a warning.

bash
stechbd datastore query <datastore> [<statement>]
OptionDescription
<datastore>The datastore, by slug, name or id. Required.
<statement>The statement, in the engine's own language. Read from stdin when omitted.
bash
stechbd datastore query main "select count(*) from users"
cat migrate.sql | stechbd datastore query main