[英]Why does boto3 not consistently find my table in local DynamoDB?
我正在運行本地dockerized DynamoDB:
~ docker run -d -p 8000:8000 amazon/dynamodb-local
...其中有一個通過aws dynamodb CLI *創建的表。
從ipython shell boto3可以毫無問題地找到該表:
db = boto3.resource('dynamodb',
endpoint_url='http://localhost:8000',
region_name='eu-west-2')
print([t for t in db.tables.all()])
# ==> [dynamodb.Table(name=u'myTable')]
...但是在本地運行的flask應用程序中從斷點訪問該表時,boto3找不到該表:
db = boto3.resource('dynamodb',
endpoint_url='http://localhost:8000',
region_name='eu-west-2')
[t for t in db.tables.all()]
# ==> []
我對燒瓶應用程序的上下文一無所知,它會改變boto3的工作方式,所以我有點受阻。 為什么在兩種情況下對db.tables.all()
的調用都返回相同的內容?
兩個上下文都使用boto v1.7.1和python 2.7.13從同一個virtualenv運行
* CLI命令用於創建表:
~ aws dynamodb create-table --table-name myTable --attribute-definitions AttributeName=api_key,AttributeType=S AttributeName=session_id,AttributeType=S AttributeName=time_stamp,AttributeType=N --key-schema AttributeName=session_id,KeyType=HASH --global-secondary-indexes IndexName=api_key-time_stamp-index,KeySchema=["{KeyType=HASH,AttributeName=api_key}","{KeyType=RANGE,AttributeName=time_stamp}"],Projection="{ProjectionType=ALL}",ProvisionedThroughput="{ReadCapacityUnits=5,WriteCapacityUnits=5}" --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 --endpoint-url http://localhost:8000 --region eu-west-2
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.