View Source mix dynamo.generate_schema (Dynamo v0.2.0)

Inspects a table (key schema, GSIs and a sample of items) and writes a schema module that can read the existing items back.

mix dynamo.generate_schema TABLE_NAME [options]

Options

--module        Module name (default: derived from the table name)
--output        File path (default: lib/<underscored module>.ex)
--scan-items    Items to sample for field discovery (default: 25)
--overwrite     Replace an existing file
--endpoint / --region / --repo   see other dynamo tasks

Key detection

If the sampled partition keys look like entity#value (this library's default layout), the generator emits entity_name and infers the source field from the sample; otherwise it emits raw_keys: true so the key attributes are used as-is. Review the generated file – the sample may not cover every attribute.