taipy.core.DataNode
Bases: _Entity
, _Labeled
Reference to a dataset.
A Data Node is an abstract class that holds metadata related to the dataset it refers to.
In particular, a data node holds the name, the scope, the owner identifier, the last
edit date, and some additional properties of the data.
A Data Node also contains information and methods needed to access the dataset. This
information depends on the type of storage, and it is held by subclasses (such as
SQL Data Node, CSV Data Node, ...).
Note
It is recommended not to instantiate subclasses of DataNode
directly.
Attributes:
Name | Type | Description |
---|---|---|
config_id |
str
|
Identifier of the data node configuration. It must be a valid Python identifier. |
scope |
Scope
|
The scope of this data node. |
id |
str
|
The unique identifier of this data node. |
name |
str
|
A user-readable name of this data node. |
owner_id |
str
|
The identifier of the owner (sequence_id, scenario_id, cycle_id) or None. |
parent_ids |
Optional[Set[str]]
|
The set of identifiers of the parent tasks. |
last_edit_date |
datetime
|
The date and time of the last modification. |
edits |
List[Edit]
|
The list of Edits (an alias for dict) containing metadata about each data edition including but not limited to timestamp, comments, job_id: timestamp: The time instant of the writing comments: Representation of a free text to explain or comment on a data change job_id: Only populated when the data node is written by a task execution and corresponds to the job's id. Additional metadata related to the edition made to the data node can also be provided in Edits. |
version |
str
|
The string indicates the application version of the data node to instantiate. If not provided, the current version is used. |
validity_period |
Optional[timedelta]
|
The duration implemented as a timedelta since the last edit date for
which the data node can be considered up-to-date. Once the validity period has passed, the data node is
considered stale and relevant tasks will run even if they are skippable (see the
Task management page for more details).
If validity_period is set to |
edit_in_progress |
bool
|
True if the data node is locked for modification. False otherwise. |
editor_id |
Optional[str]
|
The identifier of the user who is currently editing the data node. |
editor_expiration_date |
Optional[datetime]
|
The expiration date of the editor lock. |
kwargs |
Optional[datetime]
|
A dictionary of additional properties. |
expiration_date: datetime
property
¶
Datetime instant of the expiration date of this data node.
is_ready_for_reading: bool
property
¶
Indicate if this data node is ready for reading.
Returns:
Type | Description |
---|---|
bool
|
False if the data is locked for modification or if the data has never been written. True otherwise. |
is_up_to_date: bool
property
¶
Indicate if this data node is up-to-date.
Returns:
Type | Description |
---|---|
bool
|
False if a preceding data node has been updated before the selected data node |
bool
|
or the selected data is invalid. |
bool
|
True otherwise. |
is_valid: bool
property
¶
Indicate if this data node is valid.
Returns:
Type | Description |
---|---|
bool
|
False if the data ever been written or the expiration date has passed. |
bool
|
True otherwise. |
job_ids
property
¶
List of the jobs having edited this data node.
parent_ids
property
¶
List of parent ids of this data node.
properties
property
¶
Dictionary of custom properties.
append(data, job_id=None, **kwargs)
¶
Append some data to this data node.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Any
|
The data to write to this data node. |
required |
job_id |
JobId
|
An optional identifier of the writer. |
None
|
**kwargs |
dict[str, any]
|
Extra information to attach to the edit document corresponding to this write. |
{}
|
filter(operators, join_operator=JoinOperator.AND)
¶
Read and filter the data referenced by this data node.
The data is filtered by the provided list of 3-tuples (key, value, Operator
).
If multiple filter operators are provided, filtered data will be joined based on the join operator (AND or OR).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
operators |
Union[List[Tuple], Tuple]
|
A 3-element tuple or a list of 3-element tuples,
each is in the form of (key, value, |
required |
join_operator |
JoinOperator
|
The operator used to join the multiple filter 3-tuples. |
AND
|
get_label()
¶
Returns the data node simple label prefixed by its owner label.
Returns:
Type | Description |
---|---|
str
|
The label of the data node as a string. |
get_last_edit()
¶
get_parents()
¶
Get all parents of this data node.
get_simple_label()
¶
Returns the data node simple label.
Returns:
Type | Description |
---|---|
str
|
The simple label of the data node as a string. |
lock_edit(editor_id=None)
¶
Lock the data node modification.
Note
The data node can be unlocked with the method unlock_edit()
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
editor_id |
Optional[str]
|
The editor's identifier. |
None
|
read()
¶
Read the data referenced by this data node.
Returns:
Type | Description |
---|---|
Any
|
The data referenced by this data node. None if the data has not been written yet. |
read_or_raise()
¶
Read the data referenced by this data node.
Returns:
Type | Description |
---|---|
Any
|
The data referenced by this data node. |
Raises:
Type | Description |
---|---|
NoData
|
If the data has not been written yet. |
track_edit(**options)
¶
Creates and adds a new entry in the edits attribute without writing the data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
options |
dict[str, any
|
track |
{}
|
unlock_edit(editor_id=None)
¶
Unlocks the data node modification.
Note
The data node can be locked with the method lock_edit()
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
editor_id |
Optional[str]
|
The editor's identifier. |
None
|
write(data, job_id=None, **kwargs)
¶
Write some data to this data node.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Any
|
The data to write to this data node. |
required |
job_id |
JobId
|
An optional identifier of the writer. |
None
|
**kwargs |
dict[str, any]
|
Extra information to attach to the edit document corresponding to this write. |
{}
|