package
Module to interact with Packages.
This module contains class to interact with Packages in Studio.
Typical usage example:
```python
package = space.get_package(PACKAGE_ID)
package = space.create_package("NEW_PACKAGE")
package.publish()
package_history = package.get_history()
package.delete()
```
Package ¶
Bases: ContentNode
Package object to interact with package specific studio endpoints.
invalid_content
class-attribute
instance-attribute
¶
serialization_type
class-attribute
instance-attribute
¶
working_draft_id
class-attribute
instance-attribute
¶
activated_draft_id
class-attribute
instance-attribute
¶
show_in_viewer_mode
class-attribute
instance-attribute
¶
public_available
class-attribute
instance-attribute
¶
asset_metadata_transport
class-attribute
instance-attribute
¶
from_transport
classmethod
¶
Creates high-level content node object from given ContentNodeTransport.
Parameters:
-
client
(Client
) –Client to use to make API calls for given content node.
-
content_node_transport
(ContentNodeTransport
) –ContentNodeTransport object containing properties of content node.
Returns:
-
ContentNode
–A ContentNode object with properties from transport and given client.
is_package
staticmethod
¶
Returns whether content node transport is package.
Parameters:
-
content_node_transport
(ContentNodeTransport
) –Content node transport to check.
Returns:
-
bool
–Boolean if transport is package.
is_folder
staticmethod
¶
Returns whether content node transport is package.
Parameters:
-
content_node_transport
(ContentNodeTransport
) –Content node transport to check.
Returns:
-
bool
–Boolean if transport is folder.
is_analysis
staticmethod
¶
Returns whether content node transport is analysis.
Parameters:
-
content_node_transport
(ContentNodeTransport
) –Content node transport to check.
Returns:
-
bool
–Boolean if transport is analysis.
is_knowledge_model
staticmethod
¶
Returns whether content node transport is knowledge model.
Parameters:
-
content_node_transport
(ContentNodeTransport
) –Content node transport to check.
Returns:
-
bool
–Boolean if transport is knowledge model.
is_action_flow
staticmethod
¶
Returns whether content node transport is action flow.
Parameters:
-
content_node_transport
(ContentNodeTransport
) –Content node transport to check.
Returns:
-
bool
–Boolean if transport is action flow.
is_view
staticmethod
¶
Returns whether content node transport is view.
Parameters:
-
content_node_transport
(ContentNodeTransport
) –Content node transport to check.
Returns:
-
bool
–Boolean if transport is view.
is_simulation
staticmethod
¶
Returns whether content node transport is simulation.
Parameters:
-
content_node_transport
(ContentNodeTransport
) –Content node transport to check.
Returns:
-
bool
–Boolean if transport is simulation.
is_skill
staticmethod
¶
Returns whether content node transport is skill.
Parameters:
-
content_node_transport
(ContentNodeTransport
) –Content node transport to check.
Returns:
-
bool
–Boolean if transport is skill.
publish ¶
Publishes package with given version.
Parameters:
-
version
(Optional[str]
, default:None
) –Version to publish package with. Has to be of format
X.X.X
. By default gets next package version. -
node_ids_to_exclude
(Optional[List[str]]
, default:None
) –Nodes to exclude from publishing.
Examples:
Publish new version of package:
Publish new version of package with set version and exclude certain nodes from publishing:get_history ¶
Returns package history of all published versions.
Returns:
-
CelonisCollection[Optional[PackageHistoryTransport]]
–Package history.
load_version ¶
Loads previously published package version.
Parameters:
-
version
(str
) –Version to load.
-
root_draft_id
(str
) –Draft id of version to load (can be found in package history).
create_variable ¶
Creates new variable for given package.
Parameters:
-
key
(str
) –Key of variable.
-
value
(str
) –Value to be set for variable.
-
type_
(str
) –Type of variable, e.g. 'DATA_MODEL'.
-
runtime
(bool
, default:True
) –If true, variable can be referenced inside Knowledge Models and Views, and the value can be actively changed from the publishing App in Apps.
-
**kwargs
(Any
, default:{}
) –Additional parameters set for VariableDefinitionWithValue object.
Returns:
-
Variable
–A variable object for newly created variable.
Examples:
Create data model variable:
get_variables ¶
Returns variables located in given package.
Parameters:
-
type_
(Optional[str]
, default:None
) –If set, only variables of given type are returned.
Returns:
-
CelonisCollection[Variable]
–List of variables.
get_variable ¶
Gets variable located in package with given key.
Parameters:
-
key
(str
) –Key of variable.
Returns:
-
Variable
–A Variable object for variable with given key.
Raises:
-
PyCelonisNotFoundError
–Raised if no variable with key exists in given package.
get_content_node ¶
Gets content node located in package with given id.
Parameters:
-
id_
(str
) –Id of content node.
Returns:
-
ContentNode
–A ContentNode object for content node with given id.
Raises:
-
PyCelonisNotFoundError
–No content node with given id located in package
get_content_nodes ¶
Gets all content nodes of given package.
Returns:
-
CelonisCollection[ContentNode]
–A list containing all content nodes.
get_action_flow ¶
Gets action flow of given package.
Parameters:
-
id_
(str
) –Id of action flow.
Returns:
-
ActionFlow
–Action flow with given id.
get_action_flows ¶
Gets all action flows of given package.
Returns:
-
CelonisCollection[ActionFlow]
–A list containing all action flows.
create_analysis ¶
Creates new analysis with name in given package.
Parameters:
-
name
(str
) –Name of new analysis.
-
key
(Optional[str]
, default:None
) –Key of new analysis. Defaults to name.
-
data_model_id
(Optional[str]
, default:None
) –Id of data model to use.
-
change_default_event_log
(bool
, default:False
) –Whether to change default event log or not.
Returns:
-
Analysis
–An analysis object for newly created analysis.
Examples:
Create empty analysis with reference to data model:
get_analysis ¶
Gets analysis of given package.
Parameters:
-
id_
(str
) –Id of analysis.
Returns:
-
Analysis
–Analysis with given id.
get_analyses ¶
Gets all analyses of given package.
Returns:
-
CelonisCollection[Analysis]
–A list containing all analyses.
create_folder ¶
Create new folder with name in given package.
Parameters:
-
name
(str
) –Name of new folder.
-
key
(Optional[str]
, default:None
) –Key of new folder. Defaults to name.
-
**kwargs
(Any
, default:{}
) –Additional parameters set for SaveContentNodeTransport object.
Returns:
-
Folder
–A Folder object for newly created folder.
Examples:
Create empty folder:
get_folder ¶
Get folder of given package.
Parameters:
-
id_
(str
) –Id of folder.
Returns:
-
Folder
–Folder with given id.
get_folders ¶
Get all folders of given package.
Returns:
-
CelonisCollection[Folder]
–A list containing all folders.
create_knowledge_model ¶
create_knowledge_model(
content,
with_autogenerated_data_model_data=True,
with_variable_replacement=True,
)
Creates new knowledge model in given package.
Parameters:
-
content
(Dict
) –Content of new knowledge model.
-
with_autogenerated_data_model_data
(bool
, default:True
) –Defines whether automatically generated records and kpis are added.
-
with_variable_replacement
(bool
, default:True
) –Defines whether used variables are replaced automatically.
Returns:
-
KnowledgeModel
–A KnowledgeModel object for newly created knowledge model.
Examples:
Create empty knowledge model with new data model variable:
data_model_variable = package.create_variable(
key="data_model_variable",
value=data_model.id,
type_="DATA_MODEL"
)
content = {
"kind" : "BASE",
"metadata" : {"key":"knowledge_model_key", "displayName":"Test Knowledge Model"},
"dataModelId" : f"${{{{{data_model_variable.key}}}}}"
}
knowledge_model = package.create_knowledge_model(content)
get_knowledge_model ¶
Gets knowledge_model of given package.
Parameters:
-
id_
(str
) –Id of knowledge_model.
Returns:
-
KnowledgeModel
–Knowledge model with given id.
get_knowledge_models ¶
Gets all knowledge models of given package.
Returns:
-
CelonisCollection[KnowledgeModel]
–A list containing all knowledge models.
get_simulation ¶
Gets simulation of given package.
Parameters:
-
id_
(str
) –Id of simulation.
Returns:
-
Simulation
–Simulation with given id.
get_simulations ¶
Gets all simulations of given package.
Returns:
-
CelonisCollection[Simulation]
–A list containing all simulations.
get_skill ¶
Gets skill of given package.
Parameters:
-
id_
(str
) –Id of skill.
Returns:
-
Skill
–Skill with given id.