0
我與DynamoDB非常新,我試圖創建boto3表,找到下面的代碼:本地主機端點到DynamoDB本地自認倒黴Boto3
from __future__ import print_function # Python 2/3 compatibility
import boto3
dynamodb = boto3.resource('dynamodb', region_name='us-west-2', endpoint_url="http://localhost:8000")
table = dynamodb.create_table(
TableName='Movies',
KeySchema=[
{
'AttributeName': 'year',
'KeyType': 'HASH' #Partition key
},
{
'AttributeName': 'title',
'KeyType': 'RANGE' #Sort key
}
],
AttributeDefinitions=[
{
'AttributeName': 'year',
'AttributeType': 'N'
},
{
'AttributeName': 'title',
'AttributeType': 'S'
},
],
ProvisionedThroughput={
'ReadCapacityUnits': 10,
'WriteCapacityUnits': 10
}
)
print("Table status:", table.table_status)
運行此代碼後,我得到了「表狀態:主動「。我認爲這意味着Python代碼工作正常,表已創建。但是,我無法從localhost Endpoint或從控制檯看到此表。有什麼不對的嗎?任何人都可以給我一些解釋如何使用python與本地主機來創建表。
謝謝