Browse documentation

requests migrate

Use dynomate-cli requests migrate to convert a legacy collection of .toml files to DNML in the same folder.

It is the same as Migrate collection in the app.

Migrate a collection

Give the collection folder with --collection, the only option:

Shell
dynomate-cli requests migrate --collection ./legacy
Migrated 1 request(s) in ./legacy. Original files were preserved.
  • The command converts all requests in the folder, not in nested folders.
  • It writes the collection.dnml marker only if all converted requests are valid.
  • It keeps the .toml files as a recovery copy, and does not change environments/.

Review the new files before you remove the legacy files.

What changes

Each legacy request becomes a .dnml file with the same name, operations and expressions. References become DNML templates. This legacy request:

TOML
recent-orders.toml
name = 'recent-orders'[[operations]]type = 'query'name = 'Find recent order'tableArn = 'arn:aws:dynamodb:ap-southeast-2:111122223333:table/Orders'keyConditionExpression = 'accountId = :accountId'consistentRead = falsescanIndexForward = false[operations.expressionAttributeNames][operations.expressionAttributeValues]':accountId' = 'account#42'

becomes recent-orders.dnml:

DNML
recent-orders.dnml
version = "1.0"name = "recent-orders"[execution]onError = "continue"[[dynamodb.query]]name = "Find recent order"tableArn = "arn:aws:dynamodb:ap-southeast-2:111122223333:table/Orders"keyConditionExpression = "accountId = :accountId"consistentRead = falsescanIndexForward = falsereturnConsumedCapacity = "indexes"[dynamodb.query.expressionAttributeNames][dynamodb.query.expressionAttributeValues]":accountId" = "account#42"

To keep the legacy behavior, the command adds:

  • [execution] onError = "continue", the DNML default error policy.
  • returnConsumedCapacity = "indexes" on each query.
  • returnValues = "none" on each update.

You can change these later. The marker changes too:

TOML
collection.toml
version = '1.0'type = 'dynomate-collection'created = '2026-09-10T12:00:00Z'[metadata]author = 'Docs'
DNML
collection.dnml
version = "1.0"type = "dynomate-collection"created = "2026-09-10T12:00:00Z"[metadata]author = "Docs"

Failures

If a request does not convert, the command stops and shows the file and field, but no values from your files.

Shell
dynomate-cli requests migrate --collection ./legacy
MIGRATION_FAILED: ./legacy/recent-orders.toml: operations[0].consistentRead: required legacy field is missing (./legacy/recent-orders.toml)

The command then removes the new files, and the collection stays a legacy collection. Correct the file and run the command again.

Common causes:

  • A required field is missing, or an unknown field is present.
  • The file name is not the request name.
  • The operation type is not query, update, put or delete.
  • A different .dnml file has the same name. Move it, because the command never overwrites it.

A path that is not a collection fails immediately:

Shell
dynomate-cli requests migrate --collection ./does-not-exist
DNML_MISSING_FIELD: Collection marker not found (./does-not-exist/collection.dnml)

Run it again

You can safely run the command again. On a DNML collection, it changes nothing:

Shell
dynomate-cli requests migrate --collection ./legacy
Collection already uses DNML: ./legacy

If a migration stopped, run it again. Converted files that match are not conflicts.

Run before migration

requests run does not run requests from a legacy collection. It shows the migrate command:

Shell
dynomate-cli requests run --collection ./legacy --request recent-orders --approval never
recent-orders: failed
MIGRATION_REQUIRED: Legacy collection requires migration. Run: dynomate-cli requests migrate --collection './legacy'
at ./legacy

Exit codes

CodeMeaning
0The collection now uses DNML.
1Migration failed. The error is on standard error.
2The arguments are not valid, for example no --collection.