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
.dnmlfiles. - 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
| Command | What 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 find-and-update-order
version = "1.0"
name = "find-and-update-order"
description = "Find the most recent order for an account, mark it reviewed, and read it back."
[variables]
accountId = "account#42"
pageSize = "1"
[defaults]
profileName = "commerce-dev"
[[dynamodb.query]]
name = "Find recent order"
tableArn = "arn:aws:dynamodb:ap-southeast-2:111122223333:table/Orders"
keyConditionExpression = "accountId = :accountId"
limit = "${cast(pageSize, 'integer')}"
scanIndexForward = false
[dynamodb.query.expressionAttributeValues]
":accountId" = "${accountId}"
[[dynamodb.update]]
name = "Mark reviewed"
dependsOn = "Find recent order"
tableArn = "arn:aws:dynamodb:ap-southeast-2:111122223333:table/Orders"
updateExpression = "SET #status = :status"
[dynamodb.update.keyValues]
accountId = "${accountId}"
orderId = "${find_recent_order.items[0].orderId}"
[dynamodb.update.expressionAttributeNames]
"#status" = "status"
[dynamodb.update.expressionAttributeValues]
":status" = "REVIEWED"
[[dynamodb.get]]
name = "Read back"
dependsOn = "Mark reviewed"
tableArn = "arn:aws:dynamodb:ap-southeast-2:111122223333:table/Orders"
consistentRead = true
[dynamodb.get.keyValues]
accountId = "${accountId}"
orderId = "${find_recent_order.items[0].orderId}" $ 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"} 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 NAMEloads one. See Variables and environments. - Default exports. A
dynamodb.exportwithout a path writes to theexportsfolder. - Local SQL snapshots. An export with
snapshot = trueregisters 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
| Platform | Directory |
|---|---|
| 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 runfails withAPP_DATA_UNAVAILABLE. SetDYNO_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