1
votes

I am following the below document to create 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
    )

I am trying the following code but some how the dynamodb object is not able to find the create_schema table.

AttributeError: 'DynamoDBConnection' object has no attribute 'create_schema'

Please let me know if this method is deprecated or if there any other way to create a table.

1
How did you create the conn? - franklinsijo
conn=boto.dynamodb2.connect_to_region(args.region) - Bhavik Joshi

1 Answers

1
votes

The DynamoDBConnection created using boto.dynamodb2 does not have create_schema method. It is part of boto.dynamodb.layer2.Layer2 API.

Create the connection using,

import boto.dynamodb
conn = boto.dynamodb.connect_to_region(region)

Or to create a table with boto.dynamodb2, use this create_table method or Table instead.