Talita Tiense
Talita Tiense

Reputation: 57

how to create a table in dynamodb that is on-demand using python?

I tried this way but I get the error Invalid type for parameter ProvisionedThroughput.ReadCapacityUnits, value: on-demand, type: <class 'str'>, valid types: <class 'int'>

ProvisionedThroughput={ 'ReadCapacityUnits': 'on-demand', 'WriteCapacityUnits': 'on-demand' }

Upvotes: 5

Views: 1738

Answers (1)

serg
serg

Reputation: 1023

ddb.create_table(
    TableName='my_table',
    KeySchema=[
        {'AttributeName': 'id', 'KeyType': 'HASH'},
    ],
    AttributeDefinitions=[
        {'AttributeName': 'id', 'AttributeType': 'S'},
    ],
    BillingMode='PAY_PER_REQUEST',
)

Upvotes: 6

Related Questions