The prod.films
DynamoDB
table stores stores data for various films.
Each Item
in the prod.films
table contains 5 Attributes
:
filmName
- the name of the film, a DynamoDBString
.directorName
- the name of the director who directed the film, a DynamoDBString
.length
- the duration of the film in minutes, a DynamoDBNumber
.rating
- theIMDb
rating for the film, a DynamoDBNumber
.releaseDate
- the date in which the film was released in the United Kingdom, a DynamoDBString
.
The filmName
is the Hash (Partition) Key of the table.
The prod.films
table also contains one Global Secondary Index (GSI) called DirectorName
. The Hash Key
of this index is
the directorName
attribute.
An example Item
from the table, in JSON format, is given below:
{
"filmName": "Batman Begins",
"directorName": "Christopher Nolan"
"length": 140,
"rating": 8.2,
"releaseDate": "2006-06-16"
}
You are required to implement the all the methods marked with TODO Implement
in the FilmsDBService and FilmDataStatsGenerator classes in such a way that
all the unit tests in test/test_films_data_stats_generator.py pass.
FilmsDBService should be implemented in such a way that you only need to query the prod.films
table once per full run of the test/test_films_data_stats_generator.py test suite.
The test/test_films_data_stats_generator.py file should not be modified. If you would like to add your own unit tests, you can add these in a separate file.
The requirements.txt file should only be modified to add any third-party dependencies required for your solution.
Please note that all third-party depdencies required for your solution MUST be added to the requirements.txt file.
You must use the AWS DynamoDB SDK Python (Boto 3)
library to work with DynamoDB.
The dependency for this library has already been added to the requirements.txt
file.
Apart from that, you are free to use whichever libraries you want (Python or third-party) when implementing your solution.
Note we recommend using the Python datetime
library for working with dates.
Your solution also must use/be compatible with Python version 3.7
.
This test should take no longer than 2 hours to complete successfully.
Good luck!
Please push your changes to the master branch
of this repository. You can push one or more commits.
Once you are finished with the task, please click the Complete task
link on this screen.