Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

feature/#806 move name attribute of dn to properties #812

Merged
merged 3 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/taipy/core/_entity/_migrate/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def __search_parent_ids(entity_id: str, data: Dict) -> List:
if entity_type == "TASK" and "SCENARIO" in _id:
if entity_id in entity_data["tasks"]:
parents.append(_id)
parents.sort()
return parents


Expand All @@ -68,6 +69,8 @@ def __search_parent_config(entity_id: str, config: Dict, entity_type: str) -> Li
if entity_type == "TASK" and possible_parents == "SCENARIO":
if section_id in entity_data["tasks"]:
parents.append(section_id)

parents.sort()
return parents


Expand Down Expand Up @@ -187,6 +190,9 @@ def __migrate_datanode(datanode: Dict) -> Dict:
# Update Scope enum after Pipeline removal
datanode["scope"] = __update_scope(datanode["scope"])

# Update move name attribute to properties dictionary
datanode["data_node_properties"]["name"] = datanode.pop("name", None)

if "last_edit_date" not in datanode:
datanode["last_edit_date"] = datanode.get("last_edition_date")
if "last_edition_date" in datanode:
Expand Down
2 changes: 0 additions & 2 deletions src/taipy/core/data/_abstract_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def __init__(
config_id: str,
scope: Scope,
id: Optional[DataNodeId] = None,
name: Optional[str] = None,
owner_id: Optional[str] = None,
parent_ids: Optional[Set[str]] = None,
last_edit_date: Optional[datetime] = None,
Expand All @@ -110,7 +109,6 @@ def __init__(
config_id,
scope,
id,
name,
owner_id,
parent_ids,
last_edit_date,
Expand Down
2 changes: 0 additions & 2 deletions src/taipy/core/data/_data_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ def _entity_to_model(cls, data_node: DataNode) -> _DataNodeModel:
data_node.config_id,
data_node._scope,
data_node.storage_type(),
properties.pop("name", None) or data_node._name,
data_node.owner_id,
list(data_node._parent_ids),
data_node._last_edit_date.isoformat() if data_node._last_edit_date else None,
Expand Down Expand Up @@ -287,7 +286,6 @@ def _model_to_entity(cls, model: _DataNodeModel) -> DataNode:
config_id=model.config_id,
scope=model.scope,
id=model.id,
name=model.name,
owner_id=model.owner_id,
parent_ids=set(model.parent_ids),
last_edit_date=datetime.fromisoformat(model.last_edit_date) if model.last_edit_date else None,
Expand Down
1 change: 0 additions & 1 deletion src/taipy/core/data/_data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def __create(
return cls.__DATA_NODE_CLASS_MAP[storage_type](
config_id=data_node_config.id,
scope=data_node_config.scope or DataNodeConfig._DEFAULT_SCOPE,
name=props.pop(cls.__NAME_KEY, None),
validity_period=data_node_config.validity_period,
owner_id=owner_id,
parent_ids=parent_ids,
Expand Down
3 changes: 0 additions & 3 deletions src/taipy/core/data/_data_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class _DataNodeModel(_BaseModel):
Column("config_id", String),
Column("scope", Enum(Scope)),
Column("storage_type", String),
Column("name", String),
Column("owner_id", String),
Column("parent_ids", JSON),
Column("last_edit_date", String),
Expand All @@ -50,7 +49,6 @@ class _DataNodeModel(_BaseModel):
config_id: str
scope: Scope
storage_type: str
name: Optional[str]
owner_id: Optional[str]
parent_ids: List[str]
last_edit_date: Optional[str]
Expand All @@ -71,7 +69,6 @@ def from_dict(data: Dict[str, Any]):
config_id=data["config_id"],
scope=Scope._from_repr(data["scope"]),
storage_type=data["storage_type"],
name=data.get("name"),
owner_id=data.get("owner_id"),
parent_ids=data.get("parent_ids", []),
last_edit_date=data.get("last_edit_date"),
Expand Down
3 changes: 0 additions & 3 deletions src/taipy/core/data/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class CSVDataNode(DataNode, _AbstractFileDataNode, _AbstractTabularDataNode):
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 identifiers of the parent tasks or `None`.
last_edit_date (datetime): The date and time of the last modification.
Expand Down Expand Up @@ -83,7 +82,6 @@ def __init__(
config_id: str,
scope: Scope,
id: Optional[DataNodeId] = None,
name: Optional[str] = None,
owner_id: Optional[str] = None,
parent_ids: Optional[Set[str]] = None,
last_edit_date: Optional[datetime] = None,
Expand Down Expand Up @@ -114,7 +112,6 @@ def __init__(
config_id,
scope,
id,
name,
owner_id,
parent_ids,
last_edit_date,
Expand Down
10 changes: 3 additions & 7 deletions src/taipy/core/data/data_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def __init__(
config_id,
scope: Scope = Scope(Scope.SCENARIO),
id: Optional[DataNodeId] = None,
name: Optional[str] = None,
owner_id: Optional[str] = None,
parent_ids: Optional[Set[str]] = None,
last_edit_date: Optional[datetime] = None,
Expand All @@ -114,7 +113,6 @@ def __init__(
self._parent_ids = parent_ids or set()
self._scope = scope
self._last_edit_date = last_edit_date
self._name = name
self._edit_in_progress = edit_in_progress
self._version = version or _VersionManagerFactory._build_manager()._get_latest_version()
self._validity_period = validity_period
Expand Down Expand Up @@ -201,14 +199,12 @@ def expiration_date(self) -> datetime:
return last_edit_date + validity_period if validity_period else last_edit_date

@property # type: ignore
@_self_reload(_MANAGER_NAME)
def name(self):
return self._name
def name(self) -> Optional[str]:
return self.properties.get("name")

@name.setter # type: ignore
@_self_setter(_MANAGER_NAME)
def name(self, val):
self._name = val
self.properties["name"] = val

@property
def version(self):
Expand Down
3 changes: 0 additions & 3 deletions src/taipy/core/data/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class ExcelDataNode(DataNode, _AbstractFileDataNode, _AbstractTabularDataNode):
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 identifiers of the parent tasks or `None`.
Expand Down Expand Up @@ -89,7 +88,6 @@ def __init__(
config_id: str,
scope: Scope,
id: Optional[DataNodeId] = None,
name: Optional[str] = None,
owner_id: Optional[str] = None,
parent_ids: Optional[Set[str]] = None,
last_edit_date: Optional[datetime] = None,
Expand Down Expand Up @@ -120,7 +118,6 @@ def __init__(
config_id,
scope,
id,
name,
owner_id,
parent_ids,
last_edit_date,
Expand Down
3 changes: 0 additions & 3 deletions src/taipy/core/data/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class GenericDataNode(DataNode):
identifier.
scope (Scope^): The scope of this data node.
id (str): The unique identifier of the data node.
name (str): A user-readable name of the data node.
owner_id (str): The identifier of the owner (sequence_id, scenario_id, cycle_id) or
`None`.
parent_ids (Optional[Set[str]]): The identifiers of the parent tasks or `None`.
Expand Down Expand Up @@ -67,7 +66,6 @@ def __init__(
config_id: str,
scope: Scope,
id: Optional[DataNodeId] = None,
name: Optional[str] = None,
owner_id: Optional[str] = None,
parent_ids: Optional[Set[str]] = None,
last_edit_date: Optional[datetime] = None,
Expand Down Expand Up @@ -99,7 +97,6 @@ def __init__(
config_id,
scope,
id,
name,
owner_id,
parent_ids,
last_edit_date,
Expand Down
3 changes: 0 additions & 3 deletions src/taipy/core/data/in_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class InMemoryDataNode(DataNode):
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 identifiers of the parent tasks or `None`.
Expand Down Expand Up @@ -66,7 +65,6 @@ def __init__(
config_id: str,
scope: Scope,
id: Optional[DataNodeId] = None,
name: Optional[str] = None,
owner_id: Optional[str] = None,
parent_ids: Optional[Set[str]] = None,
last_edit_date: Optional[datetime] = None,
Expand All @@ -85,7 +83,6 @@ def __init__(
config_id,
scope,
id,
name,
owner_id,
parent_ids,
last_edit_date,
Expand Down
3 changes: 0 additions & 3 deletions src/taipy/core/data/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class JSONDataNode(DataNode, _AbstractFileDataNode):
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 identifiers of the parent tasks or `None`.
last_edit_date (datetime): The date and time of the last modification.
Expand Down Expand Up @@ -77,7 +76,6 @@ def __init__(
config_id: str,
scope: Scope,
id: Optional[DataNodeId] = None,
name: Optional[str] = None,
owner_id: Optional[str] = None,
parent_ids: Optional[Set[str]] = None,
last_edit_date: Optional[datetime] = None,
Expand All @@ -101,7 +99,6 @@ def __init__(
config_id,
scope,
id,
name,
owner_id,
parent_ids,
last_edit_date,
Expand Down
3 changes: 0 additions & 3 deletions src/taipy/core/data/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class MongoCollectionDataNode(DataNode):
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 identifiers of the parent tasks or `None`.
Expand Down Expand Up @@ -88,7 +87,6 @@ def __init__(
config_id: str,
scope: Scope,
id: Optional[DataNodeId] = None,
name: Optional[str] = None,
owner_id: Optional[str] = None,
parent_ids: Optional[Set[str]] = None,
last_edit_date: Optional[datetime] = None,
Expand All @@ -114,7 +112,6 @@ def __init__(
config_id,
scope,
id,
name,
owner_id,
parent_ids,
last_edit_date,
Expand Down
3 changes: 0 additions & 3 deletions src/taipy/core/data/parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class ParquetDataNode(DataNode, _AbstractFileDataNode, _AbstractTabularDataNode)
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 identifiers of the parent tasks or `None`.
last_edit_date (datetime): The date and time of the last modification.
Expand Down Expand Up @@ -98,7 +97,6 @@ def __init__(
config_id: str,
scope: Scope,
id: Optional[DataNodeId] = None,
name: Optional[str] = None,
owner_id: Optional[str] = None,
parent_ids: Optional[Set[str]] = None,
last_edit_date: Optional[datetime] = None,
Expand Down Expand Up @@ -150,7 +148,6 @@ def __init__(
config_id,
scope,
id,
name,
owner_id,
parent_ids,
last_edit_date,
Expand Down
3 changes: 0 additions & 3 deletions src/taipy/core/data/pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class PickleDataNode(DataNode, _AbstractFileDataNode):
identifer.
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 identifiers of the parent tasks or `None`.
Expand Down Expand Up @@ -71,7 +70,6 @@ def __init__(
config_id: str,
scope: Scope,
id: Optional[DataNodeId] = None,
name: Optional[str] = None,
owner_id: Optional[str] = None,
parent_ids: Optional[Set[str]] = None,
last_edit_date: Optional[datetime] = None,
Expand All @@ -95,7 +93,6 @@ def __init__(
config_id,
scope,
id,
name,
owner_id,
parent_ids,
last_edit_date,
Expand Down
3 changes: 0 additions & 3 deletions src/taipy/core/data/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class SQLDataNode(_AbstractSQLDataNode):
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 identifiers of the parent tasks or `None`.
Expand Down Expand Up @@ -77,7 +76,6 @@ def __init__(
config_id: str,
scope: Scope,
id: Optional[DataNodeId] = None,
name: Optional[str] = None,
owner_id: Optional[str] = None,
parent_ids: Optional[Set[str]] = None,
last_edit_date: Optional[datetime] = None,
Expand All @@ -100,7 +98,6 @@ def __init__(
config_id,
scope,
id,
name,
owner_id,
parent_ids,
last_edit_date,
Expand Down
3 changes: 0 additions & 3 deletions src/taipy/core/data/sql_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class SQLTableDataNode(_AbstractSQLDataNode):
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 identifiers of the parent tasks or `None`.
Expand Down Expand Up @@ -78,7 +77,6 @@ def __init__(
config_id: str,
scope: Scope,
id: Optional[DataNodeId] = None,
name: Optional[str] = None,
owner_id: Optional[str] = None,
parent_ids: Optional[Set[str]] = None,
last_edit_date: Optional[datetime] = None,
Expand All @@ -98,7 +96,6 @@ def __init__(
config_id,
scope,
id=id,
name=name,
owner_id=owner_id,
parent_ids=parent_ids,
last_edit_date=last_edit_date,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"config_id": "cleaned_dataset",
"scope": "<Scope.GLOBAL: 3>",
"storage_type": "parquet",
"name": null,
"owner_id": null,
"parent_ids": [
"TASK_predict_cf8b3c83-5ea7-40eb-b8af-d5240852ff5b",
Expand All @@ -29,6 +28,7 @@
"compression": "snappy",
"exposed_type": "pandas",
"read_kwargs": {},
"write_kwargs": {}
"write_kwargs": {},
"name": null
}
}
Loading