I am working on Dyanamodb using Boto3 and Python. One of the issues I am finding is  when should we use the 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 examples Using 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With