DataFlowObject
- class composapy.dataflow.models.DataFlowObject(contract: Application)
A DataFlowObject is the controller for a Composable dataflow instance. A dataflow instance can manage the saved, or unsaved, state of the underlying Application contract. Typically, DataFlowObjects are created through the DataFlow class api, not manually instantiated by a user with an Application contract.
Note: DataFlowObject ID’s are unique and different from DataFlowRun ID’s.
from composapy.dataflow.api dataflow_object = DataFlow.get(123456) dataflow_object = DataFlow.create(file_name="path/to/json/dataflow")
- property id: int | None
The contract id. An unsaved DataFlowObject’s id property is None.
- property module: any
Convenience property that gets the first module. Cannot be used if there is more than one module.
- property modules: ModuleSet
A ModuleSet made up of Module’s.
- run(external_inputs: Dict[str, any] = None) DataFlowRun
Runs the dataflow represented by contained contract. Any external modules (external int, table, file) that require outside input to run can be added using a dictionary with the module input’s name and corresponding contract.
dataflow_run = dataflow_object.run()
- save() DataFlowObject
Saves the contract representation of DataFlowObject, uses server response as the newly updated contract object (for instance, saving an unsaved contract will give it an id).
dataflow_object = DataFlow.create(file_path="dataflow.json") print(dataflow_object.id) # returns -> None (unsaved) dataflow_object.save() print(dataflow_object.id) # returns -> 123456 (saved)