dynamodb package¶
Submodules¶
dynamodb.core module¶
- class dynamodb.core.DecimalEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)¶
Bases:
JSONEncoder
- default(obj)¶
Implement this method in a subclass such that it returns a serializable object for
o
, or calls the base implementation (to raise aTypeError
).For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o)
dynamodb.dynamodb_helpers module¶
- dynamodb.dynamodb_helpers.get_config()¶
Reads the configuration file and returns the config object.
- Returns:
config: The config object.
- dynamodb.dynamodb_helpers.get_dynamodb_resource()¶
Creates a DynamoDB resource using the AWS session.
- Returns:
dynamo_resource: The DynamoDB resource.
- dynamodb.dynamodb_helpers.get_movie_item(table, year, title)¶
Gets a movie item from the DynamoDB table.
- Args:
table: The DynamoDB table resource. year: The year of the movie. title: The title of the movie.
- Returns:
dict: The movie item.
- dynamodb.dynamodb_helpers.get_movies_table(dynamo_resource)¶
Gets the movies table from DynamoDB.
- Args:
dynamo_resource: The DynamoDB resource.
- Returns:
table: The DynamoDB table resource for movies.
- dynamodb.dynamodb_helpers.get_path_to_data()¶
Return path to data.
- dynamodb.dynamodb_helpers.get_raw_data_path()¶
Return path to raw data.
- dynamodb.dynamodb_helpers.get_tidy_data_path()¶
Return path to tidy data.
- dynamodb.dynamodb_helpers.list_dynamodb_tables(dynamo_resource)¶
Lists all tables in the DynamoDB resource.
- Args:
dynamo_resource: The DynamoDB resource.
- Returns:
list: List of table names.
- dynamodb.dynamodb_helpers.query_movies_by_year(table, year)¶
Queries movies by year from the DynamoDB table.
- Args:
table: The DynamoDB table resource. year: The year to query.
- Returns:
list: List of movies for the given year.
- dynamodb.dynamodb_helpers.tidy_movie_data(movies)¶
Transforms the raw movie data into a tidy DataFrame.
- Args:
movies (list): List of raw movie data.
- Returns:
DataFrame: Tidy DataFrame containing movie data.