Dynomate CLI

dynomate-cli runs DNML request files from a terminal, a script or a CI job.

To get the CLI, see Install the Dynomate CLI.

One Runtime

The app and the CLI use one DNML runtime. They have:

  • The same .dnml files.
  • The same validation before any AWS call, with the same error codes.
  • The same operation order, statuses, skip reasons and results.
  • The same safety rules. Table deletes, truncates and endpoints in the request need confirmation in the app and approval in the CLI.

Commands

CommandWhat it does
requests run Runs one DNML request and prints the result.
requests migrate Converts a legacy TOML collection to DNML and keeps the original files.
table import Imports items into a DynamoDB table from a JSON or CSV file, S3, another table or standard input.

For scripts and CI jobs, see Automation and CI.

Running Example

The CLI tab shows a run with requests run.

orders/find-and-update-order.dnml
$ dynomate-cli requests run ./orders/find-and-update-order.dnml
find-and-update-order: success
Find recent order: success
  result: {"count":1,"items":[{"accountId":"account#42","orderId":"order#9812","status":"PENDING","total":42}],"lastEvaluatedKey":"eyJvcmRlcklkIjp7IlMiOiJvcmRlciM5ODEyIn0sImFjY291bnRJZCI6eyJTIjoiYWNjb3VudCM0MiJ9fQ==","pages":1,"requestId":"1f999a0f-0ec9-4dba-bd58-c012239a26db","scannedCount":1}
Mark reviewed: success
  result: {"attributes":{"accountId":"account#42","orderId":"order#9812","status":"REVIEWED","total":42},"requestId":"38ea89c4-6e57-48d5-a038-66ab17034323"}
Read back: success
  result: {"found":true,"item":{"accountId":"account#42","orderId":"order#9812","status":"REVIEWED","total":42},"requestId":"d2946fe3-e6b1-4ede-a4ce-aa4cd1365319"}
This run used DynamoDB Local through the saved endpoint of the commerce-dev profile.

App Data Directory

requests run uses the app data directory of the app for:

  • Saved profile endpoints. Custom endpoints saved on a profile in the app. See Endpoints.
  • Global environments. --global-env NAME loads one. See Variables and environments.
  • Default exports. A dynamodb.export without a path writes to the exports folder.
  • Local SQL snapshots. An export with snapshot = true registers its snapshot for the app. See Local SQL snapshots.

--collection-env reads from the collection folder, not from app data. table import uses your AWS profile, not app data. See Profiles.

Default Location

PlatformDirectory
macOS~/Library/Application Support/com.dynomate.app
Windows%APPDATA%\com.dynomate.app
Linux$XDG_DATA_HOME/com.dynomate.app, usually ~/.local/share/com.dynomate.app

Choose Another Directory

Set DYNO_APP_DATA_DIR to use a different directory:

$ DYNO_APP_DATA_DIR=/path/to/app-data dynomate-cli requests run ./orders/find-and-update-order.dnml
  • The app reads the same variable, so both can share one directory.
  • If a CI run must not use saved settings, set an empty directory or no directory.
  • If the CLI cannot find a directory, requests run fails with APP_DATA_UNAVAILABLE. Set DYNO_APP_DATA_DIR.

Get Help

Add --help to a command to see its subcommands and options:

$ dynomate-cli requests --help
Run DNML requests or migrate legacy collections

Usage: dynomate-cli requests <COMMAND>

Commands:
  run      Run one DNML request by FILE or by --collection and --request
  migrate  Convert a legacy collection to DNML while preserving the original files
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help