简体   繁体   English

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

[英]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'>我尝试过这种方式,但出现错误 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.

相关问题 如何使tkinter Canvas仅按需更新? - How to make tkinter Canvas update only on-demand? 如何在使用 python 的同一语句中使用 AND 和 OR 查询/扫描 DynamoDB 中的表? - How to query/scan a table in DynamoDB using AND and OR in the same statement using python? 如何使用 append 将列表添加到我的 DynamoDB 表中 Python? - How do I append a list to my DynamoDB table using Python? 使用 Python 更新 DynamoDB 表中的 JSON 记录 - Update JSON Records in DynamoDB table using Python 如何在 python 中为 aws dynamodb 创建常量 object? - How to create constent object for aws dynamodb in python? 如何使用 python 和 boto3 根据条件更新 dynamodb 表中的值? - how to update a value in dynamodb table based on condition using python and boto3? 使用 python 检查 dynamodb 表中是否存在值并获取该记录 - check if a value exists in dynamodb table using python and fetch that record 如何在 Python 中创建表 - How To Create A Table in Python 如何使用 Boto3 和 Python 为 DynamoDB 设置重试延迟选项? - How to set retry delay options for DynamoDB using Boto3 with Python? 如何使用 python 查询 DynamoDB 以获取存储为字符串的日期范围? - How to query DynamoDB using python for date range which is stored as string?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM