如何在 python boto 中创建 dynamodb table
how to create a dynamodb table in python boto
我正在按照以下文档创建 table boto dynamodb documentation
message_table_schema = conn.create_schema(
hash_key_name='forum_name',
hash_key_proto_value=str,
range_key_name='subject',
range_key_proto_value=str
)
table = conn.create_table(
name='messages',
schema=message_table_schema,
read_units=10,
write_units=10
)
我正在尝试以下代码,但 dynamodb 对象无法找到 create_schema table.
AttributeError: 'DynamoDBConnection' object has no attribute 'create_schema'
如果此方法已被弃用,或者是否有任何其他方法可以创建 table。
,请告诉我
使用boto.dynamodb2
创建的DynamoDBConnection
没有create_schema
方法。它是boto.dynamodb.layer2.Layer2
API的一部分。
使用
创建连接
import boto.dynamodb
conn = boto.dynamodb.connect_to_region(region)
或者要用 boto.dynamodb2
创建一个 table,请改用 create_table
method or Table
。
我正在按照以下文档创建 table boto dynamodb documentation
message_table_schema = conn.create_schema(
hash_key_name='forum_name',
hash_key_proto_value=str,
range_key_name='subject',
range_key_proto_value=str
)
table = conn.create_table(
name='messages',
schema=message_table_schema,
read_units=10,
write_units=10
)
我正在尝试以下代码,但 dynamodb 对象无法找到 create_schema table.
AttributeError: 'DynamoDBConnection' object has no attribute 'create_schema'
如果此方法已被弃用,或者是否有任何其他方法可以创建 table。
,请告诉我使用boto.dynamodb2
创建的DynamoDBConnection
没有create_schema
方法。它是boto.dynamodb.layer2.Layer2
API的一部分。
使用
创建连接import boto.dynamodb
conn = boto.dynamodb.connect_to_region(region)
或者要用 boto.dynamodb2
创建一个 table,请改用 create_table
method or Table
。