繁体   English   中英

如何使用 python 在 dynamodb 中按需创建一个表?

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

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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM