The seedbox.db.sqlalchemy.model_util
Module¶
Provides utilities for managing models
-
seedbox.db.sqlalchemy.model_util.
from_db
(db_item)¶ Database to Model
Handles the conversion from the database model object to the corresponding public facing api model object. If an item has a reference to another model object then the call is recursive.
Parameters: db_item – an instance of a database model object Returns: an instance of an api model object
-
seedbox.db.sqlalchemy.model_util.
to_db
(api_item, db_item=None)¶ Model to database
Handles the conversion from the api model object to the corresponding database model object. If an item has a reference to another model object then the call is recursive.
Parameters: - api_item – an instance of a api model object
- db_item – an instance of a database model object that is to be updated. (optional)
Returns: an instance of an database model object