The seedbox.db.sqlalchemy.api
Module¶
Private database API implemented for sqlalchemy for database operations.
-
class
seedbox.db.sqlalchemy.api.
Connection
(conf)¶ Bases:
seedbox.db.base.Connection
SQLAlchemy connection.
Initialize new instance.
Parameters: conf (oslo_config.cfg.ConfigOpts) – an instance of configuration file -
backup
()¶ Backup database.
-
bulk_create
(instances)¶ Save the instances in bulk to the database.
Parameters: instances (list) – a list of instance of modeled data object
-
bulk_update
(value_map, entity_type, qfilter)¶ Perform bulk save.
based on filter criteria with values from value map to the database.
Parameters: - value_map (dict) – a dict of key-value pairs representing the data of an instance.
- entity_type (class) – the model type
- qfilter (dict) – query filter to determine which rows to update
-
clear
()¶ Clear database.
-
delete
(instance)¶ Delete the instance(s) based on filter from the database.
Parameters: instance – an instance of modeled data object
-
delete_by
(entity_type, qfilter)¶ Delete instances of a specific type based on filter criteria
Parameters: - entity_type – the model type
- qfilter – query filter to determine which rows to update
-
fetch
(entity_type, pk)¶ Fetch the instance using primary key from the database.
Parameters: - entity_type – the model type
- pk – primary key value
-
fetch_by
(entity_type, qfilter)¶ Fetch the instance(s) based on filter from the database.
Parameters: - entity_type – the model type
- qfilter – query filter to determine which rows to update
-
save
(instance)¶ Save the instance to the database
Parameters: instance – an instance of modeled data object
-
shrink_db
()¶ Shrink database.
-
upgrade
()¶ Migrate the database to version or most recent version.
-