Stores
Retrieving store objects
A store object can be retrieved from a connection object that contains a store. Use the get_store() function of the BlueConic connection
object.
Using store objects
- class Store
- delete_items(itemIds)
Delete a batch of items from the store by their IDs.
- Parameters:
itemIds (Sequence[str]) – A sequence of item IDs to delete.
- Usage:
>>> import blueconic >>> from blueconic.client.oauth.store import StoreMixin >>> from blueconic.domain import StoreItem >>> bc = blueconic.Client() >>> connection_id = bc.get_blueconic_parameter_value("My connection","connection") >>> connection = bc.get_connection(connection_id) >>> store = connection.get_store() >>> store.delete_items(["item1", "item2"])
- get_items()
Gets the items in this store.
- Returns:
[description]
- Return type:
Iterator[StoreItem]
- Usage:
>>> from datetime import datetime, timedelta >>> import blueconic >>> bc = blueconic.Client() >>> connection_id = bc.get_blueconic_parameter_value("My connection","connection") >>> connection = bc.get_connection(connection_id) >>> store = connection.get_store() >>> items = store.get_items() >>> past = (datetime.now() - timedelta(days=90)) >>> for item in items: >>> if past < item.get_value('creationDate').replace(tzinfo=None): >>> print(item.get_value('category')) BlueConic BlueConic Interactions Insights
- upsert_items(items)
Upsert (insert or update) a batch of store items to a store.
- Parameters:
items (Sequence[StoreItem]) – A sequence of StoreItem objects to upsert.
- Raises:
ValueError – If more than 1000 items are provided.
- Usage:
>>> import blueconic >>> from blueconic.client.oauth.store import StoreMixin >>> from blueconic.domain import StoreItem >>> bc = blueconic.Client() >>> connection_id = bc.get_blueconic_parameter_value("My connection","connection") >>> connection = bc.get_connection(connection_id) >>> store = connection.get_store() >>> store_items = [StoreItem(store_id="item1", name="Item 1"), StoreItem(store_id="item2", name="Item 2")] >>> store.upsert_items(store_items)
- property creation_date
- Returns:
The creation date of this object.
- Return type:
Optional[datetime]
- property creator_username
- Returns:
The username that created this object.
- Return type:
Optional[str]
- property description
Returns description of this store.
- property id
- Returns:
ID of this object.
- Return type:
- property labels
- Returns:
The labels this object.
- Return type:
Optional[Sequence[str]
- property last_modified_date
- Returns:
The last modified date of this object.
- Return type:
Optional[datetime]
- property last_modified_username
- Returns:
The last modified username of this object.
- Return type:
Optional[str]
- property name
- Returns:
Name of this object.
- Return type:
Optional[str]
- property nr_of_items
Returns the number of items in this store.
- property type
Returns the type of this store