mstrio > project_objects > content_cache¶
- class mstrio.project_objects.content_cache.ContentCache(connection, id, content_cache_dict=None)¶
Bases:
Cache
,ContentCacheMixin
Manage content cache.
_CACHE_TYPE is a variable used by ContentCache class for cache filtering purposes.
- Parameters:
connection (Connection) –
id (str) –
content_cache_dict (dict | None) –
- delete(force=None)¶
Delete content cache.
- Parameters:
force (bool, optional) – If True, then no additional prompt will be shown before deleting object.
- Returns:
Response object.
- Return type:
Response | None
- classmethod delete_all_caches(connection, force=None, **filters)¶
Delete all content caches filtered by the class type. Optionally filter by additional conditions.
- Parameters:
cls (object) – Class type for objects to be filtered by
connection (Connection) – Strategy One connection object returned by connection.Connection()
force (bool, optional) – If True, then no additional prompt will be shown before deleting objects.
**filters – Available filter parameters: [‘db_connection_id’, ‘db_login_id’, ‘owner’, ‘status’, ‘size’, ‘wh_tables’, ‘security_filter_id’]
- Return type:
None
- static delete_caches(connection, cache_ids, force=None)¶
Bulk delete caches.
- Parameters:
connection (Connection) – Strategy One connection object returned
'connection.Connection()' (by) –
cache_ids (list[str]) – list of cache ids to be deleted
force (bool, optional) – If True, then no additional prompt will be shown before deleting objects.
- Returns:
Response object.
- Return type:
Response | None
- fetch()¶
Fetches the cache from the server, refreshing the variables to match those currently stored on the server.
- Return type:
None
- static fetch_nodes(connection, project_id)¶
Fetches the nodes for the specified connection and project.
- Parameters:
connection (Connection) – Strategy One connection object returned by ‘connection.Connection()’
project_id (string) – id of the project to fetch the nodes from
- Returns:
A list of node names for the specified project.
- Return type:
list[str]
- classmethod from_dict(connection, caches)¶
Creates Caches from a provided dictionary.
- Parameters:
cls (object) – Class type for objects to be created
connection (Connection) – Strategy One connection object returned by connection.Connection()
caches (list[dict]) – list of dictionaries the Caches will be created from
- Returns:
List of Caches created from the provided dictionaries.
- Return type:
list[ContentCache]
- invalidate()¶
Invalidate content cache. Invalidated cache will be removed from the server.
- Return type:
bool
- static invalidate_caches(connection, cache_ids)¶
Bulk invalidate caches.
- Parameters:
connection (Connection) – Strategy One connection object returned
'connection.Connection()' (by) –
cache_ids (list[str]) – List of cache ids to be invalidated
- Returns:
Response object.
- Return type:
Response | None
- classmethod list_caches(connection, to_dictionary=False, status='ready', project_id=None, nodes=None, content_type=None, limit=None, db_connection_id=None, db_login_id=None, id=None, owner=None, size=None, wh_tables=None, security_filter_id=None)¶
List content caches. You can filter them by id, database connection (db_connection_id) and project (project_id).
You can specify from which nodes caches will be retrieved. If nodes are None then all nodes are retrieved from the cluster.
- Parameters:
connection (Connection) – Strategy One connection object returned by connection.Connection().
to_dictionary (bool, optional) – If True returns dict, by default (False) returns ContentCache objects
status (string, optional) – When provided, only caches with given status will be returned (if any). Default value ready
project_id (string, optional) – When provided only caches for project with given ID will be returned (if any).
nodes (list[string] | string, optional) – names of nodes on which caches will be searched. By default, it equals None and in that case all nodes names are loaded from the cluster.
content_type (string | CacheSource.Type, optional) – When provided, only caches of given type will be returned (if any).
limit (integer, optional) – Cut-off value for the number of objects returned. This is a local limit as we always need to fetch all caches first to allow proper filtering on mstrio-py side.
db_connection_id (string, optional) – When provided, only caches for the database connection with given ID will be returned (if any).
db_login_id (string, optional) – When provided, only caches for the database login with given ID will be returned (if any).
id (string, optional) – When provided, only cache with given ID will be returned (if any).
owner (string, optional) – Owner of the content cache. Exact match on the owner’s full name.
size (string, optional) – Size condition for the content cache (in KB). When provided, only caches which satisfy the condition will be returned (if any).
wh_tables (string, optional) – When provided, only caches using given warehouse tables will be returned (if any).
security_filter_id (string, optional) – When provided, only caches using given security filter will be returned (if any).
- Returns:
List of ContentCache objects when parameter to_dictionary is set to False (default value) or list of dictionaries otherwise.
- Return type:
list[’ContentCache’] | list[dict]
- list_properties()¶
List properties for content cache.
- Return type:
dict
- load()¶
Load content cache.
- Return type:
bool
- classmethod load_all_caches(connection, **filters)¶
Load all content caches filtered by the class type. Optionally filter by additional conditions.
- Parameters:
cls (object) – Class type for objects to be filtered by
connection (Connection) – Strategy One connection object returned by connection.Connection()
**filters – Available filter parameters: [‘db_connection_id’, ‘db_login_id’, ‘owner’, ‘status’, ‘size’, ‘wh_tables’, ‘security_filter_id’]
- Return type:
None
- static load_caches(connection, cache_ids)¶
Bulk load caches.
- Parameters:
connection (Connection) – Strategy One connection object returned
'connection.Connection()' (by) –
cache_ids (list[str]) – list of cache ids to be loaded
- Returns:
Response object.
- Return type:
Response | None
- unload()¶
Unload content cache.
- Return type:
bool
- classmethod unload_all_caches(connection, **filters)¶
Unload all content caches filtered by the class type. Optionally filter by additional conditions.
- Parameters:
cls (object) – Class type for objects to be filtered by
connection (Connection) – Strategy One connection object returned by connection.Connection()
**filters – Available filter parameters: [‘db_connection_id’, ‘db_login_id’, ‘owner’, ‘status’, ‘size’, ‘wh_tables’, ‘security_filter_id’]
- Return type:
None
- static unload_caches(connection, cache_ids)¶
Bulk unload caches.
- Parameters:
connection (Connection) – Strategy One connection object returned
'connection.Connection()' (by) –
cache_ids (list[str]) – list of cache ids to be unloaded
- Returns:
Response object.
- Return type:
Response | None
- enum mstrio.project_objects.content_cache.ContentCacheFormat(value)¶
Bases:
AutoName
Valid values are as follows:
- EXCEL = ContentCacheFormat.EXCEL¶
- PDF = ContentCacheFormat.PDF¶
- CSV = ContentCacheFormat.CSV¶
- HTML = ContentCacheFormat.HTML¶
- XML = ContentCacheFormat.XML¶
- PLAIN_TEXT = ContentCacheFormat.PLAIN_TEXT¶
- BINARY_DEFINITION = ContentCacheFormat.BINARY_DEFINITION¶
- BINARY_DATA = ContentCacheFormat.BINARY_DATA¶
- HTML5 = ContentCacheFormat.HTML5¶
- FLASH = ContentCacheFormat.FLASH¶
- TRANSACTION = ContentCacheFormat.TRANSACTION¶
- BINARY_DEFINITION_BINARY_DATA = ContentCacheFormat.BINARY_DEFINITION_BINARY_DATA¶
- BINARY_DATA_BINARY_DEFINITION = ContentCacheFormat.BINARY_DATA_BINARY_DEFINITION¶
- class mstrio.project_objects.content_cache.ContentCacheStatus(ready: bool, processing: bool, invalid: bool, expired: bool, loaded: bool, filed: bool, dirty: bool)¶
Bases:
Dictable
- Parameters:
ready (bool) –
processing (bool) –
invalid (bool) –
expired (bool) –
loaded (bool) –
filed (bool) –
dirty (bool) –
- classmethod bulk_from_dict(source_list, connection=None, to_snake_case=True, with_missing_value=False)¶
Creates multiple objects from a list of dictionaries. For each dictionary provided the keys in camel case are changed to object’s attribute names (by default in snake case) and dict values are composed to their proper data types such as Enums, list of Enums etc. as specified in the object’s _FROM_DICT_MAP.
- Parameters:
cls (T) – Class (type) of the objects that should be created.
source_list (List[Dict[str, Any]]) – A list of dictionaries from which the objects will be constructed.
connection (Connection, optional) – A MSTR Connection object. Defaults to None.
to_snake_case (bool, optional) – Set to True if attribute names should be converted from camel case to snake case. Defaults to True.
with_missing_value (bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
A list of objects of type T.
- Return type:
T
- classmethod from_dict(source, connection=None, to_snake_case=True, with_missing_value=False)¶
Creates an object from a dictionary. The dictionary’s keys in camel case are changed to object’s attribute names (by default in snake case) and dict values are composed to their proper data types such as Enums, list of Enums etc. as specified in _FROM_DICT_MAP.
- Parameters:
cls (T) – Class (type) of an object that should be created.
source (Dict[str, Any]) – A dictionary from which an object will be constructed.
connection (Connection, optional) – A MSTR Connection object. Defaults to None.
to_snake_case (bool, optional) – Set to True if attribute names should be converted from camel case to snake case. Defaults to True.
with_missing_value (bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
An object of type T.
- Return type:
T
- to_dict(camel_case=True)¶
Converts an object to a dictionary excluding object’s private properties. When converting the object to a dictionary, the object’s attributes become the dictionary’s keys and are in camel case by default Attribute values stored as objects are automatically converted to non-/ primitive data structures.
- Parameters:
camel_case (bool, optional) – Set to True if attribute names should be converted from snake case to camel case. Defaults to True.
- Returns:
- A dictionary representation of object’s attributes and values.
By default, the dictionary keys are in camel case.
- Return type:
dict
- dirty: bool¶
- expired: bool¶
- filed: bool¶
- invalid: bool¶
- loaded: bool¶
- processing: bool¶
- ready: bool¶