Configure dh#
Select a database#
Database commands accept --db OWNER/DATABASE, or the short form -R. Include a host when needed: --db HOST/OWNER/DATABASE.
dh db view --db OWNER/people
dh config set db OWNER/people
dh db view
The selection order is:
- An explicit
--dbvalue, or a positional database argument on commands that accept one. DH_DBin the environment.- The saved
dbsetting. - DoltHub remotes in the current local Dolt repository.
For example, dh db view OWNER/people supplies the same selection as dh db view --db OWNER/people. Do not supply both forms to the same command.
Remote discovery invokes dolt remote -v, so it requires a local dolt installation. One matching DoltHub remote selects that database. Multiple candidates prompt interactively; noninteractive commands require an explicit selection. Using --db works outside a clone and without dolt installed.
Select a host#
dh config set host www.dolthub.com
dh config get host
DH_HOST overrides the saved host; otherwise the default is www.dolthub.com. Commands with --hostname let you select the host for that invocation. A host-qualified database selector selects the API host for that database command.
Job commands that take an ID use the configured host rather than a database selector. When watching work submitted to a custom host, set DH_HOST to that host too.
Environment variables#
| Variable | Purpose |
|---|---|
DH_HOST | Default DoltHub host for the current process. |
DH_DB | Default database, in [HOST/]OWNER/DB form. |
DH_TOKEN | Authentication token; overrides saved credentials. |
DH_OAUTH_CLIENT_ID | Override the public OAuth client ID for custom-client or custom-host login. |
For one Bash command:
DH_DB=OWNER/people dh sql --branch main "SELECT COUNT(*) FROM people"
DH_REPO remains accepted as a compatibility alias for DH_DB. When both are set, DH_DB takes precedence.
To return to saved defaults, unset the environment overrides:
unset DH_HOST DH_DB
Inspect saved and effective settings#
dh config list
dh config get db
config list shows the effective host and db values and their sources. It does not discover local remotes. The supported writable keys are host and db; repo remains accepted as an alias for db. There is no config unset command. You can select another saved value or use an explicit selector for one invocation.
Settings live in dh/config.json beneath the platform config directory. See dh config for command details.