【问题标题】:how to create a table in dynamodb that is on-demand using python?如何在 dynamodb 中使用 python 按需创建一个表?
【发布时间】:2021-08-28 15:47:45
【问题描述】:

我尝试过这种方式,但出现错误 Invalid type for parameter ProvisionedThroughput.ReadCapacityUnits, value: on-demand, type: , valid types:

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

【问题讨论】:

标签: python-3.x amazon-dynamodb ondemand


【解决方案1】:
ddb.create_table(
    TableName='my_table',
    KeySchema=[
        {'AttributeName': 'id', 'KeyType': 'HASH'},
    ],
    AttributeDefinitions=[
        {'AttributeName': 'id', 'AttributeType': 'S'},
    ],
    BillingMode='PAY_PER_REQUEST',
)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-25
    • 2020-02-27
    • 2021-04-14
    • 1970-01-01
    • 2018-04-29
    • 2019-09-23
    • 1970-01-01
    • 2020-08-29
    相关资源
    最近更新 更多