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.
parent_node_key
class-attribute
instance-attribute
¶
parent_node_id
class-attribute
instance-attribute
¶
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
¶
creation_date
class-attribute
instance-attribute
¶
created_by_name
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.
copy_to ¶
copy_to(
destination_package,
destination_team_domain,
overwrite=False,
delete_source=False,
**kwargs
)
Copies a content node to the specified domain and package in the same realm (ex. eu-1).
Parameters:
-
destination_package
(Package
) –The Package object to copy the asset to.
-
destination_team_domain
(str
) –The
of the destination team url: https:// . .celonis.cloud/ -
overwrite
(bool
, default:False
) –If true, any node with the same key will be overwritten. If false, a PyCelonisNodeAlreadyExistsError will be raised.
-
delete_source
(bool
, default:False
) –If true, deletes the node from the source. If false, keeps the source node.
-
**kwargs
(Any
, default:{}
) –Additional parameters set for ContentNodeCopyTransport
Returns:
-
ContentNodeTransport
–A read-only content node transport object of the copied asset.
Examples:
Copy a package:
package = space.get_package(<package_id>)
new_package = space.create_package("NEW_PACKAGE")
new_package.publish()
copied_package_transport = package.copy_to(new_package, <destination_team_domain>)
Copy a package asset:
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.
get_skills ¶
create_view ¶
create_view(
name,
key=None,
knowledge_model_key=None,
base_key=None,
board_asset_type=BoardAssetType.BOARD,
template=False,
allow_advanced_filters=True,
app_store_based=False,
**kwargs
)
Creates new view with name in given package.
Parameters:
-
name
(str
) –name for the view
-
key
(Optional[str]
, default:None
) –key for the view that is going to be created
-
knowledge_model_key
(Optional[str]
, default:None
) –knowledge model key if you want to link it to the view during creation
-
base_key
(Optional[str]
, default:None
) –to create an extended view defines the base view key for linking
-
allow_advanced_filters
(bool
, default:True
) –toggle to make the view allow advanced filters
Returns:
-
View
–An view object for newly created view.
Examples:
Create an empty view: