squirrel.driver.store_driver
¶
Module Contents¶
Classes¶
A :py:class`MapDriver` implementation, which uses an :py:class`AbstractStore` instance to retrieve its items. |
-
class
squirrel.driver.store_driver.
StoreDriver
(url: str, serializer: squirrel.serialization.SquirrelSerializer, **kwargs)¶ Bases:
squirrel.driver.driver.MapDriver
A :py:class`MapDriver` implementation, which uses an :py:class`AbstractStore` instance to retrieve its items.
The store used by the driver can be accessed via the :py:property:`store` property.
Initializes StoreDriver.
- Parameters
url (str) – the url of the store
serializer (SquirrelSerializer) – serializer to be passed to SquirrelStore
**kwargs – Keyword arguments to pass to the super class initializer.
-
name
= store_driver¶
-
get
(self, key: Any, **kwargs) → Iterable¶ Returns an iterable over the items corresponding to key using the store instance.
Calls and returns the result of
self.store.get()
. Subclasses might filter or manipulate the iterable over items returned from the store.- Parameters
key (Any) – Key with which the items will be retrieved. Must be of type and format that is supported by the
instance. (store) –
**kwargs – Keyword arguments passed to the
self.store.get()
method.
- Returns
(Iterable) Iterable over the items corresponding to key, as returned from the store.
-
get_iter
(self, flatten: bool = True, **kwargs) → squirrel.iterstream.Composable¶ Returns an iterable of items in the form of a
squirrel.iterstream.Composable
, which allows various stream manipulation functionalities.Items are fetched using the
get()
method. The returnedComposable
iterates over the items in the order of the keys returned by thekeys()
method.- Parameters
flatten (bool) – Whether to flatten the returned iterable. Defaults to True.
**kwargs – Other keyword arguments passed to super().get_iter(). For details, see
squirrel.driver.MapDriver.get_iter()
.
- Returns
(squirrel.iterstream.Composable) Iterable over the items in the store.
-
keys
(self, **kwargs) → Iterable¶ Returns an iterable over all keys to the items that are obtainable through the driver.
Calls and returns the result of
self.store.keys()
. Subclasses might filter or manipulate the iterable over keys returned from the store.- Parameters
**kwargs – Keyword arguments passed to the
self.store.keys()
method.- Returns
(Iterable) Iterable over all keys in the store, as returned from the store.
-
property
store
(self) → squirrel.store.store.AbstractStore¶ Store that is used by the driver.