models#

Enhance the pynamodb.models.Model class.

class pynamodb_mate.models.ConsoleUrlMaker[source]#

Create common AWS Dynamodb Console url.

table_overview(region_name: str, table_name: str) str[source]#

Create the AWS Console url that can preview Dynamodb Table overview.

table_items(region_name: str, table_name: str) str[source]#

Create the AWS Console url that can preview items in Dynamodb Table.

item_detail(region_name: str, table_name: str, hash_key: str, range_key: Optional[str] = None) str[source]#

Create the AWS Console url that can preview specific Dynamodb item.

class pynamodb_mate.models.Model(hash_key: Optional[Any] = None, range_key: Optional[Any] = None, **attributes)[source]#

Pynamodb Model with additional features.

New in version 5.1.0.1.

to_dict(copy=False) dict[source]#

Access the item data as a dictionary.

New in version 5.3.4.1.

classmethod get_one_or_none(hash_key: ~typing.Any, range_key: ~typing.Optional[~typing.Any] = None, consistent_read: bool = False, attributes_to_get: ~typing.Optional[~typing.Sequence[str]] = None, settings: ~pynamodb.settings.OperationSettings = <pynamodb.settings.OperationSettings object>) Optional[Model][source]#

Get one Dynamodb item object or None if not exists.

New in version 5.3.4.1.

delete_if_exists() bool[source]#

Delete the item if exists. Return True if exists.

New in version 5.3.4.1.

classmethod delete_all() int[source]#

Delete all item in a Dynamodb table by scanning all item and delete.

New in version 5.3.4.1.

classmethod get_table_overview_console_url() str[source]#

Create the AWS Console url that can preview Dynamodb Table settings.

New in version 5.2.1.1.

classmethod get_table_items_console_url() str[source]#

Create the AWS Console url that can preview items in Dynamodb Table.

New in version 5.2.1.1.

property item_detail_console_url: str#

Return the AWS Console url that can preview Dynamodb item data.

New in version 5.2.1.1.

classmethod iter_scan(filter_condition: ~typing.Optional[~pynamodb.expressions.condition.Condition] = None, segment: ~typing.Optional[int] = None, total_segments: ~typing.Optional[int] = None, limit: ~typing.Optional[int] = None, last_evaluated_key: ~typing.Optional[~typing.Dict[str, ~typing.Dict[str, ~typing.Any]]] = None, page_size: ~typing.Optional[int] = None, consistent_read: ~typing.Optional[bool] = None, index_name: ~typing.Optional[str] = None, rate_limit: ~typing.Optional[float] = None, attributes_to_get: ~typing.Optional[~typing.Sequence[str]] = None, settings: ~pynamodb.settings.OperationSettings = <pynamodb.settings.OperationSettings object>) IterProxy[_T][source]#

Similar to the Model.scan() method, but it returns a more user-friendly iterator with type hint.

New in version 5.3.4.6.

classmethod iter_query(hash_key: ~typing.Any, range_key_condition: ~typing.Optional[~pynamodb.expressions.condition.Condition] = None, filter_condition: ~typing.Optional[~pynamodb.expressions.condition.Condition] = None, consistent_read: bool = False, index_name: ~typing.Optional[str] = None, scan_index_forward: ~typing.Optional[bool] = None, limit: ~typing.Optional[int] = None, last_evaluated_key: ~typing.Optional[~typing.Dict[str, ~typing.Dict[str, ~typing.Any]]] = None, attributes_to_get: ~typing.Optional[~typing.Iterable[str]] = None, page_size: ~typing.Optional[int] = None, rate_limit: ~typing.Optional[float] = None, settings: ~pynamodb.settings.OperationSettings = <pynamodb.settings.OperationSettings object>) IterProxy[_T][source]#

Similar to the Model.query() method, but it returns a more user-friendly iterator with type hint.

New in version 5.3.4.6.

classmethod iter_scan_index(index: Union[GlobalSecondaryIndex, LocalSecondaryIndex], filter_condition: Optional[Condition] = None, segment: Optional[int] = None, total_segments: Optional[int] = None, limit: Optional[int] = None, last_evaluated_key: Optional[Dict[str, Dict[str, Any]]] = None, page_size: Optional[int] = None, consistent_read: Optional[bool] = None, rate_limit: Optional[float] = None, attributes_to_get: Optional[List[str]] = None) IterProxy[_T][source]#

Similar to the Index.scan() method, but it returns a more user-friendly iterator with type hint.

Parameters:

index – the GlobalSecondaryIndex or LocalSecondaryIndex object, usually it is a class attribute of your Model attribute.

New in version 5.3.4.6.

classmethod iter_query_index(index: Union[GlobalSecondaryIndex, LocalSecondaryIndex], hash_key: Any, range_key_condition: Optional[Condition] = None, filter_condition: Optional[Condition] = None, consistent_read: Optional[bool] = False, scan_index_forward: Optional[bool] = None, limit: Optional[int] = None, last_evaluated_key: Optional[Dict[str, Dict[str, Any]]] = None, attributes_to_get: Optional[List[str]] = None, page_size: Optional[int] = None, rate_limit: Optional[float] = None) IterProxy[_T][source]#

Similar to the Index.scan() method, but it returns a more user-friendly iterator with type hint.

Parameters:

index – the GlobalSecondaryIndex or LocalSecondaryIndex object, usually it is a class attribute of your Model attribute.

New in version 5.3.4.6.

exception DoesNotExist(msg: Optional[str] = None, cause: Optional[Exception] = None)#