Backends¶
-
class
modularodm.storage.base.
Storage
[source]¶ Abstract base class for storage objects. Subclasses (e.g.
PickleStorage
,MongoStorage
, etc.) must define insert, update, get, remove, flush, and find_all methods.-
translator
= <modularodm.translators.DefaultTranslator object>¶
-
logger
= <modularodm.storage.base.Logger object>¶
-
update
(this, *args, **kwargs)[source]¶ Update multiple records with new data.
Parameters: - query – A query object.
- data (dict) – Dictionary of key:value pairs.
-
get
(this, *args, **kwargs)[source]¶ Get a single record.
Parameters: - primary_name (str) – The name of the primary key.
- key – The value of the primary key.
-
find_one
(this, *args, **kwargs)[source]¶ Gets a single object from the collection.
If no matching documents are found, raises
NoResultsFound
. If >1 matching documents are found, raisesMultipleResultsFound
.Params: One or more Query
orQuerySet
objects may be passedReturns: The selected document
-
find
(this, *args, **kwargs)[source]¶ Return a generator of query results. Takes optional
by_pk
keyword argument; if true, return keys rather than values.Parameters: query – Returns: a generator of StoredObject
instances
-