0

I'm using DynamoDB to make a Room Booking Website on Django. Every time I refresh the page, the console throws me a ResourceNotFoundException - Requested resource not found, which seems to be happening when I use table.scan(). On certain pages the table still loads, but on others' I'm shown a debug error.

Here's a part of my code:

dynamodb = boto3.resource(
    'dynamodb',
    aws_access_key_id="XXXXXX",
    aws_secret_access_key="XXXXXX",
    region_name="eu-west-2"
)    
table = dynamodb.Table(table_name)
response = table.scan(TableName=table_name)

I'm entirely sure that the table_name value contains the correct string.

What could be the problem?

Gordon Lee
  • 15
  • 4

1 Answers1

0

You are confusing the Client-level scan method with the Resource-level scan method. The former requires you to provide a TableName parameter, while the latter does not (because it's a method on an existing Table object, so the table name is implicitly known).

Also, see Difference in boto3 between resource, client, and session?

jarmod
  • 71,565
  • 16
  • 115
  • 122