@tables-indexes

Defines Global Secondary Indexes for your project’s DynamoDB tables. @tables-indexes should only ever be paired with @tables.

ℹ️ As of Architect v9.4, @tables-indexes should be used in place of @indexes. @indexes will be superseded in a future Arc release.

DynamoDB is a powerful database, though different from both SQL and NoSQL databases. It is highly recommended to dig into Amazon’s resources to familiarize yourself with it:

Syntax

Example

The following app.arc file defines a DynamoDB table with two Global Secondary Indexes:

arc
@app
testapp

@tables
accounts
  accountID *String

@tables-indexes
accounts
  email *String
  name byEmail

accounts
  created *String
  name byDate
json
{
  "app": "testapp",
  "tables": [
    { "accounts": { "accountID": "*String" } }
  ],
  "tables-indexes": [
    { "accounts": { "email": "*String", "name": "byEmail" } },
    { "accounts": { "created": "*String", "name": "byDate" } }
  ]
}
toml
app="testapp"

[[tables]]
[tables.accounts]
accountID="*String"

tables-indexes = [
{ "accounts" = { "email" = "*String", "name" = "byEmail" } },
{ "accounts" = { "created" = "*String", "name" = "byDate" } }
]
yaml
---
app: testapp

tables:
- accounts:
    accountID: "*String"

tables-indexes:
- accounts:
  - email: "*String"
  - name: "byEmail"
- accounts:
  - created: "*String"
  - name: "byDate"