Boto3 Python library returning cached data for dynamo table apis

0

Hi

I am using boto3 python library to get dynamo table info. I have noticed that the table metadata values returned by the api are outdated. I have tried adding a table.reload() before getting the table value but that didnt help.

conn = boto3.resource(
                    'dynamodb',
                    region_name=..,
                    config=..,
                )
table = conn.Table("table_name")
table.reload()

print(table.table_status).  <-- this is wrong

asked 6 months ago227 views
1 Answer
-2

DynamoDB read operations such as Query, Scan, GetItem are by default eventually consistent, meaning that the response might not reflect the result of the latest write operation. The api calls for this operations supports an additional parameter called ConsistentRead. If this is set to true, it will enforce DynamoDB to return the latest values from your table.

For more details, please have a look here.

profile picture
answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions