Util¶
The utilities of database manipulations.
- lorien.database.util.convert_to_db_dict(orig_dict: Dict[str, Any]) Dict[str, Any]¶
- Convert a dict to the DynamoDB dict form. - Parameters
- orig_dict (Dict[str, Any]) -- The native dict. 
- Returns
- new_dict -- The DynamoDB dict: {'M': {<dict elements>}}. 
- Return type
- Dict[str, Any] 
 
- lorien.database.util.convert_to_db_list(orig_list: Union[Tuple[Any, ...], List[Any]]) Dict[str, Any]¶
- Convert a list to the DynamoDB list type. Note: There is no tuple type in DynamoDB so we will also convert tuples to "L" type, which is also a list. - Parameters
- orig_list (List[Any]) -- The native list. 
- Returns
- new_list -- The DynamoDB list: {'L': [<list elements>]}. 
- Return type
- Dict[str, Any] 
 
- lorien.database.util.convert_to_dict(db_dict: Dict[str, Any]) Dict[str, Any]¶
- Convert a DynamoDB dict to a native dict. - Parameters
- db_dict (Dict[str, Any]) -- A DynamoDB dict: {'M': {<dict elements>}}. 
- Returns
- new_dict -- A native dict. 
- Return type
- Dict[str, Any] 
 
- lorien.database.util.convert_to_list(db_list: Dict[str, Any]) List[Any]¶
- Convert a DynamoDB list to a native list. - Parameters
- db_list (Dict[str, Any]) -- A DynamoDB list: {'L': [<list elements>]}. 
- Returns
- new_list -- A native list. 
- Return type
- List[Any]