Skip to content

Cheat sheet

Activate license

Import license into the workspace

dbvr import-license -in=path/to/license.txt

Use external license file without importing

dbvr -license=/opt/dbvr/license.txt project list

Organize environments with projects

Create logical environments such as Test and Prod:

dbvr project create --name=Test
dbvr project create --name=Prod

List projects:

dbvr project list

Configure connections

Review authentication models and network handlers before creating datasources.

List available authentication models:

dbvr auth-models --driver=postgres-jdbc

List supported network handlers:

dbvr network-handlers --driver=postgres-jdbc

Create a datasource in the Test project:

dbvr datasource create \
  --driver=postgres-jdbc \
  --project=Test \
  --name=pg-test \
  --host=test-db.internal \
  --database=appdb \
  --user=app \
  --password=secret

Create a datasource in the Prod project:

dbvr datasource create \
  --driver=postgres-jdbc \
  --project=Prod \
  --name=pg-prod \
  --host=prod-db.internal \
  --database=appdb \
  --user=app \
  --password=secret

List datasources:

dbvr datasource list

Execute SQL

Run a query using an existing datasource:

dbvr sql -ds=pg-test "select current_date;"

Run SQL from a file:

dbvr sql -ds=pg-test -in=path/to/script.sql

Run with inline connection:

dbvr sql \
  --driver=postgres-jdbc \
  --host=localhost \
  --database=testdb \
  --user=app \
  --password=secret \
  "select * from users;"

Info

See sql.

Export results

Export query results to CSV:

dbvr sql \
  -ds=pg-test \
  -format=csv \
  -out=path/to/users.csv \
  "select * from users;"

Info

See sql.

Use cloud storage

Write results to Azure, GCP, or S3 using cloud URIs:

dbvr sql -ds=pg-prod -in=gs://my-bucket/script.sql -out=gs://my-bucket/output.txt
dbvr sql -ds=pg-prod -in=s3:///my-bucket/script.sql -out=s3:///my-bucket/output.txt
dbvr sql -ds=pg-prod -out=azb:///output.txt?endpoint=https://myaccount.blob.core.windows.net "select * from orders;"

List and test configured clouds:

dbvr cloud list
dbvr cloud test azure

Info

See cloud.