When to use dynamodb.client, dynamodb.resource and dynamodb.Table?
dynamodb.client
provide a low level access directly to the DynamoDB apis. You can call only the apis listed here.
The service resource
objects like dynamodb.resource
provides a more object oriented way of access the AWS resources. DynamoDB is a fairly straightforward service in terms of the different kinds of things you create in AWS. (Basically the main object you create are tables, as opposed to a service like EC2 where you have many different kinds of objects (instances, security groups, launch configurations, etc).
The dynamodb.Table
object provides a simplified way of accessing the data in the table. It will marshall and unmarshall the data automatically from the DynamoDB format to a simpler for you.
Format examplesUsing the dynamodb.Client data might look like this
{ "id": { "S": "a unique id" }, "date": { "N": "12345678901234" }}
Whereas using the Table
resource you will get data that looks like this
{ "id": "a unique id", "date": 12345678901234}
I recommend using the Table
resources since it simplifies data access.
They are three different ways of doing the same thing, via slightly different syntax. Pick which ever one you like.